DQBbPut
SUB

Prototype

DECLARE SUB DQBbPut (BYVAL Layer, BYVAL x, BYVAL y, BYVAL SpriteSeg,
                     BYVAL SpriteOff, BYVAL BMap)

Parameters

Layer - Layer where to draw the sprite

x - X position of upper left corner of the sprite

y - Y position of upper left corner of the sprite

SpriteSeg - Segment of the array holding the sprite data; use VARSEG

SpriteOff - Offset of the array holding the sprite data; use VARPTR

BMap - Blender map to be used

Returns

none

Description

DQBbPut draws a sprite blending its colors with the background; the way the colors are blended depends on the specified blender map. If the bmap has not been created by calling DQBcreateBMap, this function does nothing. There are virtually unlimited special color effects allowed by using the blender map system: by setting up an appropriate bmap for your palette, you can obtain a translucency effect for example.

Notes:

DQBbPut is affected by the clipping box, so pixels outside this box will not be drawn; transparency is also supported. See also DQBcreateBMap, DQBsetBMap, DQBgetBMap, DQBloadBMap, DQBsaveBMap, DQBput, DQBfPut, DQBsPut and DQBrPut.

Example

*****************************************************************************

' Use integers for speed
DEFINT A-Z

'$INCLUDE: 'DIRECTQB.BI'

' Let's initialize the library
IF DQBinit(1, 0, 0) THEN DQBclose: PRINT DQBerror$: END

' Releases 256 bytes from the far heap to allow DQBcreateBMap to allocate
' conventional memory for the blender map; we're going to map one color only,
' so we need 1*256=256 bytes to create the blender map
dummy& = SETMEM(-256)

' Let's build blender map 1, mapping color 40 only
IF DQBcreateBMap(1, 40, 40) THEN DQBclose: PRINT DQBerror$: END

' Here we set our only color combination on bmap number 1: if a pixel of
' color 40 (bright red) is drawn over another of color 32 (bright blue), the
' pixel is drawn with color 13 (bright purple)
DQBsetBMap 1, 40, 32, 13

' Let's dimension our two sprites using DQBsize
size = DQBsize(0, 0, 63, 7)
DIM Sprite(size)

DQBclearLayer 1
DQBprint 1, "DirectQB", 0, 0, 32
DQBprint 1, "Power!", 0, 8, 40

' Get our sprites
DQBget 1, 0, 0, 63, 7, VARSEG(Sprite(0)), VARPTR(Sprite(0))
DQBget 1, 0, 8, 63, 15, VARSEG(Sprite(0)), (VARPTR(Sprite(0)) + size)

DQBinitVGA

' Let's begin the demo
FOR x = -64 TO 320
  ' Clean our hidden layer
  DQBclearLayer 1

  ' Draws our sprites on layer 1
  DQBput 1, x, 96, VARSEG(Sprite(0)), VARPTR(Sprite(0))
  DQBbPut 1, (256 - x), 96, VARSEG(Sprite(0)), (VARPTR(Sprite(0)) + size), 1

  ' Copies layer 1 on the screen
  DQBwait 3
  DQBcopyLayer 1, VIDEO
NEXT x

' Ends program
DQBclose
dummy& = SETMEM(256)

*****************************************************************************