Re: PhotoScripter and Curves
Re: PhotoScripter and Curves
- Subject: Re: PhotoScripter and Curves
- From: Paul Skinner <email@hidden>
- Date: Thu, 28 Jun 2001 22:36:33 -0400
on 6/28/01 3:35 PM, Arthur J Knapp wrote:
>
> Date: Thu, 28 Jun 2001 21:17:44 +1000
>
> Subject: Re: PhotoScripter and Curves
>
> From: Shane Stanley <email@hidden>
>
>
>> I don't quite follow how you wrote out a new settings file each time. I
>
>> opened a curve setting with bbedit to see if I could use AS to create them,
>
>> but the code inside is all extended system characters. How did you read the
>
>> files?
>
>
> With AppleScript ;-) The key is the ASCII numbers of the characters. The
>
> sequence is as follows, where each number represents the equivalent ASCII
>
> character, n is the number of points plotted, and the i and o values
>
> represent the plot pairs:
>
>
>
> 0, 1, 0, 1, 0, n, 0, i1, 0, o1, 0, i2, 0, o1, 0, i3, 0, o3 [...]
>
>
>
> So here's a typical snippet for three points at {14, 0}, {191,128} and {250,
>
> 255}, a fairly vicious curve:
>
>
Can I help??? (please, please, please...) ;-)
>
>
script CurveClass
>
>
-- convenience constants
>
--
>
property kAsc0 : ASCII character 0
>
property kAsc1 : ASCII character 1
>
>
property fileHeader : "" & kAsc0 & kAsc1 & kAsc0 & kAsc1 & kAsc0
>
>
on SetPoints(points_list)
>
repeat with pointXY in points_list
>
AppendPoint(pointXY)
>
end repeat
>
end SetPoints
>
>
on AppendPoint(pointXY)
>
set pointX to ASCII character (item 1 of pointXY)
>
set pointY to ASCII character (item 2 of pointXY)
>
set end of my pointsList to {kAsc0, pointX, pointY}
>
set my pointsCount to (my pointsCount) + 1
>
end AppendPoint
>
>
on GetPoint(at_index)
>
set pointX to item 2 of item at_index of my pointsList
>
set pointY to item 3 of item at_index of my pointsList
>
set pointX to ASCII number (pointX)
>
set pointY to ASCII number (pointY)
>
return {pointX, pointY}
>
end GetPoint
>
>
on SetPoint(at_index, pointXY)
>
set pointX to ASCII character (item 1 of pointXY)
>
set pointY to ASCII character (item 2 of pointXY)
>
set item 2 of item at_index of my pointsList to pointX
>
set item 3 of item at_index of my pointsList to pointY
>
end SetPoint
>
>
on FileFormatted()
>
set file_string to ""
>
set file_string to file_string & fileHeader
>
set LengthAsByte to ASCII character (my pointsCount)
>
set file_string to file_string & LengthAsByte
>
set file_string to file_string & my pointsList
>
>
return file_string
>
end FileFormatted
>
>
end script
>
>
on MakeCurve(points_list)
>
>
script CurveObject
>
property parent : CurveClass
>
property pointsList : {}
>
property pointsCount : 0
>
end script
>
>
SetPoints(points_list) of CurveObject
>
>
return CurveObject
>
>
end MakeCurve
>
>
set somePoints to {{14, 0}, {191, 128}, {250, 255}}
>
set someCurve to MakeCurve(somePoints)
>
>
tell someCurve
>
>
GetPoint(2) -->{191, 128}
>
SetPoint(2, {4, 5})
>
GetPoint(2) -->{4, 5}
>
>
set ReadyForFile to FileFormatted() --> [string of binary-code]
>
>
end tell
>
>
>
>
Arthur J. Knapp
Ok, what's up with this? creating files to load in order to create curve
value point lists, then systematizing the creation of the files with
multiple handlers and script objects. What's next? Hex?
Is there a common failure with the curves command in PhotoScripter that
my box is immune to? I can't imagine that you and Shane would do this all
for fun. Wait...I might be being a bit presumptuous on that. : )
Seriously, Is this the only way that you can achieve a working solution?
I haven't found any problems with this command running my configuration.
{modelname:"PowerBook G3 Series", ratedspeed:"400 MHz", systemversion:"9.1
International English", carbonlibversion:"1.3.1"}
PhotoShop 6.0.1,PhotoScripter 1.0.1
--
"AppleScript is digital duct tape."
Paul Skinner