How to get the outline color and size of the rectangle?
Hi all
I'm developing an extension for CS5 and higher (including the CC version). I want to get the outline color and size of a rectangle. I was able to do in CS5. But I noticed that in the version of the CC, there are two ways in which the user can apply to a stroke. One is by applying the effect in the layer Style, and the other through the properties panel. I am able to get the values of time in my script, if it is applied through layer Style, but I can't do it in the other scenario.
How are these two different traits and how do I get the outline color and size if it is applied via the properties panel using script?
Thank you!
Here's what I have so far. It takes more work, but I don't think that's never very accurate.
function toggleOtherLayersVisibility() { var desc = new ActionDescriptor(); var list = new ActionList(); var ref = new ActionReference(); ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') ); list.putReference( ref ); desc.putList( charIDToTypeID('null'), list ); desc.putBoolean( charIDToTypeID('TglO'), true ); executeAction( charIDToTypeID('Shw '), desc, DialogModes.NO ); }; function liveShapeFillEnabled( enable ) {// boolean var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putEnumerated( stringIDToTypeID('contentLayer'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') ); desc.putReference( charIDToTypeID('null'), ref ); var shapeDesc = new ActionDescriptor(); var styleDesc = new ActionDescriptor(); styleDesc.putInteger( stringIDToTypeID('strokeStyleVersion'), 2 ); styleDesc.putBoolean( stringIDToTypeID('fillEnabled'), enable ); shapeDesc.putObject( stringIDToTypeID('strokeStyle'), stringIDToTypeID('strokeStyle'), styleDesc ); desc.putObject( charIDToTypeID('T '), stringIDToTypeID('shapeStyle'), shapeDesc ); executeAction( charIDToTypeID('setd'), desc, DialogModes.NO ); }; function dupeVisibleMerged() { var desc = new ActionDescriptor(); desc.putBoolean( charIDToTypeID('Dplc'), true ); executeAction( charIDToTypeID('MrgV'), desc, DialogModes.NO ); }; function loadTransparency(){ var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) ); desc.putReference( charIDToTypeID( "null" ), ref ); var ref1 = new ActionReference(); ref1.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Trsp" ) ); desc.putReference( charIDToTypeID( "T " ), ref1 ); executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO ); }; function getLiveShapeStrokeInfo(){ var doc = app.activeDocument; var lyr = doc.activeLayer; liveShapeFillEnabled( false ); toggleOtherLayersVisibility(); doc.artLayers.add(); dupeVisibleMerged(); var bounds = doc.activeLayer.bounds; var horzCenter = (bounds[2]-bounds[0])/2; var vertCenter = (bounds[3]-bounds[1])/2; lyr.visible = false; var sampler = doc.colorSamplers.add([bounds[0]+UnitValue(.5,'px'),bounds[1]+vertCenter]); sizeObject.color = sampler.color; loadTransparency(); doc.selection.select([ [bounds[0],bounds[1]+vertCenter], [bounds[0]+horzCenter,bounds[1]+vertCenter], [bounds[0]+horzCenter,bounds[1]+vertCenter+UnitValue(1,'px')], [bounds[0]+UnitValue(1,'px'),bounds[1]+vertCenter+UnitValue(1,'px')]],SelectionType.INTERSECT); sizeObject.size = doc.selection.bounds[2]-doc.selection.bounds[0]; }; var sizeObject = {}; app.activeDocument.suspendHistory('Get Live stroke info','getLiveShapeStrokeInfo()'); executeAction( charIDToTypeID('undo'), undefined, DialogModes.NO ); sizeObject.size;
Tags: Photoshop
Similar Questions
-
The knife tool develops a black line on the objects that I colored using the live paint bucket. How to get the tool knife to stop this and instead of being invisible?
I understand that it is a live paint object you use.
Try this:
-
How to get the channels spot given colors and spot channels length
File is CMYK format... channel spot color is CMYK we as a spot channel color is c100m50y20k5
How to get the channel spot color data using javascript? c = ? m = ? y = ? k = ?
howv to get your channel length n (not the CMYK channel) use javascript? such as CMYK + spot n-channel 7 = 7Please help me
#target photoshop
var myDoc = activeDocument;
var channel = myDoc.channels;
var number = 0;
for (var m = 0; m< channels.length;="" m++)="">
If (channels [m] .kind == ChannelType.SPOTCOLOR) {the number ++}
};
Alert (the number + "spotchannels");
-
Draw the dots of different colors and sizes
Hello
Is it possible to draw several dots of different colors and sizes? Small size would be green, medium-sized yellow and big sizes Red? I tried to use XY and field Multi-XY, but I'm not having much luck. Looks like there may be a way to do it with ground Multi-XY if I use Plot XY cosmetics and size Scatter Plot cosmetic, but I can't find anything on the functioning of these two options and it did not have a lot of sense to me when I am just playing with it.
Thank you!
Gerd has the right idea.
Say you have 3 ranges: < a,="" a-b,=""> B
You check each data point as it came, to see who will he fell in.
Build 3 separate tables and cluster each a vs a table 1 d of the corresponding X values.
Then if you pass these 3 groups to a XY Chart, you get a graph showing the colors and different styles for each range.
-
How to get the element selected listfield and goto next page?
Assalaamualikum
I try parsing the XML from a url and show in listfield.
problem:
How to get the selected item and passing the variable and than goto next page?
my code:
package parsepack;
import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;Import javax.microedition.io.Connector;
Import javax.microedition.io.StreamConnection;Import net.rim.device.api.system.Bitmap;
Import net.rim.device.api.system.Display;
Import net.rim.device.api.ui.DrawStyle;
Import net.rim.device.api.ui.Field;
Import net.rim.device.api.ui.FieldChangeListener;
Import net.rim.device.api.ui.Graphics;
Import net.rim.device.api.ui.Manager;
Import net.rim.device.api.ui.UiApplication;
Import net.rim.device.api.ui.component.ListField;
Import net.rim.device.api.ui.component.ListFieldCallback;
Import net.rim.device.api.ui.container.MainScreen;
Import net.rim.device.api.ui.container.VerticalFieldManager;
Import net.rim.device.api.xml.parsers.DocumentBuilder;
Import net.rim.device.api.xml.parsers.DocumentBuilderFactory;to import org.W3C.DOM.document;
Import org.w3c.dom.Node;
Import org.w3c.dom.NodeList;extends xmlparsing public class UiApplication implements ListFieldCallback, FieldChangeListener
{Public Shared Sub main (String [] args)
{
xmlparsing app = new xmlparsing();
app.enterEventDispatcher ();
}public long mycolor;
Connection _connectionthread;
private static ListField _list;
private static Vector listElements is new Vector();.
public display display = new MainScreen();
MainManager VerticalFieldManager;
VerticalFieldManager subManager;public xmlparsing()
{
Super();
pushScreen (screen);final Bitmap Imagearriereplan = Bitmap.getBitmapResource ("blackbackground.png");
mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL |) Manager.NO_VERTICAL_SCROLLBAR)
{public void paint (Graphics graphics)
{
graphics.drawBitmap (0, 0, Display.getWidth (), Display.getHeight (), Imagearriereplan, 0, 0);Super.Paint (Graphics);
}};
subManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL |) Manager.VERTICAL_SCROLLBAR)
{
protected void sublayout (int maxWidth, maxHeight int)
{
int displayWidth = Display.getWidth ();
int displayHeight = Display.getHeight ();Super.sublayout (displayWidth, displayHeight);
setExtent (displayWidth, displayHeight);
}
};Screen.Add (mainManager);
_list = new ListField()
{
public void paint (Graphics graphics)
{
graphics.setColor ((int) mycolor);
Super.Paint (Graphics);}
};
myColor = 0x00FFFFFF;
_list. Invalidate();
_list.setEmptyString ("* only supplies not available *", DrawStyle.HCENTER "");
_list.setRowHeight (50);
_list.setCallback (this);
mainManager.add (subManager);
listElements.removeAllElements ();
_connectionthread = New Connection();
_connectionthread. Start();
}protected boolean navigationClick (int status, int time)
{
Try
{
Here, go to another screen if you need.}
catch (System.Exception e)
{
System.out.println ("Exception:-: navigationClick()" + try ());
}
Returns true;
}private class login extends thread
{
Public connection()
{
Super();
}public void run() {}
Doc document;
StreamConnection conn = null;
InputStream is = null;
try {}Conn = Connector.open (StreamConnection) ("http://ec2-54-248-241-248.ap-northeast-1.compute.amazonaws.com/koperasi-akr-trial/cgi-bin/gw-pinjama...
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance ();
docBuilderFactory.setIgnoringElementContentWhitespace (true);
docBuilderFactory.setCoalescing (true);
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder ();
docBuilder.isValidating ();
is = conn.openInputStream ();
doc = docBuilder.parse (is);
doc.getDocumentElement () .normalize ();
List of NodeList = doc.getElementsByTagName ("ID");
for (int i = 0; i)< list.getlength();="" i++)="">
Node node = list.item (i) .getFirstChild ();
listElements.addElement (textNode.getNodeValue ());
}
} catch (Exception e) {}
System.out.println (try ());
} {Finally
If (is! = null) {}
try {is.close ();
} catch (IOException ignored) {}
} If (conn! = null) {}
Try {conn.close () ;}
catch (IOException ignored) {}
}} UiApplication.getUiApplication () .invokeLater (new Runnable() {}
public void run() {}
_list. SetSize (listElements.Size ());
subManager.add (_list);
Screen.Invalidate ();
}
});
}}
' public void drawListRow (list ListField, Graphics g, int index, int y, int w)
{
Your string = (String) listElements.elementAt (index);
int yPos = 0 + y;
g.drawLine (0, yPos, w, yPos);
g.drawText (, 5, 15 + y, 0, w);
}public {get {Object (ListField list, int index)
{
Return listElements.elementAt (index);
}
public int indexOfList (String prefix, ListField list, int, string)
{
Return listElements.indexOf (prefix, string);
}
public int getPreferredWidth (ListField list)
{
Return Display.getWidth ();
}
public final void insert (String toInsert, int index) {}
listElements.addElement (toInsert);
}' Public Sub fieldChanged (field field, int context) {}
}
}Thank you.
I told you that replace the navigationclick() method where initialize you your listfield
as I think that changing your code and then answer me
_list = new ListField() { protected boolean navigationClick(int status, int time) { Dialog.inform("hi"); return true; } public void paint(Graphics graphics) { graphics.setColor((int) mycolor); super.paint(graphics); } };
-
How to get the physical size of the screen?
Hi all
How to get the physical width and height of the screen (not resolution) in inches or in centimeters?
Is there a method to do
Thank you very much
Display.getWidth () and Display.getHeight () you will get the number of pixels.
Display.getHorizontalResolution (); and Display.getVerticalResolution () to get the pixels per meter. Then by dividing appropriately you can find the actual size.
-
How to get the width and height of Flex Mobile view?
Hello
The following instructions can get the width and height of the current Flex app:
var request: UIComponent = FlexGlobals.topLevelApplication as UIComponent;
trace (application. Width);
trace (application. Height);
But I don't know how to get the width and height of mobile display Flex current (i.e. the content size excludes bar action and the Navigation bar). Why the "this.width" always returns 0?
Thank you!
Looks like you're running in this bug: https://bugs.adobe.com/jira/browse/SDK-30070
-
How to get the color of the text information in the text layer?
How to get the color of the text information in the text layer? I mean using scripts Photoshop, Version of Photoshop CS 8.0
The color textItem is readable for me in VBS Note expects the activeLayer be a textLayer and displays the HexValue of the color of the text.
Option Explicit Dim appRef Dim docRef Dim textItemRef Dim artLayerRef Dim textColor Set appRef = CreateObject( "Photoshop.Application" ) appRef.BringToFront Set docRef = appRef.ActiveDocument Set artLayerRef = docRef.ActiveLayer Set textItemRef = artLayerRef.TextItem Set textColor = textItemRef.Color MsgBox textColor.RGB.HexValue
And returns the color of the text if the text is the same color. But if the text is more than a color textItem.color returns only the color of the first text range.
-
How to get the size of the loaded swf file?
final/public class main extends Sprite
{
public void main()
{
loaderInfo.addEventListener (Event.COMPLETE, _onLoadCompleted);
}
private void _onLoadCompleted(event: Event): void
{
var tw: int = stage.width;
var e: int = stage.height;
TSW var: int = stage.stageWidth;
tsh var: int = stage.stageHeight;}
}
Above is my project simple as3 in flex builder 3.
My screen resolution is 1920 * 1080, when debugging, the SWF is stretched to the full EI client area, but the stage.stageWidth is 500 and the stage.stageHeight is 375, stage.widht and stage.height are 0, who can tell me why and how to get the right size of the SWF, named the area size customer of EI in this situation?
Thank you very much!
The HTML wrapper can resize the SWF later, so wait a frame and recheck stageWidth/stageHeight.
Alex Harui
Flex SDK Developer
Adobe Systems Inc..
-
Heard speak adds the new on Fire Fox. Where and how to get the new Firefox add - one of who is spying on us. Please mail to maheshubhayakar at rediffmail.com
edited by email address - moderator
It is helpful if you provide a link to the article you were reading.
-
I rolled again Firefox 4.0 to 3.6 and now my navigation bar still looks like instead of 3.6 4.0 how to get the old layout back?
The fastest way is to use the option 'Restore the default toolbar set' as shown here - https://support.mozilla.com/kb/Back+and+forward+or+other+toolbar+items+are+missing
-
I borrowed a camcorder tape Sony that has an IEEE 1394 (ilink Sony) and eager to download video from my iMac.
It would connect to the thunderbolt via an adapter port?
I have a cable of firewire 800 and wanting to know how to get the video from my iMac via this cable.
Appreciate any help you can give :)
You want a Thunderbolt Apple FireWire adapter. Here is a link (to the US store):
Sorry, I don't know what software you need to play your video, once you get the cable work.
-
How to get the film on the second screen and cut on normal?
How to get the film on the second screen and cut on normal?
iMovie 10 does not support using double screen, tou need to FCP to do.
Geoff.
-
Chart WPF: How to get the limits of PlotArea and axes
I can't find explicit methods to get limits of PlotArea and axes.
Please let me know workarounds if they are available. Actually a post explains how to get the PlotArea limits using RangeCursor. Are there alternative means for shafts?
The photo below shows what I did in WinForms with the methods GetBounds and HitTest. I would like to draw the ornaments on the chart in WPF.
I have attached a code example of this look ornaments around the plot area and the scales.
Note that this relies on implementation details of the current version of WPF controls for the ornaments of the scale, as it was more effective than gradually points to test in the graph using the
GetScaleAt
method. We have intentionally left much of the underlying primitive types with a minimum documentation, like us they have changed in the past and may change in the future. Although these exact members can be removed in a future release, we do not expect to provide an equivalent function and stabilize the primitive API over time. -
How to get the string (specified by row and column) of txt file with labview
Hello world
How to get the string (specified by row and column) of txt file with labview
THX
As far as I know, a text file has no column. Be more specific. Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character? You can read from the spreadsheet String function and set the delimiter to a space. This will produce a 2D channels table. Then use the table to index and give the line number and column number.
Maybe you are looking for
-
How can I remove "-" at the beginning of my emails when you use a custom stationery?
is it possible to remove "-" synbols since the beginning of my e-mail after I applied a custom stationery or signature?What does "-" means or represent?
-
Serious problem with keyboard on Satellite M70-267
The Lanaguage keyboard is in the United Kingdom. The keyboard is messed up seriously and I can't understand why.I can press any letter / number and it will give me something totally different, like for example when I press space bar the screen resolu
-
How can I create next. flat and add a colum with VI and true Sub VI falseSub?
-
How to restore a catalog from elements 6 to a new PC with items 14
How to restore a catalog of items 6 to a new PC with items 14. The restoration under file option is grayed out.
-
I want to cancel my plan.
I want to cancel my plan.