Tscope5
Main Page
Related Pages
Files
Examples
graphics05.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// graphics05.c
// - Illustration of the RGB color definition.
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
int
main()
{
// open a display and set graphics parameters
ts5_install_display
();
ts5_set_coordinate_scale
(TS5_RELATIVE_COORDINATES);
ts5_set_fill_mode
(TS5_FILL_ON);
double
i;
// draw rectangles, cycle the Red component
ts5_clear_display
();
for
(i=1.0; i>0.0; i-=0.01) {
TS5_COLOR tmp =
ts5_make_rgb_color
(i, 0.0, 0.0, 1.0);
ts5_set_foreground_color
(tmp);
ts5_draw_rectangle
(-i, -i, i, i);
}
ts5_flip_display
();
ts5_draw_mouse_button
(0.9,-0.8);
// draw rectangles, cycle the Green component
ts5_clear_display
();
for
(i=1.0; i>0.0; i-=0.01) {
TS5_COLOR tmp =
ts5_make_rgb_color
(0.0, i, 0.0, 1.0);
ts5_set_foreground_color
(tmp);
ts5_draw_rectangle
(-i, -i, i, i);
}
ts5_flip_display
();
ts5_draw_mouse_button
(0.9,-0.8);
// draw rectangles, cycle the Blue component
ts5_clear_display
();
for
(i=1.0; i>0.0; i-=0.01) {
TS5_COLOR tmp =
ts5_make_rgb_color
(0.0, 0.0, i, 1.0);
ts5_set_foreground_color
(tmp);
ts5_draw_rectangle
(-i, -i, i, i);
}
ts5_flip_display
();
ts5_draw_mouse_button
(0.9,-0.8);
// draw rectangles, cycle Alhpa
ts5_clear_display
();
for
(i=1.0; i>0.0; i-=0.01) {
TS5_COLOR tmp =
ts5_make_rgb_color
(1.0, 1.0, 1.0, 0.01);
ts5_set_foreground_color
(tmp);
ts5_draw_rectangle
(-i, -i, i, i);
}
ts5_flip_display
();
ts5_draw_mouse_button
(0.9,-0.8);
return
0;
}