Adobe 13102498 Scripting Guide - Page 69
Applying a MotionBlur Filter, To select an area and apply a wave filter to
UPC - 883919080192
View all Adobe 13102498 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 69 highlights
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 69 JS ➤ To select an area and apply a wave filter to it: 1. Type the following code into the script file HelloWorldDoc just above the statements that restore original preferences: //create new variables to contain doc width and height //convert inches to pixels by multiplying the number of inches by //the resolution (which equals number of pixels per inch) docWidthInPixels = docWidthInInches * resolution docHeightInPixels = docHeightInInches * resolution //use the rasterize method of the artLayer class newTextLayer.rasterize(RasterizeType.TEXTCONTENTS) //create a variable to contain the coordinate values //for the selection object selRegion = Array(Array(0, 0), Array(docWidthInPixels / 2, 0), Array(docWidthInPixels / 2, docHeightInPixels), Array(0, docHeightInPixels), Array(0, 0)) //use the select method of the selection object //to create an object and give it the selRegion values //as coordinates docRef.selection.select(selRegion) newTextLayer.applyWave(1, 1, 100, 5, 10, 100, 100, WaveType.SINE, UndefinedAreas.WRAPAROUND, 0) 2. Save the script, and then open Photoshop CS3 and select the script from the Scripts menu (choose File > Script > HelloWorldDoc). 3. After viewing the document in Photoshop CS3, close Photoshop CS3 without saving the document. Note: Look up the following classes in the Adobe Photoshop CS3 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer to see if you understand how you used them in this script: ● ArtLayer ● rasterize() method. Notice that the RasterizeType.TEXTCONTENTS argument uses the RasterizeType constant. Constants are always depicted in upper case letters in Photoshop CS3 JavaScripts. ● applyWave() method Applying a MotionBlur Filter In this section, we will apply a different filter to the other half of our document. AS ➤ To apply a motionblur filter to HelloWorldDoc: 1. Type the following code into the script file HelloWorldDoc just above the statements that restore original preferences. --change the value of the variable theSelRegion --to contain the opposite half of the screen