Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
75
Task/Grayscale-image/Action-/grayscale-image.action
Normal file
75
Task/Grayscale-image/Action-/grayscale-image.action
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
INCLUDE "H6:RGB2GRAY.ACT" ;from task Grayscale image
|
||||
|
||||
PROC PrintB3(BYTE x)
|
||||
IF x<10 THEN
|
||||
Print(" ")
|
||||
ELSEIF x<100 THEN
|
||||
Print(" ")
|
||||
FI
|
||||
PrintB(x)
|
||||
RETURN
|
||||
|
||||
PROC PrintRgbImage(RgbImage POINTER img)
|
||||
BYTE x,y
|
||||
RGB c
|
||||
|
||||
FOR y=0 TO img.h-1
|
||||
DO
|
||||
FOR x=0 TO img.w-1
|
||||
DO
|
||||
GetRgbPixel(img,x,y,c)
|
||||
Put(32)
|
||||
PrintB3(c.r) Put(32)
|
||||
PrintB3(c.g) Put(32)
|
||||
PrintB3(c.b) Put(32)
|
||||
OD
|
||||
PutE()
|
||||
OD
|
||||
RETURN
|
||||
|
||||
PROC PrintGrayImage(GrayImage POINTER img)
|
||||
BYTE x,y,c
|
||||
|
||||
FOR y=0 TO img.h-1
|
||||
DO
|
||||
FOR x=0 TO img.w-1
|
||||
DO
|
||||
c=GetGrayPixel(img,x,y)
|
||||
Put(32)
|
||||
PrintB3(c)
|
||||
OD
|
||||
PutE()
|
||||
OD
|
||||
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 ARRAY graydata(12)
|
||||
BYTE width=[3],height=[4],LMARGIN=$52,oldLMARGIN
|
||||
RgbImage rgbimg
|
||||
GrayImage grayimg
|
||||
|
||||
oldLMARGIN=LMARGIN
|
||||
LMARGIN=0 ;remove left margin on the screen
|
||||
Put(125) PutE() ;clear the screen
|
||||
InitRgbToGray()
|
||||
InitRgbImage(rgbimg,width,height,rgbdata)
|
||||
InitGrayImage(grayimg,width,height,graydata)
|
||||
|
||||
PrintE("Original RGB image:")
|
||||
PrintRgbImage(rgbimg) PutE()
|
||||
|
||||
RgbToGray(rgbimg,grayimg)
|
||||
PrintE("RGB to grayscale image:")
|
||||
PrintGrayImage(grayimg) PutE()
|
||||
|
||||
GrayToRgb(grayimg,rgbimg)
|
||||
PrintE("Grayscale to RGB image:")
|
||||
PrintRgbImage(rgbimg)
|
||||
|
||||
LMARGIN=oldLMARGIN ;restore left margin on the screen
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue