Buchempfehlung
Windows System Programming
Windows System Programming
Das Kompendium liefert viele interessante Informationen zur Windows-Programmierung auf Englisch. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

ImageCreate vs IMG_Create (funzt)

Uploader:MitgliedEternal_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