Re: Random error showing an image

I think what Robert is saying is that the term "factor" usually refers to something that is multiplicative (you multiply by a factor of 0.5 for example), while something that you add/subtract is called something like an "offset".

On Mon, Jan 17, 2011 at 2:40 PM, Kees Kling <ckling upcmail nl> wrote:
Hi Robert,

perhaps it is not the usual way to imic zooming, but when you reduce the destination width and height the image becomes smaller and that is what I do with  substracting a factor. At startup the factor is always 0, so that cannot cause the problem. I think that the prob lem lies more in the fact that at the moment I want to display the image it is still not fully loaded and I suspect that using the call "mage = Gdk::Pixbuf::create_from_file("path and dir of picture); " a thread is started to load te file. Not a problem, but I need to know when the thread has finnished



Robert Pearce wrote:
Hi Kees,

On Mon, 17 Jan 2011 10:26:34 +0100 you wrote:
after the loading I display it with a queue_redraw and in the 
expose_event handler it is displayed with

image->scale_simple(image->get_width() - scaleFactor, 
image->get_height() - scaleFactor,
Why on earth are you SUBTRACTING something called "factor"?

Normally this goes well, but sometimes I get the error and crash of the 
app The errmsg is :
GdkPixbuf-CRITICAL **: gdk_pixbuf_scale_simple: assertion `dest_width > 
0' failed.

What is causing this error and how to avoid it??
What's causing it is that you're passing a negative (or zero) width,
probably due to the way you're subtracting your scaleFactor. Without
seeing the rest of the code we can't possibly know what you're putting
in that variable, but if the name is anything like honest it's not
something you'd want to subtract.

However, I wouldn't like to imply any certainty that the error is
related in any way to a "crash".
gtkmm-list mailing list
gtkmm-list gnome org


gtkmm-list mailing list
gtkmm-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]