| [ Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File ]
STR #2327
Application: | FLTK Library |
Status: | 5 - New |
Priority: | 4 - High, e.g. key functionality not working |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Unassigned |
Summary: | image w() and h() bug |
Version: | 2.0-current |
Created By: | gera |
Assigned To: | Unassigned |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]
Trouble Report Comments:
[ Post Text ]
|
#1 | gera 09:52 Mar 04, 2010 |
| when i load a image with:
Image* img = SharedImage::get( "test_image.bmp" );
i get wrong width and height calling img->w() and img->h()
but if i do this:
Image* img = SharedImage::get( "test_image.bmp" ); int w,h; img->_measure(w,h);
now when i call img->w() and img->h() i get right values.
i think this may be an initialization problem... | |
|
#2 | gera 10:06 Mar 04, 2010 |
| System: Win XP 32 Compiler: Mingw | |
|
#3 | bgbnbigben 06:51 Jun 12, 2010 |
| So i'm a little late to the party, but i'm guessing before _measure() the img->w() and img->h() values are 12 and 12? A quick test on my machine got me that, and then digging around the constructor turned up this:
Image(const char* name=0) : Symbol(name), pixeltype_(fltk::RGB32), w_(12), h_(12), picture(0), flags(MEASUREFETCH) {} This actually creates a 12x12 rectangle that still has MEASURE requirements (hence the need to call _measure()).
To be honest, I would be willing to call this constructor broken. There shouldn't ever be a need for a user to be calling a function with either a prefixed or suffixed underbar. Additionally, especially in the case of jpegImage, there's actually a shitload of work going on behind the scenes in the fetch() function, and I wouldn't think this should just be forgotten about purely because the constructor is defined in one way or another. If everyone else has no objections (although I'm guessing it would only be rainbowsally who would be considering changes to the 2.x branch), I contend the constructor needs to include a call to fetch(). Otherwise, I think it runs the risk of being unsafe; before fetch() there is no form of file checking beyond 'does this file exist'. | |
|
#4 | rainbowsally 20:35 Mar 20, 2011 |
| The image size is 12 x 12 until you do a fetch().
Until then the image data is saved as a name so that tons of image 'addresses' can be loaded but only those actually needed will be expanded.
This does cause some problems, especially in the HelpView which can't predict the sizes of images, but the fix is simple enough.
Once the image has been created do obj->fetch()
et voila! :-)
I'm on a machine I don't normally use, Just stopped by to download the file I linked here and I saw this in the strs. | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |