Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
41
Task/Bitmap/OxygenBasic/bitmap.basic
Normal file
41
Task/Bitmap/OxygenBasic/bitmap.basic
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
'GENERIC BITMAP
|
||||
|
||||
type pixel byte r,g,b
|
||||
|
||||
'===========
|
||||
class BitMap
|
||||
'===========
|
||||
|
||||
% sp sizeof(pixel)
|
||||
sys wx,wy,px,py
|
||||
string buf
|
||||
sys pb
|
||||
method Constructor(sys x=640,y=480) { wx=x : wy=y : buf=nuls x*y*sp : pb=strptr buf}
|
||||
method Destructor() {buf="" : wx=0 : wy=0 : pb=0}
|
||||
method GetPixel(sys x,y,pixel*p) {copy @p,pb+(y*wx+x)*sp,sp}
|
||||
method SetPixel(sys x,y,pixel*p) {copy pb+(y*wx+x)*sp,@p,sp}
|
||||
'
|
||||
method Fill(pixel*p)
|
||||
sys i, e=wx*wy*sp+pb-1
|
||||
for i=pb to e step sp {copy i,@p,sp}
|
||||
end method
|
||||
|
||||
end class
|
||||
|
||||
pixel p,q
|
||||
|
||||
new BitMap m(400,400) 'width, height in pixels
|
||||
|
||||
p<=100,120,140 'red,green,blue
|
||||
|
||||
m.fill p
|
||||
|
||||
m.getPixel 200,100,q
|
||||
print "" q.r "," q.g "," q.b 'result 100,120,140
|
||||
q<=10,20,40
|
||||
m.setPixel 200,100,q
|
||||
m.getPixel 200,100,p
|
||||
print "" p.r "," p.g "," p.b 'result 10,20,40
|
||||
|
||||
|
||||
del m
|
||||
Loading…
Add table
Add a link
Reference in a new issue