Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -1,16 +1,16 @@
|
|||
class PPM{ // (0,0) is logically bottom left
|
||||
class PPM{ // (0,0) is logically bottom left
|
||||
fcn init(width,height){
|
||||
sz:=width*height*3;
|
||||
var [const]
|
||||
data=sz.pump(Data(sz),0), // initialize to Black (RGB=000)
|
||||
w=width, h=height;
|
||||
w=width, h=height;
|
||||
}
|
||||
fcn fill(rgb){
|
||||
sz:=data.len()/3;
|
||||
data.clear(); sz.pump(data,T(Void,rgb.toBigEndian(3)));
|
||||
}
|
||||
fcn __sGet(x,y) { data.toBigEndian(3*y*w + 3*x,3); } //ppm[x,y]
|
||||
fcn __sSet(rbg,x,y){ data[3*y*w + 3*x,3]=rbg.toBigEndian(3); } //ppm[x,y]=rgb
|
||||
fcn __sSet(rbg,x,y){ data[3*y*w + 3*x,3]=rbg.toBigEndian(3); } //ppm[x,y]=rgb
|
||||
fcn write(out){ // write bottom to top to move (0,0) from bottom left to bottom left
|
||||
out.write("P6\n#rosettacode PPM\n%d %d\n255\n".fmt(w,h));
|
||||
[h-1..0, -1].pump(out,'wrap(h){ data.seek(3*h*w); data.read(3*w) });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue