We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › PShape get width height
Page Index Toggle Pages: 1
PShape get width height (Read 465 times)
PShape get width height
Oct 18th, 2008, 2:36pm
 
I might be missing something here but with the depreciated SVG type it was very easy to extract the width and height of an element... However with the new PShape class which is a massive improvement on the original SVG handling [less code] I am having difficulties accessing these properties. It would be much better to sniff this with code rather than have to explicitly state the width and height of my SVG's somewhere within code... can anybody help me on this ...

[PS] the error I recieve is:
The field PShape.width is not visible
Re: PShape get width height
Reply #1 - Oct 18th, 2008, 3:19pm
 
Use getWidth() and getHeight(). It's been moved to a method because 1) sometimes it will involve calculations on the bounding box, and 2) we don't want people setting the width/height variables (at least on SVG).
Re: PShape get width height
Reply #2 - Oct 19th, 2008, 2:47pm
 
Tx for the fast response ... perfect ... will start looking at http://dev.processing.org/reference/core/javadoc/processing/core/ for methods rather than http://processing.org/reference/ which does not seem to contain all available methods to a class.

Keep up the good work - amazing software.
Re: PShape get width height
Reply #3 - Oct 19th, 2008, 2:55pm
 
Actually - I have a little question for the dev team - SVG is a relatively new format to me but I am getting to grips with it and the possibilities seem interesting cos it is a data based format. Will the PShape class ever have a method which could grab all points/bezierVertex from within the SVG and return them as an array/object.

Visually it could be very interesting what could be done with this data if it could be manipulated with some criteria and applied back to the original shape.

I will examine the methods/properties for this class a bit more.
Re: PShape get width height
Reply #4 - Oct 19th, 2008, 3:20pm
 
From revisions.txt:

+ The PShape object is just a container for now, but will someday provide
 methods for accessing actual vertex information.
Page Index Toggle Pages: 1