03-12-2005, 09:07 PM
Hi,
I've got a Picture, saved in a String, just as a 8-Bit-Bitmap without the header. So 1 Byte stands for one colour.
In QuickBASIC I've used ASM instead, but how can I make this routine faster in FreeBASIC?
As I'm using POKE, I have to control on my own if the pixel is outside of the Screen or of the current VIEW-area.
I'm using the GFX-lib and I'd be very happy if anyone could help me.
Mecki
I've got a Picture, saved in a String, just as a 8-Bit-Bitmap without the header. So 1 Byte stands for one colour.
In QuickBASIC I've used ASM instead, but how can I make this routine faster in FreeBASIC?
Code:
'Putdat$ = The Picture
'px, py = Picture-Position
'endX, endY = Picture-Sizes
dIM framebuffer AS BYTE PTR
framebuffer = SCREENPTR
SCREENLOCK
for y=0 to endY-1
for x=0 to endX-1
c=c+1
f=asc(mid$(putdat$, c, 1))
if f<>CurrentFilterColor and y+py>CurrentScreenY1-1 and x+px>CurrentScreenX1-1 and y+py<CurrentScreenY2+1 and x+px<CurrentScreenX2+1 then POKE framebuffer + ((py+y) * CurrentScreenWidth) + x+px, f
next x
next y
SCREENUNLOCK
As I'm using POKE, I have to control on my own if the pixel is outside of the Screen or of the current VIEW-area.
I'm using the GFX-lib and I'd be very happy if anyone could help me.
Mecki
he dogs bark, but the caravan keeps moving.