|
|
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Problem with offset
Problem with offset [message #14674] |
Thu, 06 March 2008 22:41  |
kodos
Messages: 111 Registered: March 2008
|
Experienced Member |
|
|
Hi,
I'm writing a SvgDraw package, and the basics work already. But now I have a problem with offsets.
When I'm drawing my image directly through my new SvgDraw class everything works fine, but if I draw the image first with a DrawingDraw and then draw this onto my SvgDraw with DrawDrawing the OffsetOp function is still called, but e.g. the coordinates of the DrawEllipseOp are already transformed, so the offset is applied twice. Am I doing something wrong or is this a bug in U++.
|
|
|
|
|
|
|
|
|
|
|
Re: Problem with offset [message #14755 is a reply to message #14753] |
Wed, 12 March 2008 21:23   |
 |
mirek
Messages: 13891 Registered: November 2005
|
Ultimate Member |
|
|
cbpporter wrote on Wed, 12 March 2008 15:34 |
luzr wrote on Wed, 12 March 2008 20:06 |
kodos wrote on Wed, 12 March 2008 13:17 |
luzr wrote on Wed, 12 March 2008 17:59 | P.S.: Svg-Draw - a good idea. But IMO it would be better to use lower-lever Xml construction instead of XmlNode, if possible.
|
Hm, do you mean I should directly use a String?
|
XmlTag
Mirek
|
Yes, XmlNode uses a lot of memory because of the VectorMap. I was thinking about rewriting it with a more memory efficient container. I don't think that the performance difference will mater a lot, because XMLs with a lot of nodes are common, but with a lot of attributes are quite rare.
|
The question is whether you need a container at all... (I do not know, I have not investigated the code in deep yet).
Mirek
|
|
|
|
|
|
Re: Problem with offset [message #14766 is a reply to message #14763] |
Thu, 13 March 2008 18:37   |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
I was bored and curious, so I thought I'd have a go at doing this with just a StringBuffer (well, two actually) and XmlTags. It's not too complicated, and the results are identical to your version (I'm not sure if I fixed the offset bug correctly or not though). I've attached the results in case they are of interest.
To finish it you would need to add a stack of Rects to allow retrieval of the clipping/offset area, but I have no idea how that works so I haven't bothered . Ideally you don't really want to use XmlTag either, since this forces a DeXml call on every attribute but it makes the code simpler.
If you are worried about being able to change it on the fly, couldn't you just convert the final string into an Xml tree and then modify it? There is no interface in Draw to allow modification of previous elements anyway.
EDIT: I stupidly uploaded versions of the files that didn't compile. Fixed now.
-
Attachment: SvgDraw.h
(Size: 2.35KB, Downloaded 360 times)
-
Attachment: SvgDraw.cpp
(Size: 7.71KB, Downloaded 638 times)
[Updated on: Thu, 13 March 2008 19:42] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Mon May 29 08:34:47 CEST 2023
Total time taken to generate the page: 0.02049 seconds
|
|
|