Java Doc for BasicStroke.java in  » 6.0-JDK-Modules » j2me » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.BasicStroke

BasicStroke
public class BasicStroke implements Stroke(Code)
The BasicStroke class defines a basic set of rendering attributes for the outlines of graphics primitives, which are rendered with a Graphics2D object that has its Stroke attribute set to this BasicStroke. The rendering attributes defined by BasicStroke describe the shape of the mark made by a pen drawn along the outline of a Shape and the decorations applied at the ends and joins of path segments of the Shape. These rendering attributes include:
width
The pen width, measured perpendicularly to the pen trajectory.
end caps
The decoration applied to the ends of unclosed subpaths and dash segments. Subpaths that start and end on the same point are still considered unclosed if they do not have a CLOSE segment. See java.awt.geom.PathIterator.SEG_CLOSE SEG_CLOSE for more information on the CLOSE segment. The three different decorations are: BasicStroke.CAP_BUTT , BasicStroke.CAP_ROUND , and BasicStroke.CAP_SQUARE .
line joins
The decoration applied at the intersection of two path segments and at the intersection of the endpoints of a subpath that is closed using java.awt.geom.PathIterator.SEG_CLOSE SEG_CLOSE . The three different decorations are: BasicStroke.JOIN_BEVEL , BasicStroke.JOIN_MITER , and BasicStroke.JOIN_ROUND .
miter limit
The limit to trim a line join that has a JOIN_MITER decoration. A line join is trimmed when the ratio of miter length to stroke width is greater than the miterlimit value. The miter length is the diagonal length of the miter, which is the distance between the inside corner and the outside corner of the intersection. The smaller the angle formed by two line segments, the longer the miter length and the sharper the angle of intersection. The default miterlimit value of 10.0f causes all angles less than 11 degrees to be trimmed. Trimming miters converts the decoration of the line join to bevel.
dash attributes
The definition of how to make a dash pattern by alternating between opaque and transparent sections.
All attributes that specify measurements and distances controlling the shape of the returned outline are measured in the same coordinate system as the original unstroked Shape argument. When a Graphics2D object uses a Stroke object to redefine a path during the execution of one of its draw methods, the geometry is supplied in its original form before the Graphics2D transform attribute is applied. Therefore, attributes such as the pen width are interpreted in the user space coordinate system of the Graphics2D object and are subject to the scaling and shearing effects of the user-space-to-device-space transform in that particular Graphics2D. For example, the width of a rendered shape's outline is determined not only by the width attribute of this BasicStroke, but also by the transform attribute of the Graphics2D object. Consider this code:
// sets the Graphics2D object's Tranform attribute g2d.scale(10, 10); // sets the Graphics2D object's Stroke attribute g2d.setStroke(new BasicStroke(1.5f));
Assuming there are no other scaling transforms added to the Graphics2D object, the resulting line will be approximately 15 pixels wide. As the example code demonstrates, a floating-point line offers better precision, especially when large transforms are used with a Graphics2D object. When a line is diagonal, the exact width depends on how the rendering pipeline chooses which pixels to fill as it traces the theoretical widened outline. The choice of which pixels to turn on is affected by the antialiasing attribute because the antialiasing rendering pipeline can choose to color partially-covered pixels.

For more information on the user space coordinate system and the rendering process, see the Graphics2D class comments.
See Also:   Graphics2D
version:
   1.37, 12/03/01
author:
   Jim Graham



Field Summary
final public static  intCAP_BUTT
     Ends unclosed subpaths and dash segments with no added decoration.
final public static  intCAP_ROUND
     Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen.
final public static  intCAP_SQUARE
     Ends unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.
final public static  intJOIN_BEVEL
     Joins path segments by connecting the outer corners of their wide outlines with a straight segment.
final public static  intJOIN_MITER
     Joins path segments by extending their outside edges until they meet.
final public static  intJOIN_ROUND
     Joins path segments by rounding off the corner at a radius of half the line width.
 intcap
    
 floatdash
    
 floatdash_phase
    
 intjoin
    
 floatmiterlimit
    
 floatwidth
    

Constructor Summary
public  BasicStroke(float width, int cap, int join, float miterlimit)
     Constructs a solid BasicStroke with the specified attributes.
public  BasicStroke(float width, int cap, int join)
     Constructs a solid BasicStroke with the specified attributes.
public  BasicStroke(float width)
     Constructs a solid BasicStroke with the specified line width and with default values for the cap and join styles.
public  BasicStroke()
     Constructs a new BasicStroke with defaults for all attributes.

