DQBcreateBMap
FUNCTION

Prototype

DECLARE FUNCTION DQBcreateBMap (BYVAL BMap, BYVAL FirstCol, BYVAL LastCol)

Parameters

BMap - Code number of the blender map to create

FirstCol - First foreground color to map

LastCol - Last foreground color to map

Returns

An INTEGER value holding the operation result: > 0 Blender map successfully created and initialized > 1 Not enough free conventional memory > 2 Blender map already created

Description

This function attempts to create a blender map in *conventional* memory; this requires as much memory as much foreground colors you map. A blender map is a table with all the possible color combinations between the specified foreground colors and the 256 background colors; so this is the formula to obtain the amount of memory needed to create a bmap:

(LastCol - FirstCol + 1) * 256

The fore color is the color of each pixel of your sprite, and the back color is the one of each pixel of the background layer where you're drawing. Suppose you have a palette with color 1 as bright red, color 2 as bright green, and color 3 as bright purple. Well, you could call DQBsetBMap 7,1,2,3: this way every time you use DQBbPut referring to bmap number 7 to draw a sprite with some pixels of color 1, and the background is filled with color 2, you'll see a cyan sprite (i.e. drawn with color 3)... It's a hard thing to explain, but once you've understood it, you'll also understand the system offers virtually any special effect, depending on your palette and, of course, on the blender map you set.

Notes:

So you have to set your blender map on your needs: as it's often a slow process, there're the DQBsaveBMap and DQBloadBMap functions that help you. It is also suggested that you use DQBfindCol to create your blender map independently from the current palette. Keep also in mind that any blending function will not work unless the blender map has not been created by calling DQBcreateBMap, and remember that to gain more free base memory you should always call the QB function SETMEM before calling it; another important thing to remember is that a bmap can have up to 255 foreground colors mapped: do not try to create a bmap of 256 elements, as you may end up with unpredictable results. Here I suggest you to leave color 0 unmapped, as it should always be used for transparencies only. See also DQBsetBMap, DQBgetBMap, DQBloadBMap, DQBsaveBMap, DQBbPut, DQBfilterBox.

Example

See DQBbPut example