image external

Here is where the magnanimous folks that create externals post them (.zip archives only please).

image external

Postby sctell » Sun Apr 10, 2011 11:15 pm

I have now updated this external with a new function

put image("setImageInterpolation",4) into tInfo

This sets the interpolation status of the external when it interprets image data.
The available settings are.

-- NSImageInterpolationDefault 0
-- Use the context’s default interpolation.

-- NSImageInterpolationNone = 1
-- No interpolation.

-- NSImageInterpolationLow = 2
-- Fast, low-quality interpolation.

-- NSImageInterpolationMedium = 3
-- Medium quality, slower than NSImageInterpolationLow.

-- NSImageInterpolationHigh = 4
-- Slower, higher-quality interpolation.

The function is 0 by default, therefore it is not necessary to use the function if not required.


image.zip
(128.25 KiB) Downloaded 227 times
Last edited by sctell on Thu Jan 08, 2015 11:44 am, edited 3 times in total.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: image external

Postby sctell » Mon Apr 11, 2011 1:38 am

Hi,

I have just noticed a quirk with the image external project scripts:

Code: Select all
on UpdateDisplay
--lock screen
put item 3 of the imageRect of cd grc "image" into tWidth
put item 4 of the imageRect of cd grc "image" into tHeight
get  ShrinkToFit(tWidth,tHeight,323,323)
set the width of cd grc "image" to item 1 of it
set the height of cd grc "image" to item 2 of it
--unlock screen
end UpdateDisplay

function ShrinkTofit pWidth,pHeight,pMaxWidth,pMaxHeight
if pWidth < pMaxWidth then
put pWidth into pMaxWidth
end if
if pHeight  < pMaxHeight then
put pHeight into pMaxHeight
end if
put min(pMaxWidth/pWidth,pMaxHeight/pHeight) into tRatio
put round(tRatio * pWidth) into pWidth
put round(tRatio * pHeight) into pHeight
return pWidth & Comma & pHeight
end ShrinkTofit


These two scripts have been used to scale images returned as TIFF via the image external to SuperCard.
I acquired them from somewhere (not sure where) but have noticed that when applied to TIFF images containing alpha and with any of the alpha settings used in SC they return poor results when compared to the images returned from the image external which use the NSImageInterpolation... routines as provided within Cocoa.

You can see the difference in the two attachments below:

The first beings rotated then scaled by the external.

The second being rotated by the external and scaled by the scripts.

The difference in quality is clear to see.

1. Rotated and scaled by the image external:
Screen shot 2011-04-11 at 10.28.18.png
Screen shot 2011-04-11 at 10.28.18.png (26.34 KiB) Viewed 6311 times


2. Rotated by the image external scaled by script:
Screen shot 2011-04-11 at 10.27.34.png
Screen shot 2011-04-11 at 10.27.34.png (26.84 KiB) Viewed 6311 times


I will remove these scripts from the external and ensure that all manipulations of the images in the examples only use the image external functions.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: image external

Postby sctell » Mon Apr 11, 2011 3:08 am

I have now updated the example project to reflect the post above and included a sample image to play with.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: image external

Postby Randall Lee Reetz » Thu Jan 08, 2015 8:57 am

Where is the external? No linked file?
What matters is what matters, knowing what matters and how to know it, matters the most.
Randall Lee Reetz
 
Posts: 65
Joined: Fri Mar 07, 2014 3:29 pm

Re: image external

Postby sctell » Thu Jan 08, 2015 11:09 am

It's gone for good.


Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: image external

Postby sctell » Thu Jan 08, 2015 11:45 am

sctell wrote:It's gone for good.


I tell a lie. Found a copy.

It's in the first post of this thread.

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am


Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest

cron