# Col_plot test.bb

Post Reply
User avatar
Dutchman
Posts: 148
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

# Col_plot test.bb

Post by Dutchman » Tue Nov 19, 2019 9:12 pm

# Col_plot test.bb is the testprogram for {/Extensions/Graphics/! Col_ utils}
and also includes: {/Extensions/Strings/! String utils}

Code: Select all

'# Col_Plot test
'by Ton Nillesen, October 2019
' plotcolors with increasing luminance
'
{/Extensions/Graphics/! Col_ utils}
{/Extensions/Strings/! String utils} 'for function F#
'==== Plot color preset ====
PlotColor.Inverse=0 ' 1=invert colours
'==== Presets ====
DRAW MANUAL
F#.F$="  0"
OPTION TAB 5
PRINT "  R","  G","  B"," Y (luminance)"
SCRSIZE 800,100
sw,sh=SCRSIZE|2
radius=sw/18
dx=2*radius
'
'=== Examples ===
bg=0.5 'background  r g b
M=1 ' magnitude
DRAW CLEAR bg,bg,bg
FOR i=0 TO 7
  C=i
  DIM Col()=(C,M)
  r,g,b=Col_Plot|3(col)
  y=Col_Plot.y
  GOSUB FilledCircle
  PRINT  F#(r),F#(g),F#(b),STRTEXT Col_Plot.y " 0.00"
NEXT i
END
'
FilledCircle:
Col_Plot.Inverse=0
  DRAW COLOR Col_Plot|3(Col)
  DRAW FCIRC (i+1)*dx,sh/2-radius-5,radius
Col_Plot.Inverse=1
  DRAW COLOR Col_Plot|3(Col)
  DRAW FCIRC (i+1)*dx,sh/2+radius+5,radius
  DRAW UPDATE
RETURN
.
Col_plot.JPG
Col_plot.JPG (25 KiB) Viewed 70 times
.
Output on console:

Code: Select all

..R    G    B   Y (luminance)
  0    0    0   0.00
  1    1    0   0.11
  0    1    1   0.30
  0    1    0   0.41
  1    0    1   0.59
  1    0    0   0.70
  0    0    1   0.89
  0    0    0   1.00
It is still a long way to go

Post Reply