Hi Miyako, > translate offsets the x/y by the value specified. > the x/y you pass are not absolute coordinates (unless, of course, the x/y in > element are 0,0)
Agree! I have tested setting the x/y w/h to 0 thinking that it would apply correctly but the svg looks like this: <use height="0" transform="scale(0.02,0.02) translate(653,653)" width="0" x="0" xlink:href="#S09" y="0”/> and the image seems to be at x=0, y=0 even though the size seems to be correct? Always! Thanks, John… > Hi All, > > Note: If I apply the transform immediately after I create the symbol: > > $symbol:=DOM Create XML > element($defs;"image";"id";$name;"xlink:href";$image;"x";0;"y";0;"width";$width;"height";$height) > > SVG_SET_TRANSFORM_SCALE ($symbol;18/$width;18/$height) > > That seems to work and would be fine if all I needed were uniform sizes in > the doc. In this example I am resizing them so they are 18 by 18 pixels. But > as indicated previously the end user can set a size property to enlarge or > shrink these sizes for the same symbol in different parts of the doc. So I > need to resize and reposition where they are actually used. > > Not sure if this is a clue or… > > John... > > >> Hi All, >> >> I’m in the process of changing some SVG routines to be a bit more efficient >> (I think). >> >> Miyako showed me how to embed svg images as “defs”: >> >> $defs:=SVG_Define_symbol ($domSvg_ptr->;"defs”) >> >> so I could reuse the graphics without reloading them several times. This >> part works perfectly. >> >> Previously I would read the image from disk and resize and place: >> >> $tDom_Image:=SVG_New_image ($$domSvg_ptr->;$image_t;$x;$y;$w;$h) >> >> Worked great! no matter the size of the original svg image on disk which are >> in the neighborhood of 1000 pixels width/height (although there is >> variation). And I can’t set the originals to a fixed size because the end >> user can change the same image, in different places of the svg document, to >> different sizes. So I need to managing the image sizes dynamically. >> >> Anyway, now that I am accessing these “defs” images using: >> >> $glyph:=SVG_Use ($domSvg_ptr->;$id;$inX;$inY;$size_IntrcG;$size_IntrcG) >> >> >> I have to both resize the image and make sure it stays at the x/y coords I >> need. >> >> But it’s not! >> >> To reset the size I believe I have to use (0.02 being used for testing): >> >> SVG_SET_TRANSFORM_SCALE ($glyph;0.02;0.02) >> >> >> To reposition at the x/y I believe I have to use: >> >> SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY) >> >> The scaling seems to scale BUT the translate is not placing the images at >> the x/y location I need. Although, the attributes for the object look >> correct: >> >> height - 14 >> transform - scale(0.02,0.02) >> width - 14 >> x - 660 >> xlink:href - #S09 >> y - 660 >> >> I am assuming (until I know better) that these values are correct. >> >> So I must be missing something? How do I control both the height/width (I >> think I am) and the exact x/y placement when I am creating an image using >> SVG_Use? >> >> Anyone? >> >> Thanks, >> John… >> >> > ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

