fb:porticula NoPaste
ImageCreate vs IMG_Create (funzt)
Uploader: | Eternal_Pain |
Datum/Zeit: | 18.06.2007 22:22:41 |
Const IMG_Header = &h00000007 '
Const IMG_bytepp = &h00000004 '4 byte for 24/32bpp
Type IMG_Buffer as ubyte ptr
'*********************************************************************************************************
Function IMG_Create (byref Buffer as IMG_Buffer, byval IMG_width as uinteger, _
byval IMG_heigth as uinteger, byval IMG_col as Uinteger=&hFFFF00FF) as UInteger
'*********************************************************************************************************
Dim IMG_Header_S as String
IMG_Header_S=chr(0,0,0,IMG_Header)+chr(0,0,0,IMG_bytepp)
Dim IMG_pitch as UInteger
IMG_pitch=((IMG_width)+IIF ((IMG_width) mod 4,4-((IMG_width) mod 4),0)) *4
Buffer=Allocate (32+(IMG_pitch*IMG_heigth)+(IMG_width*IMG_bytepp))
Poke UInteger,Buffer ,IMG_Header
Poke UInteger,Buffer+ 4,IMG_bytepp
Poke UInteger,Buffer+ 8,IMG_width
Poke UInteger,Buffer+12,IMG_heigth
Poke UInteger,Buffer+16,IMG_pitch
Dim adr as any ptr
for y as integer=0 to IMG_heigth-1
for x as integer=0 to IMG_width-1
adr=Buffer+(32)+(x*IMG_bytepp)+(y*IMG_pitch)
poke UInteger,adr,IMG_col
next x
next y
return 0
'------------
End Function
'------------
'====================================='
screen 19,32
Dim TimeX as double
sleep 10,1
TimeX=Timer
Dim test1 as IMG_Buffer
IMG_Create (test1,100,100)
put (10,300),test1,pset
?Timer-TimeX
TimeX=Timer
Dim test2 as ubyte ptr
test2=ImageCreate(100,100)
put (200,300),test2,pset
?Timer-TimeX
DEALLOCATE (test1)
ImageDestroy (test2)
sleep