static PyObject * pl_resize(PyObject *self, PyObject *args) { int width, height ; PLDisplay pldis; TRY (PyArg_ParseTuple(args, "ii:resize", &width, &height)); pldis.width=width; pldis.height=height; pl_cmd(PLESC_RESIZE, (void *) &(pldis)); pl_cmd(PLESC_EXPOSE, (void *) NULL); Py_INCREF(Py_None); return Py_None; }
void setup_plot_drawable( App *a ) { struct { Display *display; Drawable drawable; } xinfo; PLFLT x[3] = { 1, 3, 4 }; PLFLT y[3] = { 3, 2, 5 }; plsdev( "xcairo" ); plsetopt( "drvopt", "external_drawable" ); plinit(); #if TO_PIXMAP == 1 // Here we set up to draw to a pixmap xinfo.display = GDK_PIXMAP_XDISPLAY( a->plotwindow_pixmap ); xinfo.drawable = GDK_PIXMAP_XID( a->plotwindow_pixmap ); #else // Alternatively, we can do direct to a visible X Window xinfo.display = GDK_WINDOW_XDISPLAY( a->plotwindow->window ); xinfo.drawable = GDK_WINDOW_XID( a->plotwindow->window ); #endif pl_cmd( PLESC_DEVINIT, &xinfo ); plenv( 0, 5, 0, 5, 0, 0 ); plline( 3, x, y ); plend(); }
static PyObject * pl_expose(PyObject *self, PyObject *args) { TRY (PyArg_ParseTuple(args, ":expose")); pl_cmd(PLESC_EXPOSE, (void *) NULL); Py_INCREF(Py_None); return Py_None; }
int main( int argc, const char *argv[] ) { cairo_surface_t *cairoSurface; cairo_t *cairoContext; cairoSurface = cairo_ps_surface_create( "ext-cairo-test.ps", 720, 540 ); cairoContext = cairo_create( cairoSurface ); plparseopts( &argc, argv, PL_PARSE_FULL ); plsdev( "extcairo" ); plinit(); pl_cmd( PLESC_DEVINIT, cairoContext ); plenv( 0.0, 1.0, 0.0, 1.0, 1, 0 ); pllab( "x", "y", "title" ); plend(); cairo_destroy( cairoContext ); cairo_surface_destroy( cairoSurface ); exit( 0 ); }
value ml_set_plplot_cairo_context( value context ) { CAMLparam1( context ); pl_cmd( PLESC_DEVINIT, cairo_t_val( context ) ); CAMLreturn( Val_unit ); }