Method Summary
public  booleanequals(Object obj)
     Tests if a specified object is equal to this BasicStroke by first testing if it is a BasicStroke and then comparing its width, join, cap, miter limit, dash, and dash phase attributes with those of this BasicStroke.
public  intgetEndCap()
     Returns the end cap style.
public  intgetLineJoin()
     Returns the line join style.
public  floatgetLineWidth()
     Returns the line width.
public  floatgetMiterLimit()
     Returns the limit of miter joins.
public  inthashCode()
     Returns the hashcode for this stroke.

Field Detail
CAP_BUTT
final public static int CAP_BUTT(Code)
Ends unclosed subpaths and dash segments with no added decoration.



CAP_ROUND
final public static int CAP_ROUND(Code)
Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen.



CAP_SQUARE
final public static int CAP_SQUARE(Code)
Ends unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.



JOIN_BEVEL
final public static int JOIN_BEVEL(Code)
Joins path segments by connecting the outer corners of their wide outlines with a straight segment.



JOIN_MITER
final public static int JOIN_MITER(Code)
Joins path segments by extending their outside edges until they meet.



JOIN_ROUND
final public static int JOIN_ROUND(Code)
Joins path segments by rounding off the corner at a radius of half the line width.



cap
int cap(Code)



dash
float dash(Code)



dash_phase
float dash_phase(Code)



join
int join(Code)



miterlimit
float miterlimit(Code)



width
float width(Code)




Constructor Detail
BasicStroke
public BasicStroke(float width, int cap, int join, float miterlimit)(Code)
Constructs a solid BasicStroke with the specified attributes.
Parameters:
  width - the width of the BasicStroke
Parameters:
  cap - the decoration of the ends of a BasicStroke
Parameters:
  join - the decoration applied where path segments meet
Parameters:
  miterlimit - the limit to trim the miter join
throws:
  IllegalArgumentException - if width is negative
throws:
  IllegalArgumentException - if cap is not eitherCAP_BUTT, CAP_ROUND or CAP_SQUARE
throws:
  IllegalArgumentException - if miterlimit is lessthan 1 and join is JOIN_MITER
throws:
  IllegalArgumentException - if join is noteither JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER



BasicStroke
public BasicStroke(float width, int cap, int join)(Code)
Constructs a solid BasicStroke with the specified attributes. The miterlimit parameter is unnecessary in cases where the default is allowable or the line joins are not specified as JOIN_MITER.
Parameters:
  width - the width of the BasicStroke
Parameters:
  cap - the decoration of the ends of a BasicStroke
Parameters:
  join - the decoration applied where path segments meet
throws:
  IllegalArgumentException - if width is negative
throws:
  IllegalArgumentException - if cap is not eitherCAP_BUTT, CAP_ROUND or CAP_SQUARE
throws:
  IllegalArgumentException - if join is noteither JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER



BasicStroke
public BasicStroke(float width)(Code)
Constructs a solid BasicStroke with the specified line width and with default values for the cap and join styles.
Parameters:
  width - the width of the BasicStroke
throws:
  IllegalArgumentException - if width is negative



BasicStroke
public BasicStroke()(Code)
Constructs a new BasicStroke with defaults for all attributes. The default attributes are a solid line of width 1.0, CAP_SQUARE, JOIN_MITER, a miter limit of 10.0.




Method Detail
equals
public boolean equals(Object obj)(Code)
Tests if a specified object is equal to this BasicStroke by first testing if it is a BasicStroke and then comparing its width, join, cap, miter limit, dash, and dash phase attributes with those of this BasicStroke.
Parameters:
  obj - the specified object to compare to this BasicStroke true if the width, join, cap, miter limit, dash, anddash phase are the same for both objects;false otherwise.



getEndCap
public int getEndCap()(Code)
Returns the end cap style. the end cap style of this BasicStroke as oneof the static int values that define possible end capstyles.



getLineJoin
public int getLineJoin()(Code)
Returns the line join style. the line join style of the BasicStroke as oneof the static int values that define possible linejoin styles.



getLineWidth
public float getLineWidth()(Code)
Returns the line width. Line width is represented in user space, which is the default-coordinate space used by Java 2D. See the Graphics2D class comments for more information on the user space coordinate system. the line width of this BasicStroke.
See Also:   Graphics2D



getMiterLimit
public float getMiterLimit()(Code)
Returns the limit of miter joins. the limit of miter joins of the BasicStroke.



hashCode
public int hashCode()(Code)
Returns the hashcode for this stroke. a hash code for this stroke.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.