46 lines
1.1 KiB
Fortran
46 lines
1.1 KiB
Fortran
Device screen("/dev/screen/0");
|
|
u8[] colors = [0,255,36,73,146,182,128,224,144,
|
|
252,9,18,12,16,28,159,2,3,10,19,131,147,130,227,129,226,
|
|
72,141,136,241,208,244];
|
|
|
|
fn main() {
|
|
screen.open(0);
|
|
screen.draw();
|
|
|
|
int x = 10;
|
|
int y = 20;
|
|
for (int i = 0; i < colors.length; i+=2) {
|
|
draw_outline_swatch(colors[i], x, y);
|
|
draw_outline_swatch(colors[i + 1], x + 20, y);
|
|
x += 20;
|
|
y += 20;
|
|
}
|
|
screen.draw();
|
|
exit(0);
|
|
}
|
|
|
|
fn draw_outline_swatch(u8 color, int x, int y) {
|
|
u8 gray = colors[5];
|
|
int outline_size = 20;
|
|
int fill_size = 17;
|
|
int offset = 2;
|
|
|
|
draw_box(gray, x, y, outline_size, outline_size);
|
|
int swatch_pos = x + 2;
|
|
int offset_pos = y + 2;
|
|
draw_box(color, swatch_pos, offset_pos, fill_size, fill_size);
|
|
return;
|
|
}
|
|
|
|
fn draw_box(u8 color, int x, int y, int width, int height) {
|
|
int screen_width = screen.width;
|
|
int pos = y * 640 + x;
|
|
|
|
do (int i = height; i > 0; i--) {
|
|
int row = pos + width;
|
|
int pixel = offset;
|
|
do (int j = ; pos;j++) {
|
|
screen.buffer[j] = color;
|
|
}
|
|
}
|
|
} |