Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,8 @@
|
|||
10 PRINT CHR$(11)
|
||||
20 CS=12328+1024
|
||||
30 FOR Y=0 TO 23
|
||||
40 FOR X=0 TO 15
|
||||
50 POKE CS+40*Y+X+16,X
|
||||
60 NEXT
|
||||
70 NEXT
|
||||
80 GOTO 80
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
10 GRAPHICS 11:X=0
|
||||
20 FOR C=0 TO 15:COLOR C
|
||||
30 FOR DX=0 TO 4
|
||||
40 PLOT X+DX,0
|
||||
50 DRAWTO X+DX,191
|
||||
60 NEXT DX
|
||||
70 X=X+5
|
||||
80 NEXT C
|
||||
90 REM WAIT FOR JOYSTICK FIRE BUTTON PRESS
|
||||
100 IF STRIG(0)=1 THEN 100
|
||||
9
Task/Colour-bars-Display/Crystal/colour-bars-display.cr
Normal file
9
Task/Colour-bars-Display/Crystal/colour-bars-display.cr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
require "colorize"
|
||||
|
||||
10.times do
|
||||
[:black, :red, :green, :blue, :magenta, :cyan, :yellow, :white].each do |colour|
|
||||
print ("█" * 8).colorize colour
|
||||
end
|
||||
Colorize.reset
|
||||
puts
|
||||
end
|
||||
|
|
@ -1,58 +1,41 @@
|
|||
import gintro/[glib, gobject, gtk, gio, cairo]
|
||||
import cairo
|
||||
|
||||
const
|
||||
Width = 400
|
||||
Height = 300
|
||||
Width = 600
|
||||
Height = 400
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
|
||||
proc draw(area: DrawingArea; context: Context) =
|
||||
proc drawBars(surface: ptr Surface) =
|
||||
## Draw the color bars.
|
||||
|
||||
const Colors = [[0.0, 0.0, 0.0], [255.0, 0.0, 0.0],
|
||||
[0.0, 255.0, 0.0], [0.0, 0.0, 255.0],
|
||||
[255.0, 0.0, 255.0], [0.0, 255.0, 255.0],
|
||||
[255.0, 255.0, 0.0], [255.0, 255.0, 255.0]]
|
||||
const Colors = [(0.0, 0.0, 0.0), # Black.
|
||||
(1.0, 0.0, 0.0), # Red.
|
||||
(0.0, 1.0, 0.0), # Green.
|
||||
(0.0, 0.0, 1.0), # Blue.
|
||||
(1.0, 0.0, 1.0), # Magenta.
|
||||
(0.0, 1.0, 1.0), # Cyan.
|
||||
(1.0, 1.0, 0.0), # Yellow.
|
||||
(1.0, 1.0, 1.0) # White.
|
||||
]
|
||||
|
||||
const
|
||||
RectWidth = float(Width div Colors.len)
|
||||
RectHeight = float(Height)
|
||||
|
||||
let context = create(surface)
|
||||
|
||||
var x = 0.0
|
||||
for color in Colors:
|
||||
for (r, g, b) in Colors:
|
||||
context.rectangle(x, 0, RectWidth, RectHeight)
|
||||
context.setSource(color)
|
||||
context.setSourceRgb(r, g, b)
|
||||
context.fill()
|
||||
x += RectWidth
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
context.destroy()
|
||||
|
||||
proc onDraw(area: DrawingArea; context: Context; data: pointer): bool =
|
||||
## Callback to draw/redraw the drawing area contents.
|
||||
|
||||
area.draw(context)
|
||||
result = true
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
|
||||
proc activate(app: Application) =
|
||||
## Activate the application.
|
||||
|
||||
let window = app.newApplicationWindow()
|
||||
window.setSizeRequest(Width, Height)
|
||||
window.setTitle("Color bars")
|
||||
|
||||
# Create the drawing area.
|
||||
let area = newDrawingArea()
|
||||
window.add(area)
|
||||
|
||||
# Connect the "draw" event to the callback to draw the spiral.
|
||||
discard area.connect("draw", ondraw, pointer(nil))
|
||||
|
||||
window.showAll()
|
||||
|
||||
#———————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
let app = newApplication(Application, "Rosetta.ColorBars")
|
||||
discard app.connect("activate", activate)
|
||||
discard app.run()
|
||||
let surface = imageSurfaceCreate(FormatRgb24, 600, 400)
|
||||
surface.drawBars()
|
||||
if surface.writeToPng("color_bars.png") != StatusSuccess:
|
||||
quit "Error while writing file.", QuitFailure
|
||||
surface.destroy()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue