//-------------------------------------------------------------------------- //! Clear current subpage. Subpages can be set with pladv before //! calling plclear. Not all drivers support this. // void c_plclear( void ) { if ( m_plsc->level < 1 ) { plabort( "plclear: Please call plinit first" ); return; } if ( m_plsc->dev_clear ) plP_esc( PLESC_CLEAR, NULL ); else // driver does not support clear, fill using background color { short x[5], y[5]; int ocolor = m_plsc->icol0; x[0] = x[3] = x[4] = (short) m_plsc->sppxmi; x[1] = x[2] = (short) m_plsc->sppxma; y[0] = y[1] = y[4] = (short) m_plsc->sppymi; y[2] = y[3] = (short) m_plsc->sppyma; plcol0( 0 ); plP_fill( x, y, 5 ); plcol0( ocolor ); } }
static void genlin(short *x, short *y, PLINT npts) { /* Check for solid line */ if (plsc->nms == 0) { if (npts== 2) plP_line(x, y); else plP_polyline(x, y, npts); } /* Right now dashed lines don't use polyline capability -- this should be improved */ else { PLINT i; /* Call escape sequence to draw dashed lines, only for drivers that have this capability */ if (plsc->dev_dash) { plsc->dev_npts = npts; plsc->dev_x = x; plsc->dev_y = y; plP_esc(PLESC_DASH, NULL); return; } for (i = 0; i < npts - 1; i++) { grdashline(x+i, y+i); } } }
GDLWXStream::GDLWXStream( int width, int height ) : GDLGStream( width, height, "wxwidgets") , m_dc(NULL) , m_bitmap(NULL) , m_width(width), m_height(height) , gdlWindow(NULL) { m_dc = new wxMemoryDC(); m_bitmap = new wxBitmap( width, height, -1 ); m_dc->SelectObject( *m_bitmap); if( !m_dc->IsOk()) { m_dc->SelectObject( wxNullBitmap ); delete m_bitmap; delete m_dc; throw GDLException("GDLWXStream: Failed to create DC."); } //::plstream(); // sdev( "wxwidgets" ); spage( 0.0, 0.0, m_width, m_height, 0, 0 ); // SETOPT( "text", "1" ); // use freetype? // SETOPT( "smooth", "1" ); // antialiased text? this->plstream::init(); plP_esc( PLESC_DEVINIT, (void*)m_dc ); plstream::set_stream(); // plgpls( &thePls); // in GDLGStream }
void c_plxormod(PLINT mode, PLINT *status) /* xor mode */ { static int ostate = 0; if (!plsc->dev_xor) { *status = 0; return; } if (plsc->level > 0) { plP_esc(PLESC_XORMOD, &mode); if (mode) { ostate = plsc->plbuf_write; plsc->plbuf_write = 0; } else plsc->plbuf_write = ostate; } *status = 1; }
void GDLWXStream::SetSize( int width, int height ) { m_dc->SelectObject( wxNullBitmap ); delete m_bitmap; m_bitmap = new wxBitmap( width, height, -1 ); m_dc->SelectObject( *m_bitmap); if( !m_dc->IsOk()) { m_dc->SelectObject( wxNullBitmap ); delete m_bitmap; delete m_dc; throw GDLException("GDLWXStream: Failed to resize DC."); } // plP_esc( PLESC_CLEAR, NULL ); wxSize size = wxSize( width, height); plP_esc( PLESC_RESIZE, (void*)&size); m_width = width; m_height = height; }
static PyObject * pl_partialInitXw(PyObject *self, PyObject *args) { PLINT ipls; PLStream *pls; TRY (PyArg_ParseTuple(args, ":pl_partialInitXw")); ipls=0; plmkstrm(&ipls); printf(" ipls=%d\n",ipls); plgpls(&pls); /* pls points directly to a structure PLStream */ printf(" pls OK \n"); /* Partially initialize X driver. */ pllib_init(); plsdev("xwin"); pllib_devinit(); plP_esc(PLESC_DEVINIT, NULL); printf("devinit OK \n"); return Py_BuildValue("i", ipls); }
//-------------------------------------------------------------------------- //! Wait for graphics input event and translate to world coordinates. //! //! @author Paul Casteels. //! @param plg Pointer to PLGraphicsIn //! @return 0 if no translation to world coordinates is possible. //! @see PLGraphicsIn //! int plGetCursor( PLGraphicsIn *plg ) { plP_esc( PLESC_GETC, plg ); return plTranslateCursor( plg ); }
void pl_cmd(PLINT op, void *ptr) { plP_esc(op, ptr); }
void c_pltext(void) { if (plsc->level > 0) plP_esc(PLESC_TEXT, NULL); }
void c_plgra(void) { if (plsc->level > 0) plP_esc(PLESC_GRAPH, NULL); }
void GDLWXStream::RenewPlot() { plP_esc( PLESC_CLEAR, NULL ); replot(); }
static void plhrsh(PLINT ch, PLINT x, PLINT y) { EscText args; int idx; PLUNICODE unicode_char; /* Check to see if the device understands unicode and wants to draw * symbols. */ if ((plsc->dev_text)&&(plsc->dev_unicode)&&(!plsc->dev_hrshsym)) { idx=plhershey2unicode(ch); /* Get the index in the lookup table */ unicode_char=hershey_to_unicode_lookup_table[idx].Unicode; /* * Test to see if there is a defined unicode glyph for this hershey code; * if there isn't, then we pass the glyph to plhersh, and have it * rendered the old fashioned way. * Otherwise, we let the driver render it as unicode */ if ((unicode_char==0)||(idx==-1)) { #ifndef TEST_FOR_MISSING_GLYPHS plhrsh2(ch, x, y); #endif } else { PLUNICODE plhrsh_unicode_buffer[3], fci; PLFLT xform[] = {1.0, 0.0, 0.0, 1.0}; char esc; args.unicode_char=unicode_char; args.font_face=hershey_to_unicode_lookup_table[idx].Font; args.base = 1; args.just = .5; args.xform = 0; args.x = x; args.y = y; args.string=NULL; /* Since we are using unicode, we want this to be NULL */ /* "array method" */ plgesc(&esc); args.xform = xform; args.unicode_array_len=2; /* Temporary Symbol font for every character. */ plgfci(&fci); plP_hex2fci(PL_FCI_SYMBOL, PL_FCI_FAMILY, &fci); plhrsh_unicode_buffer[0] = fci; plhrsh_unicode_buffer[1] = unicode_char; /* watch out for escape character and unescape it by appending * one extra. */ if (unicode_char == esc) { args.unicode_array_len=3; plhrsh_unicode_buffer[2] = unicode_char; } /* No need to change font back since only one character. */ args.unicode_array=&plhrsh_unicode_buffer[0]; /* Get address of the unicode buffer (even though it is currently static) */ plP_esc(PLESC_HAS_TEXT, &args); } } else { plhrsh2(ch, x, y); } }