Exemplo n.º 1
0
void CairoBox::draw(void) 
  {
  // using fltk functions, set up white background with thin black frame
  fl_push_no_clip();            /* remove any clipping region set by the expose events... */
  fl_push_clip(x(), y(), w(), h());
  fl_color(FL_WHITE);
  fl_rectf(x(), y(), w(), h());
  fl_color(FL_BLACK);
  fl_rect(x(), y(), w(), h());

  // set up cairo structures
  surface = set_surface(w(), h());
  cr      = cairo_create(surface);
  /* All Cairo co-ordinates are shifted by 0.5 pixels to correct anti-aliasing */
  cairo_translate(cr, 0.5, 0.5);
  cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); // set drawing color to black
  cairo_new_path(cr);

  // virtual function defined in driver program
  graphic(cr, x(), y(), w(), h());

  // release the cairo context
  cairo_destroy(cr);
  cairo_surface_destroy(surface);
//  cr = NULL;

  // remove clip regions
  fl_pop_clip();                          // local clip region
  fl_pop_clip();                          // "no_clip" region
  }
Exemplo n.º 2
0
//extern Fl_Ext * fl_ext;
void Fl_Gdi::draw(Fl_Widget * w)
{
    Fl_Device *t = fl_current_dev;
    fl_current_dev = this;
    Fl::flush(); // cleaning ...
    HDC o = fl_gc;
    fl_gc = gc_;
    SelectClipRgn(fl_gc, 0);
    fl_push_no_clip(); //i am not sure why, but it is required...
    w->redraw(); // making dirty
    w->draw();
    fl_pop_clip();
    fl_gc = o;
    fl_current_dev = t;
}
Exemplo n.º 3
0
 FL_EXPORT_C(void,flc_push_no_clip)( ){
   fl_push_no_clip();
 }