Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

4
Task/Bitmap/J/bitmap-1.j Normal file
View file

@ -0,0 +1,4 @@
makeRGB=: 0&$: : (($,)~ ,&3)
fillRGB=: makeRGB }:@$
setPixels=: (1&{::@[)`(<"1@(0&{::@[))`]}
getPixels=: <"1@[ { ]

16
Task/Bitmap/J/bitmap-2.j Normal file
View file

@ -0,0 +1,16 @@
myimg=: makeRGB 5 8 NB. create a bitmap with height 5 and width 8 (black)
myimg=: 255 makeRGB 5 8 NB. create a white bitmap with height 5 and width 8
myimg=: 127 makeRGB 5 8 NB. create a gray bitmap with height 5 and width 8
myimg=: 0 255 0 makeRGB 5 8 NB. create a green bitmap with height 5 and width 8
myimg=: 0 0 255 fillRGB myimg NB. fill myimg with blue
colors=: 0 255 {~ #: i.8 NB. black,blue,green,cyan,red,magenta,yellow,white
myimg=: colors fillRGB myimg NB. fill myimg with vertical stripes of colors
2 4 getPixels myimg NB. get the pixel color from point (2, 4)
255 0 0
myimg=: (2 4 ; 255 255 255) setPixels myimg NB. set pixel at point (2, 4) to white
2 4 getPixels myimg NB. get the pixel color from point (2, 4)
255 255 255
}:$ myimg NB. get height and width of the image
5 8

7
Task/Bitmap/J/bitmap-3.j Normal file
View file

@ -0,0 +1,7 @@
pixellist=: ,"0/~ i. 10 NB. row and column indices for 10 by 10 block of pixels
NB. create 10 by 10 block of magenta pixels in the middle of a 300 by 300 green image
myimg=: ((145 + pixellist) ; 255 0 255) setPixels 0 255 0 makeRGB 300 300
NB. get pixel color for 10x10 block offset from magenta block
subimg=: (140 + pixellist) getPixels myimg

4
Task/Bitmap/J/bitmap-4.j Normal file
View file

@ -0,0 +1,4 @@
require 'viewmat'
viewRGB=: [: viewrgb 256&#.
viewRGB myimg