Method XbpBitmap():setBuffer() Foundation

Sets or returns the buffer containing the image data.

Syntax
:setBuffer( [<cBuffer>], [<nFormat>|<cCodecUUID>], [<nCompression>] ) --> cOldBuffer
Parameters
<cBuffer>
<cBuffer> is a character string containing image data.
<nFormat>
<nFormat> indicates the image data format for the return value of the method. Constants listed in the following table can be used. They are defined in the XBP.CH file:
Constants for image formats
Constant Description
XBPBMP_FORMAT_GIF Graphics Interchange Format
XBPBMP_FORMAT_JPG Joined Photographic Experts Group
XBPBMP_FORMAT_PNG Portable Network Graphics
XBPBMP_FORMAT_BMP Windows bitmap file
XBPBMP_FORMAT_WIN2X Windows 2.x bitmap buffer
XBPBMP_FORMAT_WIN3X Windows 3.x bitmap buffer
XBPBMP_FORMAT_OS21X OS/2 1.x bitmap buffer
XBPBMP_FORMAT_OS22X OS/2 2.x bitmap buffer
XBPBMP_FORMAT_TIFF Tagged Image File file
XBPBMP_FORMAT_JPGXR JPEG extended range file
XBPBMP_FORMAT_DEFAULT *) Constant is independent of the operating system. Equivalent to XBPBMP_FORMAT_WIN3X under Windows
  1. Default
<cCodecUUID>
The parameter <nCodecUUID> specifies the operating system image encoder to use for encoding the resulting buffer. The parameter can be used instead of the <nFormat> parameter for selecting image formats other than the pre-defined formats. To do this, a character string must be assigned with the Universally Unique Identifier (UUID) of the Windows Imaging Component (WIC) codec. The UUID has the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
<nCompression>
<nCompression> is an optional parameter that defines the compression rate for image formats that support compression. This is a value from 0 to 100, with 0 being equivalent to "no compression" and 100 meaning "maximum compression". This parameter defaults to the #define constant XBPBMP_DEF_COMPRESSION from XBP.CH, which selects a format-specific default compression rate. Generally, this is an average compression rate that provides for reasonable compression speed while perserving image information.
Return

This method returns the data in the buffer of the XbpBitmap object before the method was called. If <nFormat> is specified, the return value is converted to the corresponding image format.

Description

The :setBuffer() method retrieves or changes the data in the buffer of an XbpBitmap object. All graphic information of an image is stored in the buffer as a character string.

The parameter <nCompression> is only important for image file formats which support data compression. These are PNG and JPEG formats, the latter of which exposes a reduced image quality with an increased compression rate.

If one of the Windows bitmap buffer formats is specified in the <nFormat> parameter, :setBuffer() returns only the actual image data. The Bitmap file header which must exist in bitmap files which are saved to disk is not included in the buffer. Use the XBPBMP_FORMAT_BMP constant to retrieve the buffer in a format which can be read by other applications.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.