fb:porticula NoPaste
ImageCreate vs CreateImage
Uploader: | Eternal_Pain |
Datum/Zeit: | 18.06.2007 21:08:10 |
Const IMG_Header = &h00000007 '
Const IMG_bytepp = &h00000004 '4 byte for 24/32bpp
Type IMG_Buffer as ubyte ptr
'*********************************************************************************************************
Function Create_Buffer (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_col_SS as string
Dim IMG_col_S as string
Dim as ubyte colA, colR, colG, colB
colA = (IMG_col and &hff000000) shr 24
colR = (IMG_col and &h00ff0000) shr 16
colG = (IMG_col and &h0000ff00) shr 8
colB = (IMG_col and &h000000ff)
IMG_col_S=Chr(colA,colR,colG,colB)
For l as integer=1 to IMG_width
IMG_Col_SS+=IMG_Col_S
Next l
'***************************************
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-(IMG_width mod 4)+4) *4
Buffer=Allocate (32+(IMG_width*IMG_heigth))
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
For l as integer=0 to IMG_heigth-1
Poke string,Buffer+32+(l*(IMG_pitch)),IMG_Col_SS
Next l
return 0
'------------
End Function
'------------
'====================================='
screen 19,32
Dim test1 as IMG_Buffer
Create_Buffer (test1,10,10)
Dim test2 as ubyte ptr
test2=ImageCreate(10,10)
put (0,300),test1,pset
put (100,300),test2,pset
DEALLOCATE (test1)
ImageDestroy (test2)
sleep