createPictureAsType

createPictureAsType(entireWindow:      Boolean;
                    includeChildren:   Boolean;
                    numberOfColorBits: Integer;
                    imageType:         Integer): Binary;

The createPictureAsType method of the Window class creates an image of the specified image type for the presentation client receiver form or control, respectively.

This method effectively combines the following instructions into a single instruction and therefore requires only one message to be sent from the application server to the presentation client instead of two, thus reducing the network traffic for a presentation client. You can also reduce the size of the returned image significantly if you specify the imageType parameter as PictureType_Png instead of PictureType_Bitmap.

bin := window.createPicture(false, true, 24);
bin := bin.convertPicture(PictureType_Png);

Use the entireWindow parameter to specify that the created picture includes the non-client area of the form or control, the includeChildren parameter to specify that the created picture includes child controls (that is, controls that are placed on the form or control are included in the picture), and the numberOfColorBits parameter to specify the number of color bits for the picture. (The valid numbers of color bits that you can specify are 1, 4, 8, or 24.)

The createPictureAsType method creates an image by drawing the window (and its children, if required) and replaying any drawing commands saved while the autoRedraw property is set to true. The process does not scrape the image off the screen.

When you call this method for the Window class on an MDI frame that has MDI children, the frame and all of its children are included in the image. In addition, you can use this method to capture the entire image of a Form and its controls.

The created image is a reflection of how the window, which can include child windows, would be displayed. To recreate an image of a different size, set the image into a picture control with the stretch property set to Stretch_ToControl (1) and call createPictureAsType(false, false, 24, PictureType_Png).

For Picture and JadeMask Web images, the createPictureAsType method attempts to preserve any image transparency, where possible. This applies only if all of the following are true.

If all of the above are true and the image size is:

If any of the above is false, the createPictureAsType method constructs the required image by drawing all of the control components into a new image. This results in any transparency effects being lost.

If you rely on the value of the Picture class transparentColor property for the images, images may have a black background.

Use the imageType parameter to specify the type of image to be generated. For a presentation client, the image type can be one of PictureType_Bitmap, PictureType_Png, PictureType_Jpeg, PictureType_Jpeg2000, or PictureType_Tiff.

See also the Control class createPictureIndirect method, which improves JADE thin client mode performance as it does not have to pass large binary large objects (blobs) back and forth between the presentation client and the application server.