STR #2327

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 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File | SVN ⇄ GIT ]

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:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]
Name/Time/Date Filename/Size top right image
 
#1 gera
09:52 Mar 04, 2010
img_error.cpp
1k
 
 
#2 gera
09:53 Mar 04, 2010
test_image.bmp
19k
 
bottom left image   bottom right image

Trouble Report Comments:

Post Text ]
Name/Time/Date Text top right image
 
#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.
 
bottom left image   bottom right image

Return to Bugs & Features | Post Text | Post File ]

 
 

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'.