Initial commit
This commit is contained in:
commit
4173ad64a1
4 changed files with 1095 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*\~
|
1061
colormaps.bqn
Normal file
1061
colormaps.bqn
Normal file
File diff suppressed because it is too large
Load diff
12
colors.bqn
Normal file
12
colors.bqn
Normal file
|
@ -0,0 +1,12 @@
|
|||
⟨HSVtoRGB⟩⇐
|
||||
|
||||
# Convert colors from HSV to RGB.
|
||||
# 𝕩 is a triple 0 ≤ h‿s‿v ≤ 360‿1‿1
|
||||
# Output is a triple 0 ≤ r‿g‿b ≤ 1
|
||||
HSVtoRGB←{𝕊⟨h,s,v⟩:
|
||||
c←v×s
|
||||
x←c×1-|1-2|h÷60
|
||||
m←v-c
|
||||
r‿g‿b←(⌊h÷60)⊑⟨c‿x‿0,x‿c‿0,0‿c‿x,0‿x‿c,x‿0‿c,c‿0‿x⟩
|
||||
m+r‿g‿b
|
||||
}
|
21
pnm.bqn
Normal file
21
pnm.bqn
Normal file
|
@ -0,0 +1,21 @@
|
|||
⟨PBM, PGM, PPM⟩⇐
|
||||
|
||||
Dims←{∾⥊' '∾˘•Fmt¨⌽2↑≢𝕩}
|
||||
|
||||
# Plain Portable Bit Map (PBM) format (black and white).
|
||||
# 𝕩 is a 2D boolean matrix: 1 is black, 0 is white.
|
||||
# https://netpbm.sourceforge.net/doc/pbm.html
|
||||
PBM←{"P1"∾(Dims𝕩)∾∾⥊((@+10)∾˘•Fmt¨𝕩)}
|
||||
|
||||
# Plain Portable Gray Map (PGM) format (grayscale).
|
||||
# 𝕩 is a 2D matrix, with an arbitrary maximum value.
|
||||
# The maximum value is white, 0 is black, and gray in between.
|
||||
# https://netpbm.sourceforge.net/doc/pgm.html
|
||||
PGM←{"P2"∾(Dims𝕩)∾" "∾(•Fmt⌈´⥊𝕩)∾∾⥊' '∾˘⥊(@+10)∾˘•Fmt¨𝕩}
|
||||
|
||||
# Plain Portable Pixel Map (PPM) format (color).
|
||||
# 𝕩 is an array of shape m‿n‿3, where each triplet is an RGB color.
|
||||
# Maximum value can be arbitrary.
|
||||
# https://netpbm.sourceforge.net/doc/ppm.html
|
||||
PPM←{"P3"∾(Dims𝕩)∾" "∾(•Fmt⌈´⥊𝕩)∾(@+10)∾∾(∾' '⊸∾¨)¨•Fmt¨¨⥊𝕩}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue