fb:porticula NoPaste
Pixel aus Image auslesen
Uploader: | jakidomi |
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