2010-03-14 21:07:24 +03:00
//
2011-06-16 19:11:18 +04:00
// Device test program for the Fast Light Tool Kit (FLTK).
2011-06-16 19:01:30 +04:00
//
2021-05-08 16:15:47 +03:00
// Copyright 1998-2021 by Roman Kantor and others.
2010-03-14 21:07:24 +03:00
//
2011-07-19 08:49:30 +04:00
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
2020-07-01 19:03:10 +03:00
// https://www.fltk.org/COPYING.php
2011-06-16 19:01:30 +04:00
//
2020-07-01 19:03:10 +03:00
// Please see the following page on how to report bugs and issues:
2011-06-16 19:01:30 +04:00
//
2020-07-01 19:03:10 +03:00
// https://www.fltk.org/bugs.php
2011-06-16 19:01:30 +04:00
//
2010-03-14 21:07:24 +03:00
# include <math.h>
# include <FL/Fl.H>
2021-11-16 17:03:36 +03:00
# include <FL/Fl_Window.H>
2010-03-14 21:07:24 +03:00
# include <FL/Fl_Light_Button.H>
2014-05-23 20:47:21 +04:00
# include <FL/Fl_Radio_Round_Button.H>
2010-03-14 21:07:24 +03:00
# include <FL/fl_draw.H>
# include <FL/Fl_Clock.H>
# include <FL/Fl_Pixmap.H>
# include <FL/Fl_Bitmap.H>
# include <FL/Fl_Round_Button.H>
# include <FL/Fl_Printer.H>
2016-04-04 14:31:51 +03:00
# include <FL/Fl_PostScript.H>
2014-05-23 20:47:21 +04:00
# include <FL/Fl_Copy_Surface.H>
# include <FL/Fl_Image_Surface.H>
2020-06-27 10:56:00 +03:00
# include <FL/Fl_Native_File_Chooser.H>
# include <FL/Fl_SVG_File_Surface.H>
2024-03-31 17:55:49 +03:00
# include <FL/Fl_PDF_File_Surface.H>
2010-03-14 21:07:24 +03:00
2021-05-08 16:15:47 +03:00
# include "pixmaps/porsche.xpm"
# include "pixmaps/sorceress.xbm"
2010-03-14 21:07:24 +03:00
class MyWidget : public Fl_Box {
protected :
2022-12-30 21:14:36 +03:00
void draw ( ) FL_OVERRIDE {
2010-03-14 21:07:24 +03:00
Fl_Box : : draw ( ) ;
fl_color ( FL_RED ) ;
fl_rectf ( x ( ) + 5 , y ( ) + 5 , w ( ) - 10 , h ( ) - 10 ) ;
fl_push_clip ( x ( ) + 6 , y ( ) + 6 , w ( ) - 12 , h ( ) - 12 ) ;
fl_color ( FL_DARK_GREEN ) ;
fl_rectf ( x ( ) + 5 , y ( ) + 5 , w ( ) - 10 , h ( ) - 10 ) ;
fl_pop_clip ( ) ;
fl_color ( FL_YELLOW ) ;
fl_rectf ( x ( ) + 7 , y ( ) + 7 , w ( ) - 14 , h ( ) - 14 ) ;
fl_color ( FL_BLUE ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_rect ( x ( ) + 8 , y ( ) + 8 , w ( ) - 16 , h ( ) - 16 ) ;
fl_push_clip ( x ( ) + 25 , y ( ) + 25 , w ( ) - 50 , h ( ) - 50 ) ;
fl_color ( FL_BLACK ) ;
fl_rect ( x ( ) + 24 , y ( ) + 24 , w ( ) - 48 , h ( ) - 48 ) ;
fl_line ( x ( ) + 27 , y ( ) + 27 , x ( ) + w ( ) - 27 , y ( ) + h ( ) - 27 ) ;
fl_line ( x ( ) + 27 , y ( ) + h ( ) - 27 , x ( ) + w ( ) - 27 , y ( ) + 27 ) ;
//fl_rect(x()+30,y()+30,w()-60,h()-60);
fl_pop_clip ( ) ;
}
public :
2011-06-16 19:11:18 +04:00
MyWidget ( int x , int y ) : Fl_Box ( x , y , 100 , 100 , " Clipping and rect(f): \n Yellow rect.framed \n by B-Y-G-R rect. 1 p. \n thick. Your printer may \n render very thin lines \n surrounding \" X \" " ) {
align ( FL_ALIGN_TOP ) ;
labelsize ( 10 ) ;
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
} ;
2021-08-27 15:52:43 +03:00
class MyWidget2 : public Fl_Box {
2010-03-14 21:07:24 +03:00
protected :
2022-12-30 21:14:36 +03:00
void draw ( ) FL_OVERRIDE {
2010-03-14 21:07:24 +03:00
Fl_Box : : draw ( ) ;
int d ;
2011-06-16 19:11:18 +04:00
// fl_line_style(0);
2010-03-14 21:07:24 +03:00
for ( d = y ( ) + 5 ; d < 48 + y ( ) ; d + = 2 ) {
fl_xyline ( x ( ) + 5 , d , x ( ) + 48 ) ;
}
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
fl_push_clip ( x ( ) + 52 , y ( ) + 5 , 45 , 43 ) ;
for ( d = y ( ) + 5 ; d < 150 + y ( ) ; d + = 3 ) {
fl_line ( x ( ) + 52 , d , x ( ) + 92 , d - 40 ) ;
}
fl_pop_clip ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_line_style ( FL_DASH ) ;
fl_xyline ( x ( ) + 5 , y ( ) + 55 , x ( ) + 48 ) ;
fl_line_style ( FL_DOT ) ;
fl_xyline ( x ( ) + 5 , y ( ) + 58 , x ( ) + 48 ) ;
fl_line_style ( FL_DASHDOT ) ;
fl_xyline ( x ( ) + 5 , y ( ) + 61 , x ( ) + 48 ) ;
fl_line_style ( FL_DASHDOTDOT ) ;
fl_xyline ( x ( ) + 5 , y ( ) + 64 , x ( ) + 48 ) ;
2010-03-27 11:51:54 +03:00
fl_line_style ( 0 , 0 , ( char * ) " \7 \3 \7 \2 " ) ;
2010-03-14 21:07:24 +03:00
fl_xyline ( x ( ) + 5 , y ( ) + 67 , x ( ) + 48 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_line ( x ( ) + 5 , y ( ) + 72 , x ( ) + 25 , y ( ) + 95 ) ;
fl_line ( x ( ) + 8 , y ( ) + 72 , x ( ) + 28 , y ( ) + 95 , x ( ) + 31 , y ( ) + 72 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_YELLOW ) ;
fl_polygon ( x ( ) + 11 , y ( ) + 72 , x ( ) + 27 , y ( ) + 91 , x ( ) + 29 , y ( ) + 72 ) ;
fl_color ( FL_RED ) ;
fl_loop ( x ( ) + 11 , y ( ) + 72 , x ( ) + 27 , y ( ) + 91 , x ( ) + 29 , y ( ) + 72 ) ;
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
fl_color ( FL_BLUE ) ; ////
fl_line_style ( FL_SOLID , 6 ) ;
2010-03-14 21:07:24 +03:00
fl_loop ( x ( ) + 31 , y ( ) + 12 , x ( ) + 47 , y ( ) + 31 , x ( ) + 49 , y ( ) + 12 ) ;
2011-06-16 19:11:18 +04:00
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( 200 , 0 , 200 ) ;
fl_polygon ( x ( ) + 35 , y ( ) + 72 , x ( ) + 33 , y ( ) + 95 , x ( ) + 48 , y ( ) + 95 , x ( ) + 43 , y ( ) + 72 ) ;
fl_color ( FL_GREEN ) ;
fl_loop ( x ( ) + 35 , y ( ) + 72 , x ( ) + 33 , y ( ) + 95 , x ( ) + 48 , y ( ) + 95 , x ( ) + 43 , y ( ) + 72 ) ;
2020-07-01 19:03:10 +03:00
fl_color ( FL_BLUE ) ;
2010-03-14 21:07:24 +03:00
fl_yxline ( x ( ) + 65 , y ( ) + 63 , y ( ) + 66 ) ;
2020-07-01 19:03:10 +03:00
fl_color ( FL_GREEN ) ;
2010-03-14 21:07:24 +03:00
fl_yxline ( x ( ) + 66 , y ( ) + 66 , y ( ) + 63 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLUE ) ;
fl_rect ( x ( ) + 80 , y ( ) + 55 , 5 , 5 ) ;
fl_color ( FL_YELLOW ) ;
fl_rectf ( x ( ) + 81 , y ( ) + 56 , 3 , 3 ) ;
fl_color ( FL_BLACK ) ;
fl_point ( x ( ) + 82 , y ( ) + 57 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLUE ) ;
fl_rect ( x ( ) + 56 , y ( ) + 79 , 24 , 17 ) ;
fl_color ( FL_CYAN ) ;
fl_rectf ( x ( ) + 57 , y ( ) + 80 , 22 , 15 ) ;
fl_color ( FL_RED ) ;
fl_arc ( x ( ) + 57 , y ( ) + 80 , 22 , 15 , 40 , 270 ) ;
fl_color ( FL_YELLOW ) ;
fl_pie ( x ( ) + 58 , y ( ) + 81 , 20 , 13 , 40 , 270 ) ;
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
fl_color ( FL_BLACK ) ;
fl_point ( x ( ) + 58 , y ( ) + 58 ) ;
fl_color ( FL_RED ) ;
fl_yxline ( x ( ) + 59 , y ( ) + 58 , y ( ) + 59 ) ;
fl_color ( FL_GREEN ) ;
fl_yxline ( x ( ) + 60 , y ( ) + 59 , y ( ) + 58 ) ;
fl_color ( FL_BLACK ) ;
fl_xyline ( x ( ) + 61 , y ( ) + 58 , x ( ) + 62 ) ;
fl_color ( FL_RED ) ;
fl_xyline ( x ( ) + 62 , y ( ) + 59 , x ( ) + 61 ) ;
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
fl_color ( FL_GREEN ) ;
fl_yxline ( x ( ) + 57 , y ( ) + 58 , y ( ) + 59 , x ( ) + 58 ) ;
fl_color ( FL_BLUE ) ;
fl_xyline ( x ( ) + 58 , y ( ) + 60 , x ( ) + 56 , y ( ) + 58 ) ;
fl_color ( FL_RED ) ;
fl_xyline ( x ( ) + 58 , y ( ) + 61 , x ( ) + 56 , y ( ) + 63 ) ;
fl_color ( FL_GREEN ) ;
fl_yxline ( x ( ) + 57 , y ( ) + 63 , y ( ) + 62 , x ( ) + 58 ) ;
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
fl_color ( FL_BLUE ) ;
fl_line ( x ( ) + 58 , y ( ) + 63 , x ( ) + 60 , y ( ) + 65 ) ;
fl_color ( FL_BLACK ) ;
fl_line ( x ( ) + 61 , y ( ) + 65 , x ( ) + 59 , y ( ) + 63 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLACK ) ;
2021-08-27 15:52:43 +03:00
}
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
public :
2021-08-27 15:52:43 +03:00
MyWidget2 ( int x , int y ) : Fl_Box ( x , y , 100 , 100 , " Integer primitives " ) {
2011-06-16 19:11:18 +04:00
labelsize ( 10 ) ;
align ( FL_ALIGN_TOP ) ;
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
} ;
2021-08-27 15:52:43 +03:00
class MyWidget3 : public Fl_Box {
2010-03-14 21:07:24 +03:00
protected :
2022-12-30 21:14:36 +03:00
void draw ( ) FL_OVERRIDE {
2010-03-14 21:07:24 +03:00
Fl_Box : : draw ( ) ;
double d ;
2011-06-16 19:11:18 +04:00
// fl_line_style(0);
2010-03-14 21:07:24 +03:00
fl_push_clip ( x ( ) + 5 , y ( ) + 5 , 45 , 43 ) ;
for ( d = y ( ) + 5 ; d < 95 + y ( ) ; d + = 1.63 ) {
fl_begin_line ( ) ;
fl_vertex ( x ( ) + 5 , d ) ;
fl_vertex ( x ( ) + 48 , d ) ;
fl_end_line ( ) ;
}
fl_pop_clip ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_push_clip ( x ( ) + 52 , y ( ) + 5 , 45 , 43 ) ;
for ( d = y ( ) + 5 ; d < 150 + y ( ) ; d + = 2.3052 ) {
fl_begin_line ( ) ;
fl_vertex ( x ( ) + 52 , d ) ;
fl_vertex ( x ( ) + 92 , d - 43 ) ;
fl_end_line ( ) ;
}
fl_pop_clip ( ) ;
2020-07-01 19:03:10 +03:00
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
public :
2021-08-27 15:52:43 +03:00
MyWidget3 ( int x , int y ) : Fl_Box ( x , y , 100 , 100 , " Sub-pixel drawing of \n lines 1.63 points apart \n On the screen you \n can see aliasing, the \n printer should render \n them properly " ) {
2011-06-16 19:11:18 +04:00
labelsize ( 10 ) ;
align ( FL_ALIGN_TOP ) ;
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
} ;
class MyWidget4 : public Fl_Box {
protected :
2022-12-30 21:14:36 +03:00
void draw ( ) FL_OVERRIDE {
2010-03-14 21:07:24 +03:00
Fl_Box : : draw ( ) ;
fl_push_matrix ( ) ;
fl_translate ( x ( ) , y ( ) ) ;
fl_scale ( .75 , .75 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_line_style ( FL_SOLID , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 160 ) ;
fl_vertex ( 40 , 160 ) ;
fl_vertex ( 40 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
fl_color ( FL_RED ) ;
fl_line_style ( FL_SOLID | FL_CAP_FLAT | FL_JOIN_MITER , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 150 ) ;
fl_vertex ( 50 , 150 ) ;
fl_vertex ( 50 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
fl_color ( FL_GREEN ) ;
2010-03-14 21:07:24 +03:00
fl_line_style ( FL_SOLID | FL_CAP_ROUND | FL_JOIN_ROUND , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 140 ) ;
fl_vertex ( 60 , 140 ) ;
fl_vertex ( 60 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLUE ) ;
fl_line_style ( FL_SOLID | FL_CAP_SQUARE | FL_JOIN_BEVEL , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 130 ) ;
fl_vertex ( 70 , 130 ) ;
fl_vertex ( 70 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLACK ) ;
fl_line_style ( FL_DASH , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 120 ) ;
fl_vertex ( 80 , 120 ) ;
fl_vertex ( 80 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_RED ) ;
fl_line_style ( FL_DASH | FL_CAP_FLAT , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 110 ) ;
fl_vertex ( 90 , 110 ) ;
fl_vertex ( 90 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_GREEN ) ;
fl_line_style ( FL_DASH | FL_CAP_ROUND , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 100 ) ;
fl_vertex ( 100 , 100 ) ;
fl_vertex ( 100 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLUE ) ;
fl_line_style ( FL_DASH | FL_CAP_SQUARE , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 90 ) ;
fl_vertex ( 110 , 90 ) ;
fl_vertex ( 110 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLACK ) ;
fl_line_style ( FL_DOT , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 80 ) ;
fl_vertex ( 120 , 80 ) ;
fl_vertex ( 120 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_RED ) ;
fl_line_style ( FL_DOT | FL_CAP_FLAT , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 70 ) ;
fl_vertex ( 130 , 70 ) ;
fl_vertex ( 130 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_GREEN ) ;
fl_line_style ( FL_DOT | FL_CAP_ROUND , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 60 ) ;
fl_vertex ( 140 , 60 ) ;
fl_vertex ( 140 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLUE ) ;
fl_line_style ( FL_DOT | FL_CAP_SQUARE , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 50 ) ;
fl_vertex ( 150 , 50 ) ;
fl_vertex ( 150 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLACK ) ;
fl_line_style ( FL_DASHDOT | FL_CAP_ROUND | FL_JOIN_ROUND , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 40 ) ;
fl_vertex ( 160 , 40 ) ;
fl_vertex ( 160 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_RED ) ;
fl_line_style ( FL_DASHDOTDOT | FL_CAP_SQUARE | FL_JOIN_BEVEL , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 30 ) ;
fl_vertex ( 170 , 30 ) ;
fl_vertex ( 170 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_GREEN ) ;
fl_line_style ( FL_DASHDOTDOT | FL_CAP_ROUND | FL_JOIN_ROUND , 5 ) ;
fl_begin_line ( ) ;
fl_vertex ( 10 , 20 ) ;
fl_vertex ( 180 , 20 ) ;
fl_vertex ( 180 , 190 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLUE ) ;
2010-03-27 11:51:54 +03:00
fl_line_style ( 0 , 5 , ( char * ) " \12 \3 \4 \2 \2 \1 " ) ;
2010-03-14 21:07:24 +03:00
fl_begin_line ( ) ;
fl_vertex ( 10 , 10 ) ;
fl_vertex ( 190 , 10 ) ;
fl_vertex ( 190 , 190 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
fl_pop_matrix ( ) ;
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLACK ) ;
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
public :
2016-04-15 11:06:47 +03:00
MyWidget4 ( int x , int y ) : Fl_Box ( x , y + 10 , 150 , 150 , " Line styles " ) {
2011-06-16 19:11:18 +04:00
labelsize ( 10 ) ;
align ( FL_ALIGN_TOP ) ;
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
} ;
2021-08-27 15:52:43 +03:00
class MyWidget5 : public Fl_Box {
2010-03-14 21:07:24 +03:00
protected :
2022-12-30 21:14:36 +03:00
void draw ( ) FL_OVERRIDE {
2010-03-14 21:07:24 +03:00
Fl_Box : : draw ( ) ;
fl_push_matrix ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_translate ( x ( ) , y ( ) ) ;
fl_push_matrix ( ) ;
fl_mult_matrix ( 1 , 3 , 0 , 1 , 0 , - 20 ) ;
fl_color ( FL_GREEN ) ;
fl_begin_polygon ( ) ;
fl_vertex ( 10 , 10 ) ;
fl_vertex ( 100 , - 80 ) ;
fl_vertex ( 100 , - 190 ) ;
fl_end_polygon ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_RED ) ;
fl_line_style ( FL_DASHDOT , 7 ) ;
fl_begin_loop ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_vertex ( 10 , 10 ) ;
fl_vertex ( 100 , - 80 ) ;
fl_vertex ( 100 , - 190 ) ;
fl_end_loop ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLUE ) ;
fl_line_style ( FL_SOLID , 3 ) ;
fl_begin_loop ( ) ;
fl_circle ( 60 , - 50 , 30 ) ;
fl_end_loop ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_pop_matrix ( ) ;
fl_scale ( 1.8 , 1 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_YELLOW ) ;
fl_begin_polygon ( ) ;
fl_arc ( 30 , 90 , 20 , - 45 , 200 ) ;
fl_end_polygon ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_color ( FL_BLACK ) ;
fl_line_style ( FL_DASH , 3 ) ;
fl_begin_line ( ) ;
fl_arc ( 30 , 90 , 20 , - 45 , 200 ) ;
fl_end_line ( ) ;
fl_line_style ( 0 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_translate ( 15 , 0 ) ;
fl_scale ( 1.5 , 3 ) ;
fl_begin_complex_polygon ( ) ;
fl_vertex ( 30 , 70 ) ;
fl_arc ( 45 , 55 , 10 , 200 , 90 ) ;
fl_arc ( 55 , 45 , 8 , - 170 , 20 ) ;
fl_vertex ( 60 , 40 ) ;
fl_vertex ( 30 , 20 ) ;
fl_vertex ( 40 , 5 ) ;
fl_vertex ( 60 , 25 ) ;
//fl_vertex(50,50);
fl_curve ( 35 , 30 , 30 , 53 , 0 , 35 , 65 , 65 ) ;
fl_gap ( ) ;
fl_vertex ( 50 , 25 ) ;
fl_vertex ( 40 , 10 ) ;
fl_vertex ( 35 , 20 ) ;
fl_end_complex_polygon ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
fl_pop_matrix ( ) ;
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
public :
MyWidget5 ( int x , int y ) : Fl_Box ( x , y , 230 , 250 , " Complex (double) drawings: \n Blue ellipse may not be \n correctly transformed \n due to non-orthogonal \n transformation " ) {
2011-06-16 19:11:18 +04:00
labelsize ( 10 ) ;
align ( FL_ALIGN_TOP ) ;
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
} ;
uchar * image ;
int width = 80 ;
int height = 80 ;
void make_image ( ) {
image = new uchar [ 4 * width * height ] ;
uchar * p = image ;
for ( int y = 0 ; y < height ; y + + ) {
double Y = double ( y ) / ( height - 1 ) ;
for ( int x = 0 ; x < width ; x + + ) {
double X = double ( x ) / ( width - 1 ) ;
* p + + = uchar ( 255 * ( ( 1 - X ) * ( 1 - Y ) ) ) ; // red in upper-left
2020-07-01 19:03:10 +03:00
* p + + = uchar ( 255 * ( ( 1 - X ) * Y ) ) ; // green in lower-left
* p + + = uchar ( 255 * ( X * Y ) ) ; // blue in lower-right
2010-03-14 21:07:24 +03:00
X - = 0.5 ;
Y - = 0.5 ;
int alpha = ( int ) ( 350 * sqrt ( X * X + Y * Y ) ) ;
2020-07-01 19:03:10 +03:00
if ( alpha < 255 ) * p + + = uchar ( alpha ) ; // alpha transparency
2010-03-14 21:07:24 +03:00
else * p + + = 255 ;
Y + = 0.5 ;
}
}
}
2016-11-30 10:12:29 +03:00
void close_tmp_win ( Fl_Widget * win , void * data ) {
( ( Fl_Shared_Image * ) data ) - > release ( ) ;
Fl : : delete_widget ( win ) ;
}
2014-05-23 20:47:21 +04:00
Fl_Widget * target ;
const char * operation ;
void copy ( Fl_Widget * , void * data ) {
if ( strcmp ( operation , " Fl_Image_Surface " ) = = 0 ) {
2016-01-10 22:08:16 +03:00
Fl_Image_Surface * rgb_surf ;
int W , H , decorated ;
if ( target - > as_window ( ) & & ! target - > parent ( ) ) {
W = target - > as_window ( ) - > decorated_w ( ) ;
H = target - > as_window ( ) - > decorated_h ( ) ;
decorated = 1 ;
2020-07-01 19:03:10 +03:00
}
2016-01-10 22:08:16 +03:00
else {
W = target - > w ( ) ;
H = target - > h ( ) ;
decorated = 0 ;
}
2016-02-12 14:49:32 +03:00
rgb_surf = new Fl_Image_Surface ( W , H , 1 ) ;
2016-12-07 18:09:52 +03:00
Fl_Surface_Device : : push_current ( rgb_surf ) ;
2016-02-27 16:52:27 +03:00
fl_color ( FL_YELLOW ) ; fl_rectf ( 0 , 0 , W , H ) ;
2016-01-10 22:08:16 +03:00
if ( decorated )
rgb_surf - > draw_decorated_window ( target - > as_window ( ) ) ;
else
rgb_surf - > draw ( target ) ;
2018-05-06 18:59:08 +03:00
Fl_Image * img = rgb_surf - > image ( ) ;
2014-05-23 20:47:21 +04:00
delete rgb_surf ;
2016-12-07 18:09:52 +03:00
Fl_Surface_Device : : pop_current ( ) ;
2016-04-27 19:42:20 +03:00
if ( img ) {
2021-11-16 17:03:36 +03:00
Fl_Window * g2 = new Fl_Window ( img - > w ( ) + 10 , img - > h ( ) + 10 , " Fl_Image_Surface " ) ;
2016-04-27 19:42:20 +03:00
g2 - > color ( FL_YELLOW ) ;
Fl_Box * b = new Fl_Box ( FL_NO_BOX , 5 , 5 , img - > w ( ) , img - > h ( ) , 0 ) ;
b - > image ( img ) ;
g2 - > end ( ) ;
2016-11-30 10:12:29 +03:00
g2 - > callback ( close_tmp_win , img ) ;
2016-04-27 19:42:20 +03:00
g2 - > show ( ) ;
}
2014-05-23 20:47:21 +04:00
return ;
}
2023-12-21 16:03:04 +03:00
2014-05-23 20:47:21 +04:00
if ( strcmp ( operation , " Fl_Copy_Surface " ) = = 0 ) {
2015-11-24 17:26:52 +03:00
Fl_Copy_Surface * copy_surf ;
if ( target - > as_window ( ) & & ! target - > parent ( ) ) {
copy_surf = new Fl_Copy_Surface ( target - > as_window ( ) - > decorated_w ( ) , target - > as_window ( ) - > decorated_h ( ) ) ;
2016-12-07 18:09:52 +03:00
Fl_Surface_Device : : push_current ( copy_surf ) ;
2015-11-24 17:26:52 +03:00
copy_surf - > draw_decorated_window ( target - > as_window ( ) , 0 , 0 ) ;
}
else {
copy_surf = new Fl_Copy_Surface ( target - > w ( ) + 10 , target - > h ( ) + 20 ) ;
2016-12-07 18:09:52 +03:00
Fl_Surface_Device : : push_current ( copy_surf ) ;
2015-11-24 17:26:52 +03:00
fl_color ( FL_YELLOW ) ; fl_rectf ( 0 , 0 , copy_surf - > w ( ) , copy_surf - > h ( ) ) ;
copy_surf - > draw ( target , 5 , 10 ) ;
}
2014-05-23 20:47:21 +04:00
delete copy_surf ;
2016-12-07 18:09:52 +03:00
Fl_Surface_Device : : pop_current ( ) ;
2023-11-20 19:13:09 +03:00
}
2023-12-21 16:03:04 +03:00
2024-03-31 17:55:49 +03:00
if ( strcmp ( operation , " Fl_Printer " ) = = 0 | | strcmp ( operation , " Fl_PostScript_File_Device " ) = = 0
| | strcmp ( operation , " Fl_PDF_File_Surface " ) = = 0 ) {
2016-04-04 14:31:51 +03:00
Fl_Paged_Device * p ;
int err ;
2020-04-22 16:59:22 +03:00
char * err_message = NULL ;
2016-04-04 14:31:51 +03:00
if ( strcmp ( operation , " Fl_Printer " ) = = 0 ) {
p = new Fl_Printer ( ) ;
2020-04-22 16:59:22 +03:00
err = p - > begin_job ( 1 , NULL , NULL , & err_message ) ;
2024-03-31 17:55:49 +03:00
} else if ( strcmp ( operation , " Fl_PDF_File_Surface " ) = = 0 ) {
p = new Fl_PDF_File_Surface ( ) ;
err = ( ( Fl_PDF_File_Surface * ) p ) - > begin_job ( " FLTK.pdf " , & err_message ) ;
} else {
2016-04-04 14:31:51 +03:00
p = new Fl_PostScript_File_Device ( ) ;
err = ( ( Fl_PostScript_File_Device * ) p ) - > start_job ( 1 ) ;
}
if ( ! err ) {
2020-04-22 16:59:22 +03:00
p - > begin_page ( ) ;
2024-03-31 17:55:49 +03:00
Fl_Window * win = target - > as_window ( ) ;
int target_w = win ? win - > decorated_w ( ) : target - > w ( ) ;
int target_h = win ? win - > decorated_h ( ) : target - > h ( ) ;
int w , h ;
p - > printable_rect ( & w , & h ) ;
float s = 1 , s_aux = 1 ;
if ( target_w > w )
s_aux = float ( w ) / target_w ;
if ( target_h > h )
s = float ( h ) / target_h ;
if ( s_aux < s ) s = s_aux ;
p - > scale ( s ) ;
p - > printable_rect ( & w , & h ) ;
p - > origin ( w / 2 , h / 2 ) ;
if ( win ) p - > draw_decorated_window ( win , - target_w / 2 , - target_h / 2 ) ;
else p - > draw ( target , - target_w / 2 , - target_h / 2 ) ;
2014-05-23 20:47:21 +04:00
p - > end_page ( ) ;
p - > end_job ( ) ;
2020-04-22 16:59:22 +03:00
} else if ( err > 1 & & err_message ) { fl_alert ( " %s " , err_message ) ; delete [ ] err_message ; }
2014-05-23 20:47:21 +04:00
delete p ;
2010-03-14 21:07:24 +03:00
}
2023-12-21 16:03:04 +03:00
2020-06-27 10:56:00 +03:00
if ( strcmp ( operation , " Fl_SVG_File_Surface " ) = = 0 ) {
Fl_Native_File_Chooser fnfc ;
fnfc . title ( " Save a .svg file " ) ;
fnfc . type ( Fl_Native_File_Chooser : : BROWSE_SAVE_FILE ) ;
fnfc . filter ( " SVG \t *.svg \n " ) ;
fnfc . options ( Fl_Native_File_Chooser : : SAVEAS_CONFIRM | Fl_Native_File_Chooser : : USE_FILTER_EXT ) ;
if ( ! fnfc . show ( ) ) {
FILE * svg = fl_fopen ( fnfc . filename ( ) , " w " ) ;
if ( svg ) {
int ww , wh ;
if ( target - > as_window ( ) ) {
ww = target - > as_window ( ) - > decorated_w ( ) ;
wh = target - > as_window ( ) - > decorated_h ( ) ;
} else {
ww = target - > w ( ) ;
wh = target - > h ( ) ;
}
Fl_SVG_File_Surface surface ( ww , wh , svg ) ;
if ( surface . file ( ) ) {
if ( target - > as_window ( ) ) surface . draw_decorated_window ( target - > as_window ( ) ) ;
else surface . draw ( target ) ;
2020-11-03 20:05:10 +03:00
if ( surface . close ( ) ) fl_message ( " Error while writing to SVG file %s " , fnfc . filename ( ) ) ;
2020-06-27 10:56:00 +03:00
}
}
}
}
2023-12-21 16:03:04 +03:00
2021-11-18 12:57:12 +03:00
if ( strcmp ( operation , " fl_capture_window() " ) = = 0 ) {
2021-11-16 17:03:36 +03:00
Fl_Window * win = target - > as_window ( ) ? target - > as_window ( ) : target - > window ( ) ;
int X = target - > as_window ( ) ? 0 : target - > x ( ) ;
int Y = target - > as_window ( ) ? 0 : target - > y ( ) ;
Fl_RGB_Image * img = fl_capture_window ( win , X , Y , target - > w ( ) , target - > h ( ) ) ;
if ( img ) {
Fl_Window * g2 = new Fl_Window ( img - > w ( ) + 10 , img - > h ( ) + 10 , " fl_capture_window() " ) ;
g2 - > color ( FL_YELLOW ) ;
Fl_Box * b = new Fl_Box ( FL_NO_BOX , 5 , 5 , img - > w ( ) , img - > h ( ) , 0 ) ;
b - > image ( img ) ;
g2 - > end ( ) ;
g2 - > callback ( close_tmp_win , img ) ;
g2 - > show ( ) ;
}
}
2023-12-21 16:03:04 +03:00
2023-11-20 19:13:09 +03:00
if ( strcmp ( operation , " Fl_Image_Surface::mask() " ) = = 0 ) {
Fl_Image_Surface * surf = new Fl_Image_Surface ( target - > w ( ) , target - > h ( ) , 1 ) ;
Fl_Surface_Device : : push_current ( surf ) ;
fl_color ( FL_BLACK ) ;
fl_rectf ( 0 , 0 , target - > w ( ) , target - > h ( ) ) ;
fl_color ( FL_WHITE ) ;
fl_pie ( 0 , 0 , target - > w ( ) , target - > h ( ) , 0 , 360 ) ;
if ( target - > top_window ( ) = = target ) {
fl_color ( FL_BLACK ) ;
2023-12-17 20:05:36 +03:00
int mini = int ( ( target - > w ( ) < target - > h ( ) ? target - > w ( ) : target - > h ( ) ) * 0.66 ) ;
2023-11-20 19:13:09 +03:00
fl_pie ( target - > w ( ) / 2 - mini / 2 , target - > h ( ) / 2 - mini / 2 , mini , mini , 0 , 360 ) ;
fl_color ( FL_WHITE ) ;
fl_font ( FL_TIMES_BOLD , 120 ) ;
int dx , dy , l , h ;
fl_text_extents ( " FLTK " , dx , dy , l , h ) ;
fl_draw ( " FLTK " , target - > w ( ) / 2 - l / 2 , target - > h ( ) / 2 + h / 2 ) ;
}
Fl_RGB_Image * mask = surf - > image ( ) ;
fl_color ( FL_YELLOW ) ;
fl_rectf ( 0 , 0 , target - > w ( ) , target - > h ( ) ) ;
Fl_Surface_Device : : pop_current ( ) ;
surf - > mask ( mask ) ;
delete mask ;
Fl_Surface_Device : : push_current ( surf ) ;
surf - > draw ( target , 0 , 0 ) ;
mask = surf - > image ( ) ;
Fl_Surface_Device : : pop_current ( ) ;
delete surf ;
Fl_Window * win = new Fl_Window ( mask - > w ( ) , mask - > h ( ) , operation ) ;
Fl_Box * box = new Fl_Box ( 0 , 0 , mask - > w ( ) , mask - > h ( ) ) ;
box - > bind_image ( mask ) ;
win - > end ( ) ;
win - > show ( ) ;
}
2023-12-21 16:03:04 +03:00
2011-01-11 23:52:38 +03:00
}
2010-03-14 21:07:24 +03:00
2021-08-27 15:52:43 +03:00
class My_Button : public Fl_Button {
2010-03-14 21:07:24 +03:00
protected :
2022-12-30 21:14:36 +03:00
void draw ( ) FL_OVERRIDE {
2011-06-16 19:11:18 +04:00
if ( type ( ) = = FL_HIDDEN_BUTTON ) return ;
Fl_Color col = value ( ) ? selection_color ( ) : color ( ) ;
draw_box ( value ( ) ? ( down_box ( ) ? down_box ( ) : fl_down ( box ( ) ) ) : box ( ) , col ) ;
fl_color ( FL_WHITE ) ;
fl_line_style ( FL_SOLID , 5 ) ;
fl_line ( x ( ) + 15 , y ( ) + 10 , x ( ) + w ( ) - 15 , y ( ) + h ( ) - 23 ) ;
fl_line ( x ( ) + w ( ) - 15 , y ( ) + 10 , x ( ) + 15 , y ( ) + h ( ) - 23 ) ;
fl_line_style ( 0 ) ;
draw_label ( ) ;
2020-07-01 19:03:10 +03:00
2021-08-27 15:52:43 +03:00
}
2010-03-14 21:07:24 +03:00
public :
My_Button ( int x , int y , int w , int h , const char * label = 0 ) : Fl_Button ( x , y , w , h , label ) { }
} ;
2014-05-23 20:47:21 +04:00
void target_cb ( Fl_Widget * wid , void * data )
{
target = ( Fl_Widget * ) data ;
}
void operation_cb ( Fl_Widget * wid , void * data )
{
operation = wid - > label ( ) ;
}
2010-03-14 21:07:24 +03:00
int main ( int argc , char * * argv ) {
2020-07-01 19:03:10 +03:00
2023-11-20 19:13:09 +03:00
//Fl::scheme("plastic");
2020-07-01 19:03:10 +03:00
2020-06-27 10:56:00 +03:00
Fl_Window * w2 = new Fl_Window ( 500 , 568 , " Graphics test " ) ;
2020-07-01 19:03:10 +03:00
2020-06-27 10:56:00 +03:00
Fl_Group * c2 = new Fl_Group ( 3 , 56 , 494 , 514 ) ;
2020-07-01 19:03:10 +03:00
2020-06-27 10:56:00 +03:00
new MyWidget ( 10 , 140 + 16 ) ;
new MyWidget2 ( 110 , 80 + 16 ) ;
new MyWidget3 ( 220 , 140 + 16 ) ;
new MyWidget4 ( 330 , 70 + 16 ) ;
new MyWidget5 ( 140 , 270 + 16 ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
make_image ( ) ;
Fl_RGB_Image * rgb = new Fl_RGB_Image ( image , width , height , 4 ) ;
2020-06-27 10:56:00 +03:00
My_Button b_rgb ( 10 , 245 + 16 , 100 , 100 , " RGB with alpha " ) ;
2010-03-14 21:07:24 +03:00
b_rgb . image ( rgb ) ;
2020-07-01 19:03:10 +03:00
2020-06-27 10:56:00 +03:00
My_Button b_pixmap ( 10 , 345 + 16 , 100 , 100 , " Pixmap " ) ;
2010-03-14 21:07:24 +03:00
Fl_Pixmap * pixmap = new Fl_Pixmap ( porsche_xpm ) ;
b_pixmap . image ( pixmap ) ;
2020-07-01 19:03:10 +03:00
2020-06-27 10:56:00 +03:00
My_Button b_bitmap ( 10 , 445 + 16 , 100 , 100 , " Bitmap " ) ;
2011-06-16 19:11:18 +04:00
b_bitmap . labelcolor ( FL_GREEN ) ;
2010-03-14 21:07:24 +03:00
b_bitmap . image ( new Fl_Bitmap ( sorceress_bits , sorceress_width , sorceress_height ) ) ;
2020-07-01 19:03:10 +03:00
2020-06-27 10:56:00 +03:00
new Fl_Clock ( 360 , 230 + 16 , 120 , 120 ) ;
2020-09-07 09:35:41 +03:00
Fl_Return_Button * ret = new Fl_Return_Button ( 360 , 360 + 16 , 120 , 30 , " Return " ) ;
2010-03-14 21:07:24 +03:00
ret - > deactivate ( ) ;
2020-06-27 10:56:00 +03:00
Fl_Button but1 ( 360 , 390 + 16 , 30 , 30 , " @->| " ) ;
2010-03-14 21:07:24 +03:00
but1 . labelcolor ( FL_DARK3 ) ;
2020-06-27 10:56:00 +03:00
Fl_Button but2 ( 390 , 390 + 16 , 30 , 30 , " @UpArrow " ) ;
2010-03-14 21:07:24 +03:00
but2 . labelcolor ( FL_DARK3 ) ;
2020-06-27 10:56:00 +03:00
Fl_Button but3 ( 420 , 390 + 16 , 30 , 30 , " @DnArrow " ) ;
2010-03-14 21:07:24 +03:00
but3 . labelcolor ( FL_DARK3 ) ;
2020-06-27 10:56:00 +03:00
Fl_Button but4 ( 450 , 390 + 16 , 30 , 30 , " @+ " ) ;
2010-03-14 21:07:24 +03:00
but4 . labelcolor ( FL_DARK3 ) ;
2020-06-27 10:56:00 +03:00
Fl_Button but5 ( 360 , 425 + 16 , 120 , 30 , " Hello, World " ) ;
2010-03-14 21:07:24 +03:00
but5 . labelfont ( FL_BOLD | FL_ITALIC ) ;
but5 . labeltype ( FL_SHADOW_LABEL ) ;
but5 . box ( FL_ROUND_UP_BOX ) ;
2020-07-01 19:03:10 +03:00
2020-06-27 10:56:00 +03:00
Fl_Button but6 ( 360 , 460 + 16 , 120 , 30 , " Plastic " ) ;
2010-03-14 21:07:24 +03:00
but6 . box ( FL_PLASTIC_UP_BOX ) ;
2020-07-01 19:03:10 +03:00
2014-05-23 20:47:21 +04:00
Fl_Group * group ;
2020-06-27 10:56:00 +03:00
{ Fl_Group * o = new Fl_Group ( 360 , 495 + 16 , 120 , 40 ) ; group = o ;
2010-03-14 21:07:24 +03:00
o - > box ( FL_UP_BOX ) ;
2020-06-27 10:56:00 +03:00
{ Fl_Group * o = new Fl_Group ( 365 , 500 + 16 , 110 , 30 ) ;
2010-03-14 21:07:24 +03:00
o - > box ( FL_THIN_UP_FRAME ) ;
2020-06-27 10:56:00 +03:00
{ Fl_Round_Button * o = new Fl_Round_Button ( 365 , 500 + 16 , 40 , 30 , " rad " ) ;
2010-03-14 21:07:24 +03:00
o - > value ( 1 ) ;
}
2020-06-27 10:56:00 +03:00
{ Fl_Check_Button * o = new Fl_Check_Button ( 410 , 500 + 16 , 60 , 30 , " check " ) ;
2010-03-14 21:07:24 +03:00
o - > value ( 1 ) ;
}
o - > end ( ) ;
}
o - > end ( ) ;
o - > deactivate ( ) ;
}
2020-06-27 10:56:00 +03:00
Fl_Box tx ( 120 , 492 + 16 , 230 , 50 , " Background is not printed because \n encapsulating group, which we are \n printing, has not set the box type " ) ;
2010-03-14 21:07:24 +03:00
tx . box ( FL_SHADOW_BOX ) ;
tx . labelsize ( 12 ) ;
2020-07-01 19:03:10 +03:00
2011-04-19 00:47:32 +04:00
tx . hide ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
c2 - > end ( ) ;
2020-07-01 19:03:10 +03:00
2014-05-23 20:47:21 +04:00
Fl_Radio_Round_Button * rb ;
2020-06-27 10:56:00 +03:00
Fl_Window * w3 = new Fl_Window ( 2 , 5 , w2 - > w ( ) - 10 , 73 ) ;
2014-05-23 20:47:21 +04:00
w3 - > box ( FL_DOWN_BOX ) ;
2021-11-18 12:57:12 +03:00
Fl_Group * g1 = new Fl_Group ( 0 , 0 , w3 - > w ( ) , w3 - > h ( ) ) ;
rb = new Fl_Radio_Round_Button ( 5 , 4 , 150 , 12 , " Fl_Image_Surface " ) ;
2016-04-04 14:31:51 +03:00
rb - > set ( ) ; rb - > callback ( operation_cb , NULL ) ; operation = rb - > label ( ) ; rb - > labelsize ( 12 ) ;
2021-11-18 12:57:12 +03:00
rb = new Fl_Radio_Round_Button ( 170 , 4 , 150 , 12 , " Fl_Copy_Surface " ) ; rb - > callback ( operation_cb , NULL ) ; rb - > labelsize ( 12 ) ;
rb = new Fl_Radio_Round_Button ( 5 , 17 , 150 , 12 , " Fl_Printer " ) ; rb - > callback ( operation_cb , NULL ) ; rb - > labelsize ( 12 ) ;
rb = new Fl_Radio_Round_Button ( 170 , 17 , 150 , 12 , " Fl_PostScript_File_Device " ) ; rb - > callback ( operation_cb , NULL ) ; rb - > labelsize ( 12 ) ;
2024-03-31 17:55:49 +03:00
rb = new Fl_Radio_Round_Button ( 5 , 30 , 150 , 12 , " Fl_PDF_File_Surface " ) ; rb - > callback ( operation_cb , NULL ) ; rb - > labelsize ( 12 ) ;
2021-11-18 12:57:12 +03:00
rb = new Fl_Radio_Round_Button ( 170 , 30 , 150 , 12 , " Fl_SVG_File_Surface " ) ; rb - > callback ( operation_cb , NULL ) ; rb - > labelsize ( 12 ) ;
rb = new Fl_Radio_Round_Button ( 5 , 43 , 150 , 12 , " fl_capture_window() " ) ; rb - > callback ( operation_cb , NULL ) ; rb - > labelsize ( 12 ) ;
2023-11-20 19:13:09 +03:00
rb = new Fl_Radio_Round_Button ( 170 , 43 , 150 , 12 , " Fl_Image_Surface::mask() " ) ; rb - > callback ( operation_cb , NULL ) ; rb - > labelsize ( 12 ) ;
2014-05-23 20:47:21 +04:00
g1 - > end ( ) ;
2020-07-01 19:03:10 +03:00
2021-11-18 12:57:12 +03:00
Fl_Group * g2 = new Fl_Group ( 0 , 0 , w3 - > w ( ) , w3 - > h ( ) ) ;
Fl_Box * box = new Fl_Box ( FL_BORDER_BOX , 4 , 55 , 340 , 16 , NULL ) ;
box - > color ( FL_LIGHT3 ) ;
rb = new Fl_Radio_Round_Button ( 5 , 57 , 140 , 12 , " Decorated window " ) ;
2021-11-16 17:03:36 +03:00
rb - > labelsize ( 12 ) ; rb - > set ( ) ; rb - > callback ( target_cb , w2 ) ; target = w2 ;
2021-11-18 12:57:12 +03:00
rb = new Fl_Radio_Round_Button ( 160 , 57 , 100 , 12 , " Sub-window " ) ;
2021-11-16 17:03:36 +03:00
rb - > labelsize ( 12 ) ; rb - > callback ( target_cb , w3 ) ;
2021-11-18 12:57:12 +03:00
rb = new Fl_Radio_Round_Button ( 275 , 57 , 60 , 12 , " Group " ) ;
2021-11-16 17:03:36 +03:00
rb - > labelsize ( 12 ) ; rb - > callback ( target_cb , group ) ;
2014-05-23 20:47:21 +04:00
g2 - > end ( ) ;
2021-11-16 17:03:36 +03:00
Fl_Button * b4 = new Fl_Button ( 380 , ( w3 - > h ( ) - 25 ) / 2 , 100 , 25 , " GO " ) ;
2014-05-23 20:47:21 +04:00
b4 - > callback ( ( Fl_Callback * ) copy , NULL ) ;
w3 - > end ( ) ;
2020-07-01 19:03:10 +03:00
2010-03-14 21:07:24 +03:00
w2 - > end ( ) ;
2020-01-11 16:51:30 +03:00
Fl_RGB_Image * rgba_icon = new Fl_RGB_Image ( pixmap ) ;
Fl_Window : : default_icon ( rgba_icon ) ;
2020-07-01 19:03:10 +03:00
// w2->icon(rgba_icon);
2020-01-11 16:51:30 +03:00
delete rgba_icon ;
2010-03-14 21:07:24 +03:00
w2 - > show ( argc , argv ) ;
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
Fl : : run ( ) ;
2016-11-30 10:12:29 +03:00
delete pixmap ;
delete b_bitmap . image ( ) ;
2018-05-22 11:39:39 +03:00
delete rgb ;
2020-07-01 19:03:10 +03:00
2011-06-16 19:11:18 +04:00
return 0 ;
2011-01-11 23:52:38 +03:00
}