On Fri, Jan 09, 2009 at 08:27:17PM +0100, Hofmann Johannes wrote:
On Fri, Jan 09, 2009 at 04:11:36PM -0300, Jorge Arellano Cid wrote:
On Fri, Jan 09, 2009 at 06:04:09PM +0100, Hofmann Johannes wrote:
Hi Jorge,
On Fri, Jan 09, 2009 at 02:00:20PM -0300, Jorge Arellano Cid wrote:
Hi Johannes,
Now that I have the image process mostly in my head, I'd like to hook correct image ratio scaling when only one of width/height is given.
I see scaling done with the styleengine in a_Html_add_new_image but 'props' goes away when popping the tag. How do I handle this?
Do I have to preserve props in the stack until I have the final data, or is there another way? Please explain.
What about just setting the data that is available (width, height, or both) and let the image do the rest? It already handles the case where neither width nor height are given. So it should be possible to make it work with just width or height too. Am I missing something?
Yes, the problem is when only one of the dimenssions is given, bacause the other one is only known at image arrival time (much later).
i.e. Only once the real dimenssions of the image are known it is possible to calculate the missing one. At this time, props is long gone, and thus the question.
Yes, props is gone, but - if not overridden - it's data will have made it into the style object associated with the image.
How do I get to the style object of a dw::Image? (once endElement has been called on it)
I guess the calculation of the missing dimension could be done in Image::sizeRequestImpl() or Image::sizeAllocateImpl() but I haven't looked at it enough to know exactly.
I guess we're in a situation were you know easily the style part and I know how to hook the rest, hence the conversation! :-) The HTML-requested size can be stored in the DilloImage structure, and updated in a_Image_set_parms(). The latter is called by the dicache when the original width and height are known. So at this point we have the requested size, original size and dw:Image well defined. -- Cheers Jorge.-