Skip to end of metadata
Go to start of metadata

The roBitmap component contains image data and provides an interface (ifDraw2D) for drawing. Bitmaps can be used for a variety of purposes, such as for sprites, compositing, or as double buffers.

Supported Interfaces


roBitmaps store four color channels: red, green, blue, and alpha, with 32-bits per pixel. They can be any arbitrary size up to 2048x2048. However, the maximum size bitmap uses 16MB of memory, so there are practical memory limitations which would compel smaller bitmap sizes.  Coordinates (x,y) for 2D bitmaps have an origin (0,0) at the top left. roBitmap is always offscreen. The top roScreen is the only ifDraw2D surface which is displayed. roBitmap represents something that can be drawn onto, as well as something that can be drawn.

Drawing operations into a roBitmap (or other surface with ifDraw2D interface, such as an roScreen) are clipped so the only the part that is within its bounds is rendered. X,Y coordinates that specify a location in a bitmap to render to (for example, as used by DrawObject() or DrawText() ) may be positive or negative. Negative implies that the left and top of the rendered object will be clipped.The same bitmap cannot be used as a source and a destination in a single DrawObject() call.

There are limitations when using the onscreen bitmap as a source. For example, Alpha blending may not work.

An empty roBitmap object can be created with CreateObject():

  • CreateObject("roBitmap", bitmapProps As Object)

bitmapProps is an roAssociativeArray with Integers width, height, and Boolean AlphaEnable parameters. The contents of an empty RoBitmap are initialized to zero (transparent black).


CreateObject("roBitmap", {width:10, height:10, AlphaEnable:false})

An roBitmap can also load its image data from a file:

  • CreateObject("roBitmap", String filename) 

Example: double buffering with roBitmap


  • No labels