Draw Render in a draw file
Jean-Michel BRUCK (3009) 359 posts |
@ Clive and Steve Thank you for your help, cooperative development :-) @ Clive: strange I don’t know if you’ve tried it with objects in a Draw file. The whole drawings objects are grouped, we can apply a Y scale transformation of -1. I’m going to build an example to make it clearer, with a link to download it. |
Clive Semmens (2335) 3276 posts |
Now that does puzzle me. I’ll take a look
That’s because it’s specified in millimetres. I don’t know what your 890’s units are. The first four elements in the matrix are dimensionless, so there’s no doubt about those. 890 seems close to half of the number of OS units in one millimetre (907), but I don’t think your bounding box’s height is likely to be half a millimetre, is it?
Yes, of course – I’ve tried it several of my own drawings, quite complicated ones, and various different matrices – rotations, skews, different scalings on different axes. But as Steve says, only Path objects – nothing else. |
Steve Drain (222) 1620 posts |
Now add shear and reflection for a bit of fun. BASIC matrix multiply is your friend, once you get your head around it. |
Clive Semmens (2335) 3276 posts |
I have no problem with BASIC matrix multiply* – 1st class honours in Maths… – but as Steve Fryatt points out, RISCOS text doesn’t express anything except origin in matrix terms. Obviously my little app deals with shear, reflection, rotation and anything else a matrix transformation can do to paths, and I could do the same for the origin of text, but that wouldn’t transform the text. FontManager can do text that’s been expanded or condensed and then rotated, but afaik it won’t do sheared text for you. I’m not sure I can be bothered to make my app determine whether a particular matrix has an effect on text that’s doable, and do it if it can. Just convert your text to path if it doesn’t play nicely… * I don’t bother in this app, because it’s easier to do it in individual multiply & add operations – it only takes a couple of lines, and saves setting up the arrays necessary for matrix ops. It’s possibly easier for others to see what’s going on. |
Clive Semmens (2335) 3276 posts |
I’ve got an idea what might be going on there, but Grace is asleep in the room with the Pi at the moment* – will look later. * This problem will get sorted when we’ve got the house a bit better organized! But we only moved in here in May and things are still a little…errmm… Add to which I got a heart pacemaker fitted last Tuesday, and I’m not allowed to lift my left arm above horizontal for a while, which is making life interesting – but manageable, of course. |
Clive Semmens (2335) 3276 posts |
I wuz right. Now fixed. v1.02 of XP1TrForm now up, and correctly allows for quoted values (and other superfluous characters… 8~) |
Jean-Michel BRUCK (3009) 359 posts |
Hi Clive, Note the Y coefficient from translation in the matrix, must be a A4 page eight in OsUnit (!WimpInfo). I hope that clarifies things. |
Clive Semmens (2335) 3276 posts |
That’s only true if the page size is set to A4 portrait in !Draw. That’s the default, but you can set it anything from A0 to (iirc) A6, portrait or landscape, from MISC on !Draw’s menu. I suppose ideally it should be set to the height of the bounding box in the originating SVG – and then you could make the page height in Draw the smallest size it would fit in. You could even look at the width of the SVG bounding box, and make sure the Draw page was big enough for that, too. The height of A4 portrait is 297mm, which is 538809 Draw Units – are OsUnits something different? (A Draw Unit is 1/640 of a printer’s point, or 1/46080 of an inch, or 1/1814.7… of a mm.) |
Clive Semmens (2335) 3276 posts |
As to the op – I feel fine in myself, better than ever, in fact. A bit achey and sore where they’ve been digging around near my left collar bone, but not too bad even there. But I’m not allowed to be too active, or in particular not to lift my left arm much, and certainly not above the horizontal – to avoid disturbing the wires into the heart, around which the flesh has to heal before they’re really secure. Give it six weeks, they say… |
Clive Semmens (2335) 3276 posts |
That’s the matrix multiplication (and matrix addition). To use BASIC matrix ops, you’d have to move values into BASIC arrays, and then back again. Since the only changes in the drawfile are to X and Y values, it can all be done in situ in the buffer the whole file was loaded into in the first place. I suppose I should really minimize rounding errors by adding 0.5 on each of the middle two lines, but with Draw Units of just over half a micron, do I bother? |
Steve Pampling (1551) 8170 posts |
Sign of the times I suppose, no consideration for precision :) |
Clive Semmens (2335) 3276 posts |
8~) |
Jean-Michel BRUCK (3009) 359 posts |
Bonsoir, I will keep you posted on this thread, thanks to all. |
Clive Semmens (2335) 3276 posts |
I can easily alter the units in my program, or make it user-specifiable, if you let me know what you need. |
Chris Hall (132) 3554 posts |
It is relatively simple to write a programme that will translate every element of a Draw file (i.e. without rotation). MultiTask does this to move the bottom left corner of a Draw file to (0,0) in draw units (so that whole file, including negative coords, is visible when opened in !Draw). |
Clive Semmens (2335) 3276 posts |
My program does it – but only for paths, and (currently) only if you provide the matrix to do it. I can easily alter it to allow you to specify the matrix in terms of a rotation angle and a centre of rotation as an alternative to the matrix. Of course you can do that (and Jean-Michel’s transformation) in Draw itself, by grouping everything inside an enclosing circle centred on your chosen centre of rotation, rotating it all, ungrouping and removing the cirle (or for J-M’s transformation, grouping it all and scaling by -1 in the vertical direction.) But if you’re processing a lot of files with the same transformation, dragging them onto an icon on the icon bar is quicker… |
Jean-Michel BRUCK (3009) 359 posts |
Back to original thread For the translation I modified the mm coefficient of your app. It is initialized to 256 which corresponds to screen units |
Steve Drain (222) 1620 posts |
It might be encouraging that I can now rotate text in a DrawFile. For a Transformed Text object it is matter of modifying the transform matrix. For a plain Text object it has to be converted to a Transformed Text object. It is not very complex, but I am working slowly. ;-) |
Chris Hall (132) 3554 posts |
MakeDraw will create transformed text objects. I use it to produce a book cover with text on the spine. |
Steve Drain (222) 1620 posts |
As will my DrawIt, but the question here is to [transform] text as part of an existing DrawFile. ;-) Not relevant, but how much we should regret the loss of Poster and its ilk from 4Mation. Thankfully, we still have FontFx, among others, because it is in BASIC. Edited |
Clive Semmens (2335) 3276 posts |
I could make my app do rotations of text, since the DrawFile spec provides for rotations. It also provides for expanded or condensed text, but not both at once, and not sheared – so I’d have to do one of the following: (a) Not bother (the current situation) and let people convert text to path before using my app; (b) Provide alternative formats for the controlling textfile, allowing for different scales in the X and Y directions, or rotation (both on the same text only if the rotation comes after the scaling), or a matrix – but doing nothing with text if the input is a matrix; or ( I don’t feel it’s worth going beyond option (a)* – I suppose if someone REALLY wants (b) or ( * You can, after all, group everything in a Draw window, and do rotations and X\Y scales in Draw itself… |
Clive Semmens (2335) 3276 posts |
Hmmm…interestingly, just did an experiment, and Draw CAN do rotations combined with differential scaling, & shearing of text, and save/reload it without error. Perhaps I’m misremembering the problems when I was doing the Draw→SVG app. I shall take another look at the DrawFile spec…maybe it’s the conversion to SVG that was horrible (or even impossible), I don’t remember. I’ll have to look at (one of the) SVG specs, too. |
Steve Drain (222) 1620 posts |
I was surprised when you suggested it could not. ;-) |
Clive Semmens (2335) 3276 posts |
I’m pretty sure SVG must be able to, too, but I probably couldn’t find a spec that went into the question, and gave up bothering to look since for my own porpoises convert-to-path and use what I’ve done already does the job nicely – and of course is necessary when fonts don’t correspond in the two worlds (which is generally the case…) |
Steve Drain (222) 1620 posts |
I not sure that this is what Jean-Michel was originally after, but my Transform utility can now be downloaded. For me it has been exercise for the brain, but it might have some practical use. ;-) |