September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -25,9 +25,9 @@ const func PRIMITIVE_WINDOW: getPPM (in string: fileName) is func
|
|||
aWindow := newPixmap(width, height);
|
||||
for y range 0 to pred(height) do
|
||||
for x range 0 to pred(width) do
|
||||
pixColor.red_part := ord(getc(ppmFile));
|
||||
pixColor.green_part := ord(getc(ppmFile));
|
||||
pixColor.blue_part := ord(getc(ppmFile));
|
||||
pixColor.redLight := ord(getc(ppmFile));
|
||||
pixColor.greenLight := ord(getc(ppmFile));
|
||||
pixColor.blueLight := ord(getc(ppmFile));
|
||||
end for;
|
||||
end for;
|
||||
end if;
|
||||
|
|
|
|||
11
Task/Bitmap-Read-a-PPM-file/Zkl/bitmap-read-a-ppm-file.zkl
Normal file
11
Task/Bitmap-Read-a-PPM-file/Zkl/bitmap-read-a-ppm-file.zkl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//24-bpp P6 PPM solution:
|
||||
image:=File("lena.ppm","rb").read();
|
||||
start:=image.find("\n255\n")+5; // Get sizeof PPM header
|
||||
|
||||
foreach n in ([start..image.len()-1,3]){ // Transform color triplets
|
||||
r,g,b:=image[n,3]; // Read colors stored in RGB order
|
||||
l:=(0.2126*r + 0.7152*g + 0.0722*b).toInt(); // Derive luminance
|
||||
image[n,3]=T(l,l,l);
|
||||
}
|
||||
|
||||
File("lenaGrey.ppm","wb").write(image);
|
||||
Loading…
Add table
Add a link
Reference in a new issue