Working With Color Objects - Adobe 65014912 Manual

Photoshop cs4 extended
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER
// Next create a SubPathInfo object, which holds the line array
// in its entireSubPath property.
var lineSubPathArray = new Array()
lineSubPathArray[0] = new SubPathInfo()
lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR
lineSubPathArray[0].closed = false
lineSubPathArray[0].entireSubPath = lineArray
//create the path item, using add. This method takes the SubPathInfo object
//and returns a PathItem object, which is added to the pathItems collection
// for the document.
var myPathItem = docRef.pathItems.add("A Line", lineSubPathArray);
// stroke it so we can see something
myPathItem.strokePath(ToolType.BRUSH)

Working with color objects

Your scripts can use the same range of colors that are available from the Photoshop user interface. Each
color model has its own set of properties. For example, the
contains three properties: red, blue and green. To set a color in this class, you indicate values for each of
the three properties.
In VBScript and JavaScript, the
object, you first create an instance of a
the object. Once a color model has been assigned to a
be reassigned to a different color model.
The following examples demonstrate how to set a color using the
AS
set foreground color to {class:CMYK color, cyan:20.0,¬
magenta:90.0, yellow:50.0, black:50.0}
VBS
'create a solidColor array
Dim solidColorRef
Set solidColorRef = CreateObject("Photoshop.SolidColor")
solidColorRef.CMYK.Cyan = 20
solidColorRef.CMYK.Magenta = 90
solidColorRef.CMYK.Yellow = 50
solidColorRef.CMYK.Black = 50
appRef.ForegroundColor = solidColorRef
JS
//create a solid color array
var solidColorRef = new solidColor()
solidColorRef.cmyk.cyan = 20
solidColorRef.cmyk.magenta = 90
solidColorRef.cmyk.yellow = 50
solidColorRef.cmyk.black = 50
foregroundColor = solidColorRef
class contains a property for each color model. To use this
SolidColor
object, then set appropriate color model properties for
SolidColor
RGB color (RGBColor/RGBColor)
object, the
SolidColor
CMYK color
Working with color objects 51
class
object cannot
SolidColor
class.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents