Was this helpful?
FormatBitmap Method
The FormatBitmap method converts a bitmap object of any format that OpenROAD can read into a 24-bit bitmap object, icon, or cursor bitmap.
Most of the BitmapObject manipulation methods require a 24 bit-bitmap and automatically convert the source bitmap to the appropriate format; this method enables the conversion to 24-bit to be applied explicitly at runtime.
Note:  The resulting bitmap will have the same filehandle, dbhandle, and label values as the source bitmap; to minimize the risk of overwriting one with the other, set the label attribute to a different value to enable the two bitmaps to be distinguished cleanly during subsequent processing.
This method has the following syntax:
BitmapObject = BitmapObject.FormatBitmap([formattype = integer]
          [, formatmode = integer][, width = integer][, height = integer]
          [, force = integer][, xHotspot = integer][, yHotspot = integer])
This method has the following parameters:
formattype
Specifies the output format. This is always 24-bit. Valid values are:
BF_BMP
Bitmap (BMP) format
BF_WINDOWICON
Icon (ICO) format
BF_WINDOWCURSOR
Cursor (CUR) format
Default: BF_BMP
formatmode
Specifies the mode to apply if resizing the bitmap. Valid values are:
BD_BLACKONWHITE
Preserves black outlines and text in monochrome displays when shrinking (white text on black disappears).
BD_WHITEONBLACK
Preserves white outlines and text in monochrome displays when shrinking (black text on white disappears).
BD_COLORONCOLOR
Maps pixels from the source bitmap to the destination bitmap, preserving exact pixel colors. This means that the color contribution of any deleted pixels when shrinking is lost.
BD_HALFTONERESIZE
Maps pixels from the source bitmap to the destination bitmap using a half-tone approximation algorithm that takes account of excluded pixels when shrinking and smooths pixel transitions when expanding.
Default: BD_HALFTONERESIZE
For more information about system constant settings, see Bitmap Settings for BitmapObject.
width
Specifies the width in pixels of the destination bitmap.
height
Specifies the height in pixels of the destination bitmap.
force
Specifies whether to reformat the bitmap if the size, type, and mode are not being changed.
xHotspot
Specifies the x-location of the hotspot on the cursor bitmap (in pixels). This applies only to cursor bitmaps.
yHotspot
Specifies the y-location of the hotspot on the cursor bitmap (in pixels). This applies only to cursor bitmaps.
The method returns the reformatted bitmap if successful, and null if not successful.
Last modified date: 12/20/2023