Scaling images and printing...

Scott Rossi scott at tactilemedia.com
Fri Dec 19 15:25:17 EST 2014


Hi Paul:

If I understand what you are trying to do, here are a couple of
suggestions.  When first setting the fileName, also store this path in a
custom property to be able to retrieve it later (such as the uFileName).
Also, if possible, only set the imageData of the image to itself when
printing; a soon as printing is completed, reset the fileName of the image
to the stored fileName (uFileName) so resizing can take place.  If the
image is not locked, you¹ll need to restore its scaled rect after
restoring the fileName.

One thing to avoid is setting the imageData to itself repeatedly as the
image is being scaled.  This will likely make scaling slow and less
responsive.  Also consider setting the resizeQuality of the image to
³good² which is a compromise between quality and performance.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 12/18/14, 2:43 PM, "Paul Dupuis" <paul at researchware.com> wrote:

>I have a problem with scaling images and printing.
>
>I have the following portion of code where tObj is an image and tPrecent
>is a number from 5 to 400. It's purpose is to scale an image to a %
>scale factor the user entered and it does so.
> 
>put the fileName of tObj into tFile
>set the filename of tObj to empty
>set the fileName of tObj to tFile
>set the alwaysbuffer of tObj to true
>put the loc of tObj into tLoc
>set the width of tObj to (the width of tObj * (tPercent/100))
>set the height of tObj to (the height of tObj * (tPercent/100))
>--set the imagedata of tObj to the imagedata of tObj -- to fix the size
>for printing
>set the loc of tObj to tLoc
>
>If I then print the card with the image on it, the image is printed at
>it's original size rather than the scaled size. If I added the commented
>line "set the imagedata of tObj to the imagedata of tObj" back in to
>"fix" the size of the image to the scaled size, card prints with the
>image at the scaled size. Yea!
>
>However, with the "set the imagedata of tObj to the imagedata of tObj"
>line in the script, if the user resizes again, so the code above is
>called with a different scaling factor, the image vanishes (or appears
>to).
>
>The intent of the lines:
>put the fileName of tObj into tFile
>set the filename of tObj to empty
>set the fileName of tObj to tFile
>
>was to set the image back to its original size each time before scaling
>so that the scaling would always be against the original image size (not
>against it;s currently scaled size).
>
>Is there a better way to allow users to rescale an image from it's
>original size and still fix its size for printing?
>
>
>_______________________________________________
>use-livecode mailing list
>use-livecode at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list