Draw Render in a draw file
Jean-Michel BRUCK (3009) 359 posts |
Hi, An idea… |
Clive Semmens (2335) 3276 posts |
I’m not aware of any such utility, but it’s the kind of thing I might write one day – I’d write it as a little app, that you’d drop a text file containing the script onto the icon on the icon bar, and then drop Draw files onto it, which would be returned transformed to drop where you like. You could drop a different script on, and then it would do following Draw files according to the new script. You’d then be able to save a selection from a !Draw window onto it, and then drop the transformed result back into the original window – I can imagine that being very useful. Lots of other tricks you could play with it. Or of course you could process an entire drawfile as originally requested. |
Alan Adams (2486) 1149 posts |
Oddly enough, today I was wondering how to get two A4 sized draw files printed back to back on a duplex printer. Is there anything that will produce a 2-page draw file – or do I need this proposed tool? |
Clive Semmens (2335) 3276 posts |
I do that by converting them to SVG, exporting them to the Mac (I do all my printing from the Mac) and dropping them into a LibreOffice doc. On RISCOS, you could drop them into any DTP app? |
Julie Stamp (8365) 474 posts |
Thinking about how that might work, if you have a draw file that’s twice the height of an A4 page and print it, will it come out the printer as two pages how you’d hope? |
Alan Adams (2486) 1149 posts |
That should be possible using Drawprint, which has the option to tile output. I’ll try this when I get time. |
Chris Hall (132) 3554 posts |
The solution I employ (producing a book of several hundred pages) is to produce each individual page as a Draw file, then batch-convert them to individual PDFs, one for each page, then assemble them together into a single PDF using Adobe Acrobat STandard on a PC. |
Simon Willcocks (1499) 513 posts |
There are command line tools to manipulate PDFs, the appropriate one would be pdfunite to put multiple pages into a single PDF file. No idea if they’ve been ported to RISC OS. |
Kevin (224) 322 posts |
PDFutils" hs which has a PDF join command and my front end KPDFutk has that function in it. |
Doug Webb (190) 1180 posts |
PrintPDF by Steve Fryatt also allows you to join multiple printouts in to one PDF document as well. |
Clive Semmens (2335) 3276 posts |
Having had a heart pacemaker implanted yesterday, I’m somewhat restricted in my DIY activities for a while. I was just having a look at this – it’s fairly trivial. You’ll get a little app in a couple of days or so, I’ll be fiddling with it between novel writing sessions, which are too intense to do 24\7… |
Rick Murray (539) 13840 posts |
I wish I did, but my attention span is…….. |
Jean-Michel BRUCK (3009) 359 posts |
@Clive |
Clive Semmens (2335) 3276 posts |
I could give you the original DrawFile I made that from! Rather you than me trying to do SVG→Draw! I could fairly easily write an app that reversed my Draw→SVG app. My existing app: (Draw) → (subset of SVG) Fairly easy: (same subset of SVG) → (Draw) But (whole of SVG) → (Draw) is a job of any entirely different magnitude – and a moving target… Actually of course it’s the source not the target that’s moving, but you know what I mean. |
Clive Semmens (2335) 3276 posts |
!XP1TrForm is now on my website at clive.semmens.org.uk/RISCOS/XP1TrForm.zip The default transformation is 0 1 1 0 0 0 – that is, a reflection around the y=x line. To change the matrix, just drop a text file containing the matrix onto the icon bar icon. That will remain in force until you drop a different text file on the icon, or restart the program. The translation is in mm – could be changed in the Runimage easily enough. The format of the text file isn’t very forgiving at the moment: it insists on no initial space, and exactly one space between the elements. The elements can have digits, a decimal point if required, and an initial – sign, but shouldn’t have anything else. There must be exactly six entries! I may well make it more forgiving in the future, provide an option to change the units for the translation, and probably provide alternative formats that allow you to specify the transformation in terms of rotation angles & centre of rotation, skew angles, and x and y scales rather than a matrix. But it works as is for now! No links from my website just yet. |
Clive Semmens (2335) 3276 posts |
Sorry this is a drag-and-drop app rather than a *command or SWI… 8~( |
Steve Drain (222) 1620 posts |
Could I ask what transformation you actually need for this? And what Draw objects are you having to deal with? It might be possible to make a simple Utility for just that. |
Clive Semmens (2335) 3276 posts |
Graphic origin for Draw is bottom left, with positive x to the right, positive y upwards. Graphic origin for SVG is top left, with positive x to the right, positive y downwards. Really not nasty! But you do need to know the height of the bounding box… I’ve written that general purpose app now, but it’s not really what Jean-Michel needs, as it’s a drag-and-drop app, not something that can be called in a script. |
Jean-Michel BRUCK (3009) 359 posts |
@Clive
Yes, I felt like I had as many standard as SVG files :-) I just tested your application!XP1TrForm, it works, great. Your application is fine, may be a problem with the matrix coefficients. But I will have to transform your program if you allow it, to be able to use the same syntax as *render because I use it directly from my program. @Steve |
Clive Semmens (2335) 3276 posts |
You can’t quote negative numbers in my program – although of course I can easily edit it so it doesn’t mind, will do later today! It works fine with unquoted negatives, I hope – it does for me with [0.707 -0.707 0.707 0.707 0 0] (which is a 45° clockwise rotation) – no square brackets! (Again, I could make it tolerate them easily enough.) |
Clive Semmens (2335) 3276 posts |
That 890 is of course the height of your bounding box – if you have different sizes of bounding boxes you need to take that into account. And of course you can do whatever you like with my program. |
Clive Semmens (2335) 3276 posts |
XP1TrForm now accepts quoted values, indeed it ignores any character other than digits, decimal points, minus signs, and spaces or commas. You can use either space or comma as separators, but there must be only one separator – and there mustn’t be a separator before the first value. |
Steve Drain (222) 1620 posts |
I am pretty sure that is not possible, in the general case. There are DrawFile objects that do not have transform matrices to modify – Text, Sprite, TextArea, JPEG 1 – but Render does these at the display phase. It should be possible to convert Text and Sprite objects to the Transformed versions, but not the other two. Clive has limited his to Path objects, so all is well. I think he just has to transform bounding boxes and points. I am making a little progress with a Utility program, but I am having to relearn what I worked out about transforming transforms quite a while ago. 1 JPEG does have a matrix, but only for size and position. If you use Render to rotate one, it produces an error. |
Clive Semmens (2335) 3276 posts |
I’ve transformed bounding boxes, but not text. Text really would be a nightmare – you can convert it to paths in !Draw of course, and then it’ll work okay. (Bounding boxes were fun: you have to ensure they get in the right order…but it’s only a few lines in the BBox PROC.) Edit:
Ah, yes, I see what you meant. Exactly right, of course. |
Clive Semmens (2335) 3276 posts |
It’s a nightmare I’ve already looked at in Dr2SVG, which does its best. It copes with rotated text and expanded/condensed text, but not text that’s both rotated and expanded/condensed. No problem at all of course for Jean-Michel’s specific transformation. I could apply the Y translation to all text, which is all his application needs. Might as well apply all the other elements of the matrix, which would work okay for translations, and unrotated, unskewed scalings. For other transformations, you’d have to convert text to path in Draw to get sensible results. |