Available in the LEADTOOLS Imaging toolkit. |
DIB example for Visual J++
This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.
setCursor( Cursor.WAIT ); // hourglass
int nMyFlags = LTOCXU.CopyConstants.COPY_EMPTY | LTOCXU.CopyConstants.COPY_DIB | LTOCXU.CopyConstants.COPY_PALETTE;
LEAD1.Copy( (short) nMyFlags );
if( LEAD2.Paste( (short) LTOCXU.PasteConstants.PASTE_ISREADY ) == 0 )
MessageBox.show( "Invalid data on the clipboard" );
else
LEAD2.Paste( (short) 0 );
LEAD2.Reverse();
int hMyDib = LEAD2.GetDIB();
LEAD1.SetDIB( hMyDib );
LEAD1.ForceRepaint();
setCursor( Cursor.DEFAULT ); // default