ImageGear Professional > User Guide > Using ImageGear > Images and Documents > Clipboard Operations > Pasting an Image from the Clipboard |
There are two ImageGear functions for pasting the image from the clipboard:
Before you call IG_clipboard_paste_merge_ex(), you can call the function IG_clipboard_paste_op_set() to specify the kind of arithmetic operation you want to apply to the pixels of the two bitmaps that intersect during the paste-merge. IG_clipboard_paste_op_set() takes an AT_MODE constant (defined in accucnst.h) that has a prefix of IG_ARITH_. The full group of arithmetic constants is listed under the function description for IG_clipboard_paste_op_set(). ImageGear also supplies a companion reading function IG_clipboard_paste_op_get() to read the current setting for the paste-merge arithmetic operation. See Example code below:
Copy Code
|
|
---|---|
AT_DIMENSION nWi, nHi; UINT nBpp; BOOL bPasteAvail; AT_ERRCOUNT nErrcount; HIGEAR hIGear, hIGear2; AT_RECT rcClipRect; nErrcount = IG_load_file("picture.bmp", &hIGear); if (nErrcount == 0) { nErrcount = IG_image_dimensions_get ( hIGear, &nWid, &nHi, &nBpp );*/ if ( nErrcount == 0 ) /* If valid image dimensions */ {/* send the bottom half of the image*/ rcClipRect.top = nHi/2; /* to the clipboard */ rcClipRect.left = 0; rcClipRect.right = nWi - 1; rcClipRect.bottom = nHi - 1; nErrcount = IG_clipboard_copy (hIGear, &rcClipRect); } if (nErrcount == 0) { /*load a second image into which to merge the clipboard contents*/ nErrcount = IG_load_file("picture2.bmp", &hIGear2); } if (nErrcount == 0) { nErrcount = IG_clipboard_paste_available_ex(&bPasteAvail); if (bPasteAvail == TRUE) { /* set the paste-merge arithmetic operation to Img1^Img2 */ nErrcount = IG_clipboard_paste_op_set(hIGear, IG_ARITH_XOR); /* merge clipboard's rectangular contents with upper left corner at position 0,0 */ nErrcount = IG_clipboard_paste_merge_ex(hIGear2, 0 , 0); } } |