From: <hba...@us...> - 2012-11-17 22:49:41
|
Revision: 12275 http://plplot.svn.sourceforge.net/plplot/?rev=12275&view=rev Author: hbabcock Date: 2012-11-17 22:49:34 +0000 (Sat, 17 Nov 2012) Log Message: ----------- Add a EPS driver to the Cairo family. On by default since this seemed pretty straight-forward.. Fix a typo in the README.drivers file. Modified Paths: -------------- trunk/cmake/modules/cairo.cmake trunk/cmake/modules/drivers-init.cmake trunk/drivers/README.drivers trunk/drivers/cairo.c trunk/drivers/cairo.driver_info.in trunk/examples/plplot_configure.cmake_installed_examples.in trunk/include/drivers.h trunk/include/plDevs.h.cmake trunk/include/plcore.h trunk/plplot_test/plplot-test.sh.cmake Modified: trunk/cmake/modules/cairo.cmake =================================================================== --- trunk/cmake/modules/cairo.cmake 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/cmake/modules/cairo.cmake 2012-11-17 22:49:34 UTC (rev 12275) @@ -27,6 +27,7 @@ # PLD_pdfcairo - ON means the pdfcairo device is enabled. # PLD_pngcairo - ON means the pngcairo device is enabled. # PLD_pscairo - ON means the pscairo device is enabled. +# PLD_epscairo - ON means the epscairo device is enabled. # PLD_svgcairo - ON means the svgcairo device is enabled. # PLD_xcairo - ON means the xcairo device is enabled. # PLD_wincairo - ON means the wincairo device is enabled. @@ -53,6 +54,7 @@ OR PLD_pdfcairo OR PLD_pngcairo OR PLD_pscairo + OR PLD_epscairo OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo @@ -66,6 +68,7 @@ set(PLD_pdfcairo OFF CACHE BOOL "Enable pdfcairo device" FORCE) set(PLD_pngcairo OFF CACHE BOOL "Enable pngcairo device" FORCE) set(PLD_pscairo OFF CACHE BOOL "Enable pscairo device" FORCE) + set(PLD_epscairo OFF CACHE BOOL "Enable epscairo device" FORCE) set(PLD_svgcairo OFF CACHE BOOL "Enable svgcairo device" FORCE) set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE) set(PLD_extcairo OFF CACHE BOOL "Enable extcairo device" FORCE) @@ -76,6 +79,7 @@ OR PLD_pdfcairo OR PLD_pngcairo OR PLD_pscairo + OR PLD_epscairo OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo @@ -87,6 +91,7 @@ OR PLD_pdfcairo OR PLD_pngcairo OR PLD_pscairo + OR PLD_epscairo OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo @@ -148,6 +153,7 @@ set(PLD_pdfcairo OFF CACHE BOOL "Enable pdfcairo device" FORCE) set(PLD_pngcairo OFF CACHE BOOL "Enable pngcairo device" FORCE) set(PLD_pscairo OFF CACHE BOOL "Enable pscairo device" FORCE) + set(PLD_epscairo OFF CACHE BOOL "Enable epscairo device" FORCE) set(PLD_svgcairo OFF CACHE BOOL "Enable svgcairo device" FORCE) set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE) set(PLD_extcairo OFF CACHE BOOL "Enable extcairo device" FORCE) @@ -158,6 +164,7 @@ OR PLD_pdfcairo OR PLD_pngcairo OR PLD_pscairo + OR PLD_epscairo OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo Modified: trunk/cmake/modules/drivers-init.cmake =================================================================== --- trunk/cmake/modules/drivers-init.cmake 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/cmake/modules/drivers-init.cmake 2012-11-17 22:49:34 UTC (rev 12275) @@ -132,6 +132,7 @@ "pdfcairo:cairo:ON:F:OFF" "pngcairo:cairo:ON:F:ON" "pscairo:cairo:ON:F:OFF" + "epscairo:cairo:ON:F:ON" "svgcairo:cairo:ON:F:ON" "xcairo:cairo:ON:I:OFF" "wincairo:cairo:ON:I:OFF" Modified: trunk/drivers/README.drivers =================================================================== --- trunk/drivers/README.drivers 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/drivers/README.drivers 2012-11-17 22:49:34 UTC (rev 12275) @@ -29,7 +29,7 @@ This should be the exact duplicate of the corresponding entry in the driver source code for plD_DEVICE_INFO_<driver>. -2. Add the following line to plplot_cmake/modules/drivers-init.cmake in +2. Add the following line to plplot/cmake/modules/drivers-init.cmake in set(DRIVERS_DEVICE_LIST... "<dev>:<driver>:ON:<kind>:<familied>" Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/drivers/cairo.c 2012-11-17 22:49:34 UTC (rev 12275) @@ -167,6 +167,9 @@ #if defined ( PLD_wincairo ) "wincairo:Cairo Microscoft Windows Driver:0:cairo:107:wincairo\n" #endif +#if defined ( PLD_epscairo ) + "epscairo:Cairo EPS Driver:0:cairo:108:epscairo\n" +#endif ; // @@ -2256,6 +2259,110 @@ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // +// That which is specific to the cairo EPS driver. +// +//-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- + +#if defined ( PLD_epscairo ) + +void plD_dispatch_init_epscairo( PLDispatchTable *pdt ); +void plD_init_epscairo( PLStream * ); + +//-------------------------------------------------------------------------- +// dispatch_init_init() +// +// Initialize device dispatch table +//-------------------------------------------------------------------------- + +// epscairo +void plD_dispatch_init_epscairo( PLDispatchTable *pdt ) +{ +#ifndef ENABLE_DYNDRIVERS + pdt->pl_MenuStr = "Cairo EPS Driver"; + pdt->pl_DevName = "epscairo"; +#endif + pdt->pl_type = plDevType_FileOriented; + pdt->pl_seq = 102; + pdt->pl_init = (plD_init_fp) plD_init_epscairo; + pdt->pl_line = (plD_line_fp) plD_line_cairo; + pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; + pdt->pl_eop = (plD_eop_fp) plD_eop_cairo; + pdt->pl_bop = (plD_bop_fp) plD_bop_famcairo; + pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cairo; + pdt->pl_state = (plD_state_fp) plD_state_cairo; + pdt->pl_esc = (plD_esc_fp) plD_esc_cairo; +} + +//-------------------------------------------------------------------------- +// plD_init_epscairo() +// +// Initialize Cairo EPS device +//-------------------------------------------------------------------------- + +void plD_init_epscairo( PLStream *pls ) +{ + PLCairo *aStream; + + // Setup the PLStream and the font lookup table and allocate a cairo + // stream structure. + // + // NOTE: The check below is necessary since, in family mode, this function + // will be called multiple times. While you might think that it is + // sufficient to update what *should* be the only pointer to the contents + // of pls->dev, i.e. the pointer pls->dev itself, it appears that + // something else somewhere else is also pointing to pls->dev. If you + // change what pls->dev points to then you will get a "bus error", from + // which I infer the existence of said bad stale pointer. + // + if ( pls->dev == NULL ) + { + aStream = stream_and_font_setup( pls, 0 ); + } + else + { + stream_and_font_setup( pls, 0 ); + aStream = pls->dev; + } + + // Initialize family file info + plFamInit( pls ); + + // Prompt for a file name if not already set. + plOpenFile( pls ); + + // Create an cairo surface & context for EPS file. + // Dimension units are pts = 1/72 inches from cairo documentation. + aStream->cairoSurface = cairo_ps_surface_create_for_stream( (cairo_write_func_t) write_to_stream, pls->OutFile, (double) pls->ylength, (double) pls->xlength ); + aStream->cairoContext = cairo_create( aStream->cairoSurface ); + + // Set the PS surface to be EPS. + cairo_ps_surface_set_eps ( aStream->cairoSurface , 1 ); + + // Save the pointer to the structure in the PLplot stream + pls->dev = aStream; + + // Handle portrait or landscape + if ( pls->portrait ) + { + plsdiori( 1 ); + pls->freeaspect = 1; + } + rotate_cairo_surface( pls, 0.0, -1.0, -1.0, 0.0, (float) pls->ylength, (float) pls->xlength, FALSE ); + + // Set fill rule for the case of self-intersecting boundaries. + if ( pls->dev_eofill ) + cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); + else + cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); +} + +#endif + + +//-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// // That which is specific to the cairo SVG driver. // //-------------------------------------------------------------------------- Modified: trunk/drivers/cairo.driver_info.in =================================================================== --- trunk/drivers/cairo.driver_info.in 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/drivers/cairo.driver_info.in 2012-11-17 22:49:34 UTC (rev 12275) @@ -6,3 +6,4 @@ memcairo:Cairo Memory Driver:0:cairo:105:memcairo extcairo:Cairo External Context Driver:0:cairo:106:extcairo wincairo:Cairo Microscoft Windows Driver:0:cairo:107:wincairo +epscairo:Cairo EPS Driver:0:cairo:108:epscairo Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2012-11-17 22:49:34 UTC (rev 12275) @@ -167,6 +167,7 @@ set(PLD_pdfcairo @PLD_pdfcairo@) set(PLD_pngcairo @PLD_pngcairo@) set(PLD_pscairo @PLD_pscairo@) +set(PLD_epscairo @PLD_epscairo@) set(PLD_svgcairo @PLD_svgcairo@) set(PLD_cgm @PLD_cgm@) set(PLD_dg300 @PLD_dg300@) Modified: trunk/include/drivers.h =================================================================== --- trunk/include/drivers.h 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/include/drivers.h 2012-11-17 22:49:34 UTC (rev 12275) @@ -93,6 +93,7 @@ PLDLLIMPEXP_DRIVER void plD_dispatch_init_xcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdfcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pscairo( PLDispatchTable *pdt ); +PLDLLIMPEXP_DRIVER void plD_dispatch_init_epscairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_svgcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pngcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_memcairo( PLDispatchTable *pdt ); Modified: trunk/include/plDevs.h.cmake =================================================================== --- trunk/include/plDevs.h.cmake 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/include/plDevs.h.cmake 2012-11-17 22:49:34 UTC (rev 12275) @@ -81,6 +81,7 @@ #cmakedefine PLD_xcairo #cmakedefine PLD_pdfcairo #cmakedefine PLD_pscairo +#cmakedefine PLD_epscairo #cmakedefine PLD_svgcairo #cmakedefine PLD_pngcairo #cmakedefine PLD_memcairo Modified: trunk/include/plcore.h =================================================================== --- trunk/include/plcore.h 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/include/plcore.h 2012-11-17 22:49:34 UTC (rev 12275) @@ -285,6 +285,9 @@ #if defined ( PLD_pscairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pscairo, #endif +#if defined ( PLD_epscairo ) && !defined ( ENABLE_DYNDRIVERS ) + plD_dispatch_init_epscairo, +#endif #if defined ( PLD_svgcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_svgcairo, #endif Modified: trunk/plplot_test/plplot-test.sh.cmake =================================================================== --- trunk/plplot_test/plplot-test.sh.cmake 2012-11-17 17:34:42 UTC (rev 12274) +++ trunk/plplot_test/plplot-test.sh.cmake 2012-11-17 22:49:34 UTC (rev 12275) @@ -310,6 +310,7 @@ # special case PLD_psc=@PLD_ps@ PLD_pscairo=@PLD_pscairo@ +PLD_epscairo=@PLD_epscairo@ PLD_pstex=@PLD_pstex@ PLD_psttf=@PLD_psttf@ # special case This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |