RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → Community Support →

Draw Render in a draw file

Subscribe to Draw Render in a draw file 59 posts, 11 voices

Posts per page:

Pages: 1 2 3

 
Sep 16, 2022 4:10pm
Avatar Jean-Michel BRUCK (3009) 153 posts

Hi,
I want to apply a transformation matrix to an existing draw file to get another draw file that will contain the result of the transformation.
I tested the *render command which works fine, but does not produce a Draw file:
*render SVGout 1.0 0.0 0.0 “-1.0” 0 890
This command would be sufficient by providing the matrix parameters
I don’t know if such a utility exists, which can work using a script?

An idea…

 
Sep 16, 2022 4:33pm
Avatar Clive Semmens (2335) 2859 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.

 
Sep 16, 2022 9:14pm
Avatar Alan Adams (2486) 952 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?

 
Sep 17, 2022 6:00am
Avatar Clive Semmens (2335) 2859 posts

how to get two A4 sized draw files printed back to back on a duplex printer.

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?

 
Sep 17, 2022 7:29am
Avatar Julie Stamp (8365) 441 posts

Oddly enough, today I was wondering how to get two A4 sized draw files printed back to back on a duplex printer.

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?

 
Sep 17, 2022 9:18am
Avatar Alan Adams (2486) 952 posts

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

That should be possible using Drawprint, which has the option to tile output. I’ll try this when I get time.

 
Sep 19, 2022 8:54am
Avatar Chris Hall (132) 3290 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.

 
Sep 19, 2022 12:01pm
Avatar Simon Willcocks (1499) 292 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.

 
Sep 19, 2022 2:46pm
Avatar Kevin (224) 214 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.)

PDFutils" hs which has a PDF join command and my front end KPDFutk has that function in it.

 
Sep 19, 2022 4:54pm
Avatar Doug Webb (190) 1036 posts

PrintPDF by Steve Fryatt also allows you to join multiple printouts in to one PDF document as well.

 
Sep 21, 2022 1:09pm
Avatar Clive Semmens (2335) 2859 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…

 
Sep 21, 2022 3:18pm
Avatar Rick Murray (539) 12210 posts

between novel writing sessions

I wish I did, but my attention span is……..

 
Sep 21, 2022 6:22pm
Avatar Jean-Michel BRUCK (3009) 153 posts

@Clive
Slow down…
Thank you if you can build the application, but take your time, I’m not in a hurry.
On the other hand I am interested if you can explain how you manage the Draw file datas, I looked at the documentation, but I am very busy.
Note: The drawings contained in the file will in principle be in a group. The transformation applying to the entire drawing.
Actually, I need this “function” for my SVG2DRAW program, because Draw and SVG have neither the same graphic origin nor the same orientation.This will simplify the calculations.
I’m fine decoding your Boat/svg file in Draw :-)

 
Sep 22, 2022 7:25am
Avatar Clive Semmens (2335) 2859 posts

I’m fine decoding your Boat/svg file in Draw :-)

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.

 
Sep 22, 2022 1:45pm
Avatar Clive Semmens (2335) 2859 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.

 
Sep 22, 2022 1:52pm
Avatar Clive Semmens (2335) 2859 posts

Sorry this is a drag-and-drop app rather than a *command or SWI… 8~(

 
Sep 22, 2022 4:48pm
Avatar Steve Drain (222) 1620 posts

Draw and SVG have neither the same graphic origin nor the same orientation.

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.

 
Sep 22, 2022 5:06pm
Avatar Clive Semmens (2335) 2859 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.

 
Sep 23, 2022 9:53am
Avatar Jean-Michel BRUCK (3009) 153 posts

@Clive
Thank you for these responses.
In fact I was looking for SVG files and I came across yours…

But (whole of SVG) → (Draw) is a job of any entirely different magnitude – and a moving target…

Yes, I felt like I had as many standard as SVG files :-)

I just tested your application!XP1TrForm, it works, great.
I have problems with matrix.text, the program seems to dislike negative numbers,
The command *render svgout 1.0 0.0 0.0 “-1.0” 0 890 works because the -1.0 is between " "
PRM5a P.545. “You must quote any negative arguments”
This information is missing on Wiki: *render in documentation.

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.
Thanks

@Steve
I need exactly what *render does but with output to a to file.
*render drawin 1.0 0.0 0.0 “-1.0” 0 890
*render_in_a_file drawin 1.0 0.0 0.0 “-1.0” 0 890 drawout
The Clive program shows that it is possible and that it works well…

 
Sep 23, 2022 10:29am
Avatar Clive Semmens (2335) 2859 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.)

 
Sep 23, 2022 10:33am
Avatar Clive Semmens (2335) 2859 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.

 
Sep 23, 2022 4:23pm
Avatar Clive Semmens (2335) 2859 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.

 
Sep 23, 2022 5:10pm
Avatar Steve Drain (222) 1620 posts

I need exactly what *render does but with output to a to file.

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.

 
Sep 23, 2022 5:45pm
Avatar Clive Semmens (2335) 2859 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:

I think he just has to transform bounding boxes and points.

Ah, yes, I see what you meant. Exactly right, of course.

 
Sep 23, 2022 5:57pm
Avatar Clive Semmens (2335) 2859 posts

Text really would be a nightmare

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.

Next page

Pages: 1 2 3

Reply

To post replies, please first log in.

Forums → Community Support →

Search forums

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Description

Community-provided support for all users of RISC OS.

Voices

  • Jean-Michel BRUCK (3009)
  • Clive Semmens (2335)
  • Alan Adams (2486)
  • Julie Stamp (8365)
  • Chris Hall (132)
  • Simon Willcocks (1499)
  • Kevin (224)
  • Doug Webb (190)
  • Rick Murray (539)
  • Steve Drain (222)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys