From: <hez...@us...> - 2011-05-17 22:16:36
|
Revision: 11751 http://plplot.svn.sourceforge.net/plplot/?rev=11751&view=rev Author: hezekiahcarty Date: 2011-05-17 22:16:30 +0000 (Tue, 17 May 2011) Log Message: ----------- Add drawing mode setting and getting support (no driver support yet) These two new functions allow a user to specify different drawing modes, such as replacing the current plot content with the drawing color, even if the drawing color is transparent (SOURCE in Cairo) or XOR drawing. This is only intended to be supported by output devices which support these operations directly. At least Cairo and Qt support the modes included in this commit, along with several others. Modified Paths: -------------- trunk/include/plplot.h trunk/include/plstrm.h trunk/src/plctrl.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2011-05-16 20:35:36 UTC (rev 11750) +++ trunk/include/plplot.h 2011-05-17 22:16:30 UTC (rev 11751) @@ -236,6 +236,8 @@ #define PLESC_END_RASTERIZE 33 // end rasterized rendering #define PLESC_ARC 34 // render an arc #define PLESC_GRADIENT 35 // render a gradient +#define PLESC_MODESET 36 // set drawing mode +#define PLESC_MODEGET 37 // get drawing mode // Alternative unicode text handling control characters #define PLTEXT_FONTCHANGE 0 // font change in the text stream @@ -667,6 +669,7 @@ #define plgdidev c_plgdidev #define plgdiori c_plgdiori #define plgdiplt c_plgdiplt +#define plgdrawmode c_plgdrawmode #define plgfam c_plgfam #define plgfci c_plgfci #define plgfnam c_plgfnam @@ -762,6 +765,7 @@ #define plsmem c_plsmem #define plsmema c_plsmema #define plsmin c_plsmin +#define plsdrawmode c_plsdrawmode #define plsori c_plsori #define plspage c_plspage #define plspal0 c_plspal0 @@ -1085,6 +1089,11 @@ PLDLLIMPEXP void c_plgdiplt( PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax ); +// Get the drawing mode + +PLDLLIMPEXP PLINT +c_plgdrawmode(); + // Get FCI (font characterization integer) PLDLLIMPEXP void @@ -1258,6 +1267,12 @@ #define PL_COLORBAR_ORIENT_LEFT 8192 #define PL_COLORBAR_ORIENT_BOTTOM 16384 +// Flags for drawing mode +#define PL_MODE_UNKNOWN 0 +#define PL_MODE_DEFAULT 1 +#define PL_MODE_REPLACE 2 +#define PL_MODE_XOR 4 + // Routine for drawing discrete line, symbol, or cmap0 legends PLDLLIMPEXP void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, @@ -1737,6 +1752,10 @@ PLDLLIMPEXP void c_plsmin( PLFLT def, PLFLT scale ); +// Set the drawing mode +PLDLLIMPEXP void +c_plsdrawmode( PLINT mode ); + // Set orientation. Must be done before calling plinit. PLDLLIMPEXP void Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2011-05-16 20:35:36 UTC (rev 11750) +++ trunk/include/plstrm.h 2011-05-17 22:16:30 UTC (rev 11751) @@ -793,6 +793,9 @@ PLFLT string_length; PLINT get_string_length; PLINT dev_eofill; + + // Drawing mode section + PLINT dev_modeset; } PLStream; //-------------------------------------------------------------------------- Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2011-05-16 20:35:36 UTC (rev 11750) +++ trunk/src/plctrl.c 2011-05-17 22:16:30 UTC (rev 11751) @@ -8,6 +8,7 @@ // Copyright (C) 2004 Rafael Laboissiere // Copyright (C) 2008 Hazen Babcock // Copyright (C) 2009 Alan W. Irwin +// Copyright (C) 2011 Hezekiah M. Carty // // This file is part of PLplot. // @@ -1820,6 +1821,57 @@ } //-------------------------------------------------------------------------- +//! Set drawing mode (depends on device support!) +//! +//! @param mode This determines which drawing mode to use. +//! +void +c_plsdrawmode( PLINT mode ) +{ + if ( !plsc->dev_modeset ) + { + plwarn( "plsdrawmode: Mode setting is not supported" ); + } + else if ( plsc->level > 0 ) + { + plP_esc( PLESC_MODESET, &mode ); + } + else + { + plwarn( "plsdrawmode: Initialize PLplot first" ); + } + return; +} + +//-------------------------------------------------------------------------- +//! Get drawing mode (depends on device support!) +//! +//! @returns Current drawing mode +//! +PLINT +c_plgdrawmode() +{ + PLINT mode; + + if ( !plsc->dev_modeset ) + { + plwarn( "plgdrawmode: Mode getting is not supported" ); + mode = PL_MODE_UNKNOWN; + } + else if ( plsc->level > 0 ) + { + plP_esc( PLESC_MODEGET, &mode ); + } + else + { + plwarn( "plsdrawmode: Initialize PLplot first" ); + mode = PL_MODE_UNKNOWN; + } + + return( mode ); +} + +//-------------------------------------------------------------------------- // void pltext() // // Switches to text screen. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |