Platform Package reference: Function EwCreateBitmap()

Description of the function EwCreateBitmap() available in all Platform Packages for C compatible target systems. This function is intended to be used when integrating the Embedded Wizard created GUI application with the underlying graphics subsystem, graphics hardware or other external GUI applications coexisting on the same system.

Declaration

XBitmap* EwCreateBitmap

(

  int      aFormat,

  XPoint   aFrameSize,

  XInt32   aFrameDelay,

  XInt32   aNoOfFrames

)

Parameters

aFormat

Color format of the bitmap. Possible values are: EW_PIXEL_FORMAT_NATIVE, EW_PIXEL_FORMAT_ALPHA8, EW_PIXEL_FORMAT_INDEX8 and EW_PIXEL_FORMAT_RGB565. Please note, the support for the format EW_PIXEL_FORMAT_RGB565 depends on the particular target system.

aFrameSize

Size of a single bitmap frame.

aFrameDelay

Delay in milliseconds for animated bitmaps. If no animation is desired for the bitmap, the value 0 (zero) should be passed in this parameter.

aNoOfFrames

Number of frames to embed within the bitmap. The parameter should be at least 1 (one). Passing a value > 1 in this parameter results in a multi-frame bitmap.

Discussion

The function EwCreateBitmap() creates a new bitmap with the given size and specified color format:

Format

Description

EW_PIXEL_FORMAT_NATIVE

Represents the main pixel format valid within the particular graphics subsystem without any assumptions about the respective color space, color channels, etc. This is the pixel format, the subsystem is working with internally. In this manner the Graphics Engine remains platform and color independent. Please note, bitmaps with this color format can serve as destination and source in all drawing operations.

EW_PIXEL_FORMAT_ALPHA8

Universal 8-bit per pixel alpha only format. Useful as storage for glyphs, masks, etc. Please note, bitmaps with this color format can serve as source only in all drawing operations.

EW_PIXEL_FORMAT_INDEX8

Universal 8-bit per pixel palette format. This format expects an additional color palette for translation between an 8-bit index and the native color value. The colors within the palette are determined by using the function EwModifyBitmapPalette(). Please note, bitmaps with this color format can serve as source only in all drawing operations.

EW_PIXEL_FORMAT_RGB565

16-bit per pixel RGB color format without opacity information. This format is optional depending on your target system. Please note, bitmaps with this color format can serve as source only in all drawing operations.

The function returns the pointer to a XBitmap structure representing the just created bitmap. If the given parameters are not valid or the bitmap could not be created due to insufficient memory the function will fail and return NULL. If no more used, the bitmap should be freed by calling the function EwFreeBitmap().

The following C example code creates a new bitmap containing a single frame with 100 x 60 pixel size. The bitmap stores the pixel data in the native format of the particular target system:

XPoint frameSize = { 100, 60 }; XBitmap* bitmap = EwCreateBitmap( EW_PIXEL_FORMAT_NATIVE, frameSize, 0, 1 );

If you intend to fill the bitmap with individual contents, you can use the function EwLockBitmap() to obtain access to the bitmap memory.