Available in the LEADTOOLS Imaging toolkit. |
PaintMaxPasses example for Visual J++
This example includes two procedures. First, a button click starts a multi-pass paint effect; then LEAD's PaintNotification event changes the direction of the effect on each pass.
private void button1_click(Object source, Event e)
{
LEAD1.setAutoRepaint( false );
LEAD1.setPaintEffect(short) LTOCXU.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN ); // Set the Effect
LEAD1.setPaintMaxPasses( (short) 5 ); // 5 total passes
LEAD1.setPaintPass( (short) 1 ); // Start with pass number 1
LEAD1.setPaintNotificationDelay( (short) 200 ); // Delay 200 milliseconds between passes
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 ); // Load the image
LEAD1.setAutoRepaint( true );
}
private void LEAD1_paintNotification(Object source, LTOCXU.LEAD.PaintNotificationEvent e)
{
// If the first pass is complete
if( e.uType == LTOCXU.EfxNotifyConstants.EFX_NOTIFY_IMAGE && e.uPass > 0 )
{
// Toggle the effect from left_to_right to right_to_left
if( LEAD1.getPaintEffect() == LTOCXU.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN )
LEAD1.setPaintEffect( (short) LTOCXU.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_IN_THEN_OUT );
else
LEAD1.setPaintEffect( (short) LTOCXU.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN );
}
}