Buchempfehlung
Visual Basic 6 Kochbuch
Visual Basic 6 Kochbuch
Viele praktische Tipps zum Programmieren mit Visual Basic 6, die sich oft auch auf FB übertragen lassen. [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

Pixel aus Image auslesen

Uploader:Mitgliedjakidomi
Datum/Zeit:06.12.2009 22:31:33

#Include once "fbgfx.bi"
#include once "fonts.bi"
Using FB
type pixel
    r as ubyte
    g as ubyte
    b as ubyte
    a as ubyte
    f as uinteger
    declare sub i()
    declare constructor ()
end type
constructor pixel()
    this.f=rgba(this.r,this.g,this.b,this.a)
end constructor
sub pixel.i()
    this.f=rgba(this.r,this.g,this.b,this.a)
end sub
sub getAllPixel(pix() as pixel,img as any ptr)
    dim as uinteger u,t,w,h
    imageinfo(img,w,h)
    for y as integer=0 to h
        for x as integer=0 to w
            t=point(x,y,img)
            u+=1
            redim preserve pix(u)
            pix(u).r=getrot(t)' hole rot wert aus farbcode t
            pix(u).g=getgruen(t)' hole grün wert aus farbcode t
            pix(u).b=getblau(t)' hole blau wert aus farbcode t
            pix(u).a=getalpha(t)' hole alpha wert aus farbcode t
            pix(u).i
        next
    next
end sub
sub setAllPixel(pix() as pixel,img as any ptr)
    dim as uinteger u,t,w,h
    imageinfo(img,w,h)
    for y as integer=0 to h
        for x as integer=0 to w
            if u>ubound(pix) then exit for
            pset img,(x,y),pix(u).f
        next
    next
end sub
sub PutAllPixel(x as integer,y as integer,w as uinteger,h as uinteger,pix() as pixel)
    dim as uinteger u
    for yy as integer=0 to h
        if yy+y>scy then exit for
        for xx as integer=0 to w
            u+=1
            if u>ubound(pix) then exit for
            if xx+x>scx then u+=w-xx:exit for' consprint str(xx+x)+" - "+str(scx)+" - "+str(u)'exit for
            pset (x+xx,y+yy),pix(u).f
        next
    next
end sub