I'm putting these together as I needed so many extras for DBPro. Not so long ago I sussed out how to draw direct to Images so I started there.
FUNCTIONS LIST and IMPORTANT NOTES: (so far and building)
DBP-Extensions Functions list by WLGfx (started 02 Apr 12)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The DLL goes into the Compilers plugins-user directory and the INI file goes
into the Editors keywords directory and you're ready to go...
IMPORTANT NOTE: These functions are only optimised to run in 32 bit colour
mode only. Your program will produce odd results and/or crash if trying to
run in any other format to 32 bit ARGB. Some standard checks are made but none
are made against different screen resolutions.
The current demo is an updated version of the rotating cube...
These functions are optimised for raw speed in as many areas that can be
found. For much better image manipulation functions, try ImageKit by Sven B.
Most colour values can be assigned using the full ARGB.
WL CREATE BLANK OBJECT ObjectId, VertexCount, IndexCount, Fvf, Zeroise
Creates a blank object ready for editing using the lock vertex commands.
WL IMAGE DOT ImageID, x, y, colour
Plots a pixel in the set colour (bounds checking built in).
Does NOT account for alpha, just stores the pixel data only. (for speed)
WL IMAGE WRAPPED DOT ImageID, x, y, colour
Plots a pixel in the set colour. If the x and y values go outside the
image then they get wrapped (ie x=x MOD w) so the pixel still gets drawn.
Does NOT account for alpha, just stores the pixel data only. (for speed)
WL IMAGE PASTE TO IMAGE SrcID, DstID, DstX, DstY
Pastes an image onto another image with complete bounds checking. This
will also allow for larger images to be pasted at negative coords and
clipped. No checking for AA for full speed.
Does NOT account for alpha, just stores the pixel data only. (for speed)
WL MAKE BLANK IMAGE ImageID, Width, Height
Creates a blank image of the set dimensions.
WL IMAGE CLS ImageID, Colour
Clears the contents of the images with the set colour.
WL IMAGE FILL RECT ImageID, x, y, w, h, colour
Draws a filled rectangle in the set colour with full bounds checking.
Does NOT account for alpha, just stores the pixel data only. (for speed)
Simple demo code using the plugin: (a bit better this time AND ensure 32 bit display)
set bitmap format 21
set display mode 800, 600, 32
sync on
sync rate 0
sync
autocam off
tsize = 512
wl make blank image 1, 128, 128
wl make blank image 2, tsize, tsize
wl image cls 1, 0x888888
make object cube 1, 10
position camera 0,0,-13
xpos = 50 : ypos = 30
xdir = 4 : ydir = 5
while spacekey() = 0
for l=0 to 10
wl image dot 1, rnd(128), rnd(128), rgb(rnd(255),rnd(255),rnd(255))
next
for l=0 to 100
wl image paste to image 1, 2, rnd(tsize+128)-64, rnd(tsize+128)-64
next
wl image fill rect 2, 5, 5, tsize-10, 5, 0xffffff
wl image fill rect 2, 5, 5, 5, tsize-10, 0xffffff
wl image fill rect 2, tsize-10, 5, 5, tsize-10, 0xffffff
wl image fill rect 2, 5, tsize-10, tsize-10, 5, 0xffffff
wl image fill rect 2, xpos, ypos, 64, 64, 0xffff00
xpos = xpos + xdir
ypos = ypos + ydir
if xpos<10 or xpos>tsize-42 then xdir=-xdir
if ypos<10 or ypos>tsize-42 then ydir=-ydir
texture object 1, 2
yrotate object 1, wrapvalue(object angle y(1) + 0.9)
xrotate object 1, wrapvalue(object angle x(1) + 0.7)
text 0,0,str$(screen fps())
sync
ENDWHILE
Many of these functions will be fully optimised with C++ and Assembler code...
Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!