| [ Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File | SVN ⇄ GIT ]
STR #2354
Application: | FLTK Library |
Status: | 5 - New |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Unassigned |
Summary: | Offscreen and off target. |
Version: | 2.0-feature |
Created By: | rainbowsally |
Assigned To: | Unassigned |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]
Trouble Report Comments:
[ Post Text ]
|
#1 | rainbowsally 21:40 Apr 27, 2010 |
| First of all, it was me that was off target. Once again FLTK's solution was better than mine.
While looking for the best place to make pngImage load the same way that xpmImage does I discovered that even raw data needs a name (unique, text).
Sooooo... The reason the xpmImages load differently is for back compatibility.
And the reason the data needs names is so it can be looked up, even in a "shared" library, and it won't have to be loaded from file again. But I have two recommendations still. One in the SharedImage.cxx file (where it won't change the interface) and the other in the docs.
{.}}
In src/SharedImage.cxx ------> around line 33 add...
#include <fltk/error.h> Around line 170 add... if(!name) fatal("Can't load/find 'unnamed' SharedImage data");
In src/Image.cxx around line 83 following (and keeping) this. There are a number of subclasses such as jpgImage and pngImage that display compressed image data, either from in-memory data buffers or from files. add this.
Note: Even shared image data data loaded from memory needs a name that can be looked up. It can be any unique text that identifies the image. In that file it will get included in the docs next time Doxygen updates the docs. Other news. Offscreen for X. X users! Need offscreen for version 2? Try this. (If it doesn't work see my note at the bottom.) //#include "<fltk/offscreen.h> <-- headers for the following
using namespace fltk;
typedef ulong Offscreen; <- declare this in the header (in the namespace)
void create_offscreen(uint w, uint h) { XCreatePixmap(fltk::xdisplay, fltk::xwindow, w, h, fltk::xvisual->depth); }
static XWindow _sw;
void fl_begin_offscreen(XWindow pixmap) { _sw=fltk::xwindow; fltk::xwindow=pixmap; fltk::push_no_clip(); } void fl_end_offscreen() { fltk::pop_clip(); fltk::xwindow = _sw; }
void fl_copy_offscreen(uint x, uint y, uint w, uint h, XWindow pixmap, uint srcx, uint srcy) { XCopyArea(fltk::xdisplay, pixmap, fltk::xwindow, fltk::gc, srcx, srcy, w, h, x, y); }
void fl_delete_offscreen(XWindow pixmap) { XFreePixmap(fltk::xdisplay, pixmap); }
============== If this doesn't work it may be because we need a better way to work around X in x11.h. I'll include a copy of mine. Long story short, an X "Window" IS an XID. Works great.
I THINK this is all that needs to be changed, but my other posts may have gotten lost in the "bugs" forum. And these may get lost here... I really wonder if it's a good idea to keep this stuff sorta private. | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |