void _app_draw( void ) { int i; canvas_begin_draw(); // Draw drawings drawing_draw(); // Draw cartesian if user wants it if ( menu_panels[ 0 ].focus ) { canvas_draw_cartesian( CARTESIAN_ABSIS_COLOR, CARTESIAN_COLOR ); } // Draw rotation/shearing center if it's active if ( menu_panels[ 2 ].focus ) { canvas_draw_rotation_center(); } else if ( menu_panels[ 3 ].focus ) { canvas_draw_shearing_center(); } // Draw menu panels for ( i = 0; i < NUM_MENU; i++ ) { app_draw_panel( menu_panels[ i ] ); } // Draw menu icons // 1 - CARTESIAN if ( menu_panels[ 0 ].focus ) { canvas_draw_line( 20, 16, 44, 16, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 32, 5, 32, 27, MENU_FONT_COLOR_FOCUS ); canvas_draw_rectangle( 25, 10, 39, 22, MENU_FONT_COLOR_FOCUS, -1 ); } else { canvas_draw_line( 20, 16, 44, 16, MENU_FONT_COLOR ); canvas_draw_line( 32, 5, 32, 27, MENU_FONT_COLOR ); canvas_draw_rectangle( 25, 10, 39, 22, MENU_FONT_COLOR, -1 ); } // 2 - MOVE if ( menu_panels[ 1 ].focus ) { canvas_draw_line( 80, 16, 85, 11, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 80, 16, 85, 21, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 85, 16, 107, 16, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 107, 11, 112, 16, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 107, 21, 112, 16, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 91, 10, 96, 5, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 96, 5, 101, 10, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 96, 5, 96, 27, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 91, 22, 96, 27, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 96, 27, 101, 22, MENU_FONT_COLOR_FOCUS ); } else { canvas_draw_line( 80, 16, 85, 11, MENU_FONT_COLOR ); canvas_draw_line( 80, 16, 85, 21, MENU_FONT_COLOR ); canvas_draw_line( 85, 16, 107, 16, MENU_FONT_COLOR ); canvas_draw_line( 107, 11, 112, 16, MENU_FONT_COLOR ); canvas_draw_line( 107, 21, 112, 16, MENU_FONT_COLOR ); canvas_draw_line( 91, 10, 96, 5, MENU_FONT_COLOR ); canvas_draw_line( 96, 5, 101, 10, MENU_FONT_COLOR ); canvas_draw_line( 96, 5, 96, 27, MENU_FONT_COLOR ); canvas_draw_line( 91, 22, 96, 27, MENU_FONT_COLOR ); canvas_draw_line( 96, 27, 101, 22, MENU_FONT_COLOR ); } // 3 - ROTATE if ( menu_panels[ 2 ].focus ) { canvas_draw_ellipse( 160, 16, 10, 10, MENU_FONT_COLOR_FOCUS ); canvas_draw_rectangle( 150, 6, 160, 20, MENU_COLOR_FOCUS, MENU_COLOR_FOCUS ); canvas_draw_line( 160, 6, 165, 1, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 160, 6, 165, 11, MENU_FONT_COLOR_FOCUS ); } else { canvas_draw_ellipse( 160, 16, 10, 10, MENU_FONT_COLOR ); canvas_draw_rectangle( 150, 6, 160, 20, MENU_COLOR, MENU_COLOR ); canvas_draw_line( 160, 6, 165, 1, MENU_FONT_COLOR ); canvas_draw_line( 160, 6, 165, 11, MENU_FONT_COLOR ); } // 4 - SKEW if ( menu_panels[ 3 ].focus ) { canvas_draw_line( 237, 3, 242, 8, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 220, 8, 242, 8, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 220, 12, 207, 27, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 207, 27, 229, 27, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 229, 27, 242, 12, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 242, 12, 220, 12, MENU_FONT_COLOR_FOCUS ); } else { canvas_draw_line( 237, 3, 242, 8, MENU_FONT_COLOR ); canvas_draw_line( 220, 8, 242, 8, MENU_FONT_COLOR ); canvas_draw_line( 220, 12, 207, 27, MENU_FONT_COLOR ); canvas_draw_line( 207, 27, 229, 27, MENU_FONT_COLOR ); canvas_draw_line( 229, 27, 242, 12, MENU_FONT_COLOR ); canvas_draw_line( 242, 12, 220, 12, MENU_FONT_COLOR ); } // 5 - ZOOM IN if ( menu_panels[ 4 ].focus ) { canvas_draw_line( 277, 16, 299, 16, MENU_FONT_COLOR_FOCUS ); canvas_draw_line( 288, 5, 288, 27, MENU_FONT_COLOR_FOCUS ); } else { canvas_draw_line( 277, 16, 299, 16, MENU_FONT_COLOR ); canvas_draw_line( 288, 5, 288, 27, MENU_FONT_COLOR ); } // 6 - ZOOM OUT if ( menu_panels[ 5 ].focus ) { canvas_draw_line( 341, 16, 363, 16, MENU_FONT_COLOR_FOCUS ); } else { canvas_draw_line( 341, 16, 363, 16, MENU_FONT_COLOR ); } // 7 - COLOR PALLETE for ( i = 0; i < 16; i++ ) { if ( i < 8 ) { if ( chosen_color == i ) { canvas_draw_rectangle( 384 + 32 * i, 1, 384 + 32 * ( i + 1 ), 16, MENU_FONT_COLOR_FOCUS, i ); } else { canvas_draw_rectangle( 384 + 32 * i, 1, 384 + 32 * ( i + 1 ), 16, MENU_FONT_COLOR, i ); } } else { if ( chosen_color == i ) { canvas_draw_rectangle( 384 + 32 * ( i - 8 ), 16, 384 + 32 * ( i + 1 - 8 ), 31, MENU_FONT_COLOR_FOCUS, i ); } else { canvas_draw_rectangle( 384 + 32 * ( i - 8 ), 16, 384 + 32 * ( i + 1 - 8 ), 31, MENU_FONT_COLOR, i ); } } canvas_draw_line( 384, 31, 640, 31, 0 ); } // Draw side panels for ( i = 0; i < NUM_SIDE; i++ ) { app_draw_panel( side_panels[ i ] ); } // Draw side icons // 1 - SELECT // 2 - LINE if ( side_panels[ 1 ].focus ) { canvas_draw_line( 10, 150, 54, 106, PANEL_FONT_COLOR_FOCUS ); } else { canvas_draw_line( 10, 150, 54, 106, PANEL_FONT_COLOR ); } // 3 - CURVE /*if ( side_panels[ 2 ].focus ) { int arrayX[4]; int arrayY[4]; arrayX[0] = 10; arrayX[1] = 24; arrayX[2] = 40; arrayX[3] = 54; arrayY[0] = 192; arrayY[1] = 150; arrayY[2] = 230; arrayY[3] = 192; canvas_draw_bezier( arrayX, arrayY, PANEL_FONT_COLOR_FOCUS ); } else { int arrayX[4]; int arrayY[4]; arrayX[0] = 10; arrayX[1] = 24; arrayX[2] = 40; arrayX[3] = 54; arrayY[0] = 192; arrayY[1] = 150; arrayY[2] = 230; arrayY[3] = 192; canvas_draw_bezier( arrayX, arrayY, PANEL_FONT_COLOR ); }*/ // 4 - ELLIPSE if ( side_panels[ 3 ].focus ) { canvas_draw_ellipse_mouse( 32, 256, 57, 272, PANEL_FONT_COLOR_FOCUS ); //canvas_draw_ellipse( 32, 256, 25, 16, PANEL_FONT_COLOR_FOCUS ); } else { canvas_draw_ellipse_mouse( 32, 256, 57, 272, PANEL_FONT_COLOR ); //canvas_draw_ellipse( 32, 256, 25, 16, PANEL_FONT_COLOR ); } // 5 - POLYGON if ( side_panels[ 4 ].focus ) { canvas_draw_line( 20, 298, 44, 298, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 44, 298, 54, 320, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 54, 320, 44, 342, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 20, 342, 44, 342, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 20, 342, 10, 320, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 10, 320, 20, 298, PANEL_FONT_COLOR_FOCUS ); } else { canvas_draw_line( 44, 298, 54, 320, PANEL_FONT_COLOR ); canvas_draw_line( 20, 298, 44, 298, PANEL_FONT_COLOR ); canvas_draw_line( 54, 320, 44, 342, PANEL_FONT_COLOR ); canvas_draw_line( 20, 342, 44, 342, PANEL_FONT_COLOR ); canvas_draw_line( 20, 342, 10, 320, PANEL_FONT_COLOR ); canvas_draw_line( 10, 320, 20, 298, PANEL_FONT_COLOR ); } // 6 - FILL if ( side_panels[ 5 ].focus ) { canvas_draw_line( 20, 372, 44, 367, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 20, 382, 44, 377, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 20, 392, 44, 387, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 20, 402, 44, 397, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 20, 372, 20, 402, PANEL_FONT_COLOR_FOCUS ); canvas_draw_line( 44, 367, 44, 397, PANEL_FONT_COLOR_FOCUS ); //canvas_fill( 30, 393, BLUE, BLACK ); } else { canvas_draw_line( 20, 372, 44, 367, PANEL_FONT_COLOR ); canvas_draw_line( 20, 382, 44, 377, PANEL_FONT_COLOR ); canvas_draw_line( 20, 392, 44, 387, PANEL_FONT_COLOR ); canvas_draw_line( 20, 402, 44, 397, PANEL_FONT_COLOR ); canvas_draw_line( 20, 372, 20, 402, PANEL_FONT_COLOR ); canvas_draw_line( 44, 367, 44, 397, PANEL_FONT_COLOR ); //canvas_fill( 30, 393, BLUE, BLACK ); } // 7 - CROP canvas_end_draw(); return; }
/** Dibuja la imagen en la ventana */ static gboolean draw(GtkWidget* widget, cairo_t* cr, gpointer data) { return drawing_draw(cr, data); }