Bitmap Stores a bitmap and draws it to the screen.
Constructs the Bitmap by loading a bitmap file. The loaded bitmap may contain an alpha channel. Works like the Load-method. The only possibile flag is: MAKE_COLLISION_POLY - Creates a collision polygon
Constructs the Bitmap by loading two separate bitmap files, one bitmap for the color information and one 8-bit bitmap for the transparency information. Works like the Load-method.
Constructs the Bitmap from an Allegro BITMAP. The conversion mode should be one of these: HAS_ALPHA_CHANNEL - Tells that the BITMAP has an alpha channel CONVERT_MAGIC_PINK - Converts all magic pink pixels to transparent ones OpenLayer doesn't free the passed BITMAP even if the Bitmap is destroyed. Construct a sub-bitmap of an area of the given Bitmap.
Creates a new Bitmap and calls the 'Rgba operator()(int x, int y)' of the functor object for each pixel. If you need transparent or translucent parts in the bitmap you need to have an alpha channel for the bitmap. An alpha channel stores the opacity values for each pixel in the bitmap. The higher the alpha value, the more visible the pixel is. If the alpha value of a pixel is the highest value (1.0) the pixel will be totally solid. But if the alpha value of a pixel is zero it'll be totally transparent and the pixel won't be rendered at all. If the alpha value is between 0.0 and 1.0 the pixel will be partially visible, depending on how high the alpha value is. There's a version of every Bitmap rendering routine that also takes a RenderMode parameter which affects the way the Bitmap is rendered to the screen. Currently there are quite a few of RenderModes, like Tinted, Clipped and Flipped. The pixel data will be automatically freed from the memory when the Bitmap object is destroyed. You can also manually free the bitmap data by calling the Destroy()-method. Loading and destroying of global bitmaps and setting up the PNG image loading are automated now. If you have any dynamically allocated Bitmaps you can choose to let OpenLayer to free them when the program quits by calling the TextRenderer/UseAutoDelete.html">UseAutoDelete() -method. And a final note about the copy constructor: It won't make a copy of the image, but instead the Bitmap copy will refer to the same image in the memory. Examples // Remember that Bitmaps can't be rendered until Setup::SetupProgram and Setup::SetupScreen are called! //
// Construct a bitmap by loading a bitmap file // Bitmap myBmp( "gfx/picture.png" ); // Draws the bitmap to the screen such that the top-left // // corner of the bitmap will be positioned at x = 200, y = 100 // myBmp.Blit( 200, 100 ); // Construct a Bitmap using an Allegro BITMAP with an alpha channel // // and transparent magic pink pixels // BITMAP *allegroBmp = create_bitmap(...); Bitmap myBmp( allegroBmp, HAS_ALPHA_CHANNEL | CONVERT_MAGIC_PINK ); // Construct the Bitmap using a separate bitmap for // // the color and the transparency information // // Note that pictureOpacity.bmp must be an 8-bit bitmap! // Bitmap myBmp( "gfx/picture.bmp", "gfx/pictureOpacity.bmp" ); Member functions
Questions about Bitmap? Click here. |