Data Update
This commit is contained in:
parent
015c2add84
commit
e50b5c3114
206 changed files with 6337 additions and 523 deletions
|
|
@ -1,38 +1,44 @@
|
|||
/*REXX program demonstrates how to process/display a simple RGB raster graphics image.*/
|
||||
red = 'ff 00 00'x /*a method to define a red value. */
|
||||
blue = '00 00 ff'x /*" " " " " blue " */
|
||||
@. = /*define entire @. array to nulls. */
|
||||
outFN = 'image' /*the filename of the output image PPM */
|
||||
sWidth = 500; sHeight= 500 /*the screen width and height in pixels*/
|
||||
call RGBfill red /*set the entire image to red. */
|
||||
x= 10; y= 40 /*set pixel's coördinates. */
|
||||
call RGBset x, y, blue /*set a pixel (at 10,40) to blue. */
|
||||
color = RGBget(x, y) /*get the color of a pixel. */
|
||||
hexV = c2x(color) /*get hex value of pixel's color. */
|
||||
binV = x2b(hexV) /* " binary " " " " */
|
||||
bin3V = left(binV, 8) substr(binV, 9, 8) right(binV, 8)
|
||||
hex3V = left(hexV, 2) substr(hexV, 3, 2) right(hexV, 2)
|
||||
xy= '(' || x","y')' /*create a handy─dandy literal for SAY.*/
|
||||
say xy ' pixel in binary: ' binV /*show the binary value of 20,50 */
|
||||
say xy ' pixel in binary: ' bin3V /*show again, but with spaces. */
|
||||
say /*show a blank between binary and hex. */
|
||||
say xy ' pixel in hex: ' hexV /*show again, but in hexadecimal. */
|
||||
say xy ' pixel in hex: ' hex3V /*show again, but with spaces. */
|
||||
call PPMwrite outFN, sWidth, sHeight /*create a PPM (output) file of image. */ /* ◄■■■■■■■■ not part of this task.*/
|
||||
say /*show a blank. */
|
||||
say 'The file ' outFN".PPM was created." /*inform user that a file was created. */
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
RGBfill: @.=arg(1); return /*fill image with a color.*/
|
||||
RGBget: parse arg px,py; return @.px.py /*get a pixel's color. */
|
||||
RGBset: parse arg px,py,p$; @.px.py=p$; return /*set " " " */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
PPMwrite: parse arg oFN, width, height /*obtain output filename, width, height*/
|
||||
oFID= oFN'.PPM'; $='9'x; #=255 /*fileID; separator; max color value.*/
|
||||
call charout oFID, , 1 /*set the position of the file's output*/
|
||||
call charout oFID,'P6'width || $ || height || $ || # || $ /*write hdr info.*/
|
||||
do j=1 for width
|
||||
do k=1 for height; call charout oFID, @.j.k
|
||||
end /*k*/ /* ↑ write the PPM file, ··· */
|
||||
end /*j*/ /* └───────── ··· one pixel at a time.*/
|
||||
call charout oFID; return /*close the output file just to be safe*/
|
||||
/*REXX program demonstrates how to process/display */
|
||||
/* a simple RGB raster graphics image.*/
|
||||
red = 'ff 00 00'x /*a method to define a red value. */
|
||||
blue = '00 00 ff'x /*' ' ' ' ' blue ' */
|
||||
pixel='' /*define entire pixel. array to nulls.*/
|
||||
outFN = 'image' /*the filename of the output image PPM */
|
||||
sWidth = 500; sHeight= 500 /*the screen width and height in pixels*/
|
||||
Call RGBfill red /*set the entire image to red. */
|
||||
x=10; y=40 /*set pixel's coördinates. */
|
||||
Call RGBset x,y,blue /*set a pixel (at 10,40) to blue. */
|
||||
color = RGBget(x,y) /*get the color of a pixel. */
|
||||
hexV = c2x(color) /*get hex value of pixel's color. */
|
||||
binV = x2b(hexV) /* " binary " " " " */
|
||||
bin3V = left(binV,8) substr(binV,9,8) right(binV,8)
|
||||
hex3V = left(hexV,2) substr(hexV,3,2) right(hexV,2)
|
||||
xy= '('||x','y')' /*create a handy-dandy literal for SAY.*/
|
||||
Say xy ' pixel in binary: ' binV /*show the binary value of 20,50 */
|
||||
Say xy ' pixel in binary: ' bin3V /*show again,but with spaces. */
|
||||
Say /*show a blank between bin & hex. */
|
||||
Say xy ' pixel in hex: ' hexV /*show again,but in hexadecimal. */
|
||||
Say xy ' pixel in hex: ' hex3V /*show again,but with spaces. */
|
||||
Call PPMwrite outFN,sWidth,sHeight /*create a PPM (output) file */
|
||||
/* ?¦¦¦¦¦¦¦¦ not part of this task.*/
|
||||
Say /*show a blank. */
|
||||
Say 'The file ' outFN'.PPM was created.' /*inform user */
|
||||
Exit /*stick a fork in it, we're all done. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
RGBfill: pixel.=arg(1); Return /*fill image with a color.*/
|
||||
RGBget: Parse arg px,py; Return pixel.px.py /*get a pixel's color. */
|
||||
RGBset: Parse arg px,py,psep; pixel.px.py=psep; Return /*set a pixel */
|
||||
/*---------------------------------------------------------------------*/
|
||||
PPMwrite: Parse arg oFN,width,height
|
||||
oFID= oFN'.PPM' /* fileID */
|
||||
sep='9'x; /* separator */
|
||||
maxcol=255 /* max color value. */
|
||||
Call charout oFID,,1 /*set the position of the file's output*/
|
||||
Call charout oFID,'P6'width||sep||height||sep||maxcol||sep /* header */
|
||||
Do i=1 To width
|
||||
Do j=1 To height;
|
||||
Call charout oFID,pixel.i.j
|
||||
End
|
||||
End
|
||||
Call charout oFID /* close the output file just to be safe */
|
||||
Return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue