FLTK logo

Re: Accessing the draw() buffer

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Accessing the draw() buffer "MacArthur, Ian (SELEX GALILEO, UK)" Mar 18, 2008  
 

> Is there any (undocumented) method that I can use to access 
> the buffer that draw() or its methods (addvertex, fillpath, 
> etc..) so that, once I've  completed my drawing, I could copy 
> that buffer? I need to make a movie of my GUI for my 
> customer, and I'd prefer not to have to recreate the drawing 
> method again with a different API. Thanks!

You can read back the image that draw() creates by using the function:

uchar *fl_read_image(uchar *p, int X, int Y, int W, int H, int alpha =
0);

Which is a documented function, as it happens.

However, reading back from an on-screen buffer can be fraught with
difficulties, as that will read everything in the rectangle mapped for
your window, which may (or may not) have been overlayed by other
window's areas by the window manager (that fltk will not know about...)

You may be better compositing your image in an off-screen buffer, then
blitting that composited image to the display (and using fl_read_image()
on the offscreen to get your screen grabs too, of course.) See
fl_create_offscreen(...) et al in the docs for some description of using
this approach.

-- 
Ian








SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.