Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,92 @@
|
|||
INCLUDE "H6:RGBIMAGE.ACT" ;from task Bitmap
|
||||
|
||||
PROC SaveHeader(RgbImage POINTER img
|
||||
CHAR ARRAY format BYTE dev)
|
||||
|
||||
PrintDE(dev,format)
|
||||
PrintBD(dev,img.w)
|
||||
PutD(dev,32)
|
||||
PrintBDE(dev,img.h)
|
||||
PrintBDE(dev,255)
|
||||
RETURN
|
||||
|
||||
PROC SavePPM3(RgbImage POINTER img CHAR ARRAY path)
|
||||
BYTE dev=[1],x,y
|
||||
RGB c
|
||||
|
||||
Close(dev)
|
||||
Open(dev,path,8)
|
||||
SaveHeader(img,"P3",dev)
|
||||
FOR y=0 TO img.h-1
|
||||
DO
|
||||
FOR x=0 TO img.w-1
|
||||
DO
|
||||
GetRgbPixel(img,x,y,c)
|
||||
PrintBD(dev,c.r) PutD(dev,32)
|
||||
PrintBD(dev,c.g) PutD(dev,32)
|
||||
PrintBD(dev,c.b)
|
||||
IF x=img.w-1 THEN
|
||||
PutDE(dev)
|
||||
ELSE
|
||||
PutD(dev,32)
|
||||
FI
|
||||
OD
|
||||
OD
|
||||
Close(dev)
|
||||
RETURN
|
||||
|
||||
PROC SavePPM6(RgbImage POINTER img CHAR ARRAY path)
|
||||
BYTE dev=[1],x,y
|
||||
RGB c
|
||||
|
||||
Close(dev)
|
||||
Open(dev,path,8)
|
||||
SaveHeader(img,"P6",dev)
|
||||
FOR y=0 TO img.h-1
|
||||
DO
|
||||
FOR x=0 TO img.w-1
|
||||
DO
|
||||
GetRgbPixel(img,x,y,c)
|
||||
PutD(dev,c.r)
|
||||
PutD(dev,c.g)
|
||||
PutD(dev,c.b)
|
||||
OD
|
||||
OD
|
||||
Close(dev)
|
||||
RETURN
|
||||
|
||||
PROC Load(CHAR ARRAY path)
|
||||
CHAR ARRAY line(255)
|
||||
BYTE dev=[1]
|
||||
|
||||
Close(dev)
|
||||
Open(dev,path,4)
|
||||
WHILE Eof(dev)=0
|
||||
DO
|
||||
InputSD(dev,line)
|
||||
PrintE(line)
|
||||
OD
|
||||
Close(dev)
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
BYTE ARRAY rgbdata=[
|
||||
0 0 0 0 0 255 0 255 0
|
||||
255 0 0 0 255 255 255 0 255
|
||||
255 255 0 255 255 255 31 63 127
|
||||
63 31 127 127 31 63 127 63 31]
|
||||
BYTE width=[3],height=[4]
|
||||
RgbImage img
|
||||
CHAR ARRAY path3="D:PPM3.PPM"
|
||||
CHAR ARRAY path6="D:PPM6.PPM"
|
||||
|
||||
Put(125) PutE() ;clear the screen
|
||||
InitRgbImage(img,width,height,rgbdata)
|
||||
|
||||
PrintF("Saving %S...%E%E",path3)
|
||||
SavePPM3(img,path3)
|
||||
PrintF("Saving %S...%E%E",path6)
|
||||
SavePPM6(img,path6)
|
||||
PrintF("Loading %S...%E%E",path3)
|
||||
Load(path3)
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue