Fl_Offscreen

15 views
Skip to first unread message

holm.h...@gmail.com

unread,
Oct 3, 2021, 4:09:43 AM10/3/21
to fltk.general

Hello,

I want to draw using Fl_Offscreen, doing something like:
{
  Fl_Offscreen oscr = fl_create_offscreen(120, 120);

  fl_begin_offscreen(oscr);
  fl_color(FL_BLACK);
  fl_rectf(0, 0, 120, 120);
  fl_color(FL_WHITE);
  fl_rectf(-10, -10, 100, 100);
  fl_end_offscreen();
 
  // print offscreen color at (10, 10)
  fl_delete_offscreen(oscr);
}

Two questions:
1) At the end of this code I want check the color of a given point. How can I do that?
2) I write to outside the pixmap (fl_rectf(-10, -10, 100, 100)), is that ok ?

Best regards
Håvard

holm.h...@gmail.com

unread,
Oct 3, 2021, 4:34:34 AM10/3/21
to fltk.general
Answer to first question is to use
     data_p = fl_read_image(data_p, 0, 0, 120, 120, 0);

What about second question ? Same question for drawing with eg. fl_begin_complex_polygon()

Best regards
Håvard

Ian MacArthur

unread,
Oct 4, 2021, 1:55:17 PM10/4/21
to Fltk General
On 3 Oct 2021, at 09:34, holm.haavard wrote:
>
>
> What about second question ? Same question for drawing with eg. fl_begin_complex_polygon()
>

This is about clipping? I think at least with fltk-1.4, that should just work, probably also with fltk-1.3...
The actual mechanisms changed somewhat between 1.3 and 1.4, and 1.4 should behave pretty much like any drawing surface, whereas 1.3 had some “peculiarities” - notably, some GL drivers would not draw to the “old” offscreen, but so far I’ve not had any problems with 1.4, at least not in that area!

Might be best to just give it a try and see what actually happens!




Reply all
Reply to author
Forward
0 new messages