Src... example for Visual J++

This example uses the source rectangle properties to zoom in on the image.

// Calculate the values to zoom in by 10 percent and center the image.
if( LEAD1.getSrcWidth() > 1 && LEAD1.getSrcHeight() > 1 )
{
   LEAD1.setSrcWidth( LEAD1.getSrcWidth() * 0.9f );
   LEAD1.setSrcHeight( LEAD1.getSrcHeight() * 0.9f );
   LEAD1.setSrcTop( ( LEAD1.getBitmapHeight() - LEAD1.getSrcHeight() ) / 2 );
   LEAD1.setSrcLeft( ( LEAD1.getBitmapWidth() - LEAD1.getSrcWidth() ) / 2 );
}

// Set the clipping area to the same as the source rectangle
LEAD1.setSrcClipWidth( LEAD1.getSrcWidth() );
LEAD1.setSrcClipHeight( LEAD1.getSrcHeight() );
LEAD1.setSrcClipTop( LEAD1.getSrcTop() );
LEAD1.setSrcClipLeft( LEAD1.getSrcLeft() );

// Redisplay the image
LEAD1.ForceRepaint();