Java Doc for GradientPaint.java in  » 6.0-JDK-Core » AWT » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.GradientPaint

GradientPaint
public class GradientPaint implements Paint(Code)
The GradientPaint class provides a way to fill a Shape with a linear color gradient pattern. If Point P1 with Color C1 and Point P2 with Color C2 are specified in user space, the Color on the P1, P2 connecting line is proportionally changed from C1 to C2. Any point P not on the extended P1, P2 connecting line has the color of the point P' that is the perpendicular projection of P on the extended P1, P2 connecting line. Points on the extended line outside of the P1, P2 segment can be colored in one of two ways.
  • If the gradient is cyclic then the points on the extended P1, P2 connecting line cycle back and forth between the colors C1 and C2.
  • If the gradient is acyclic then points on the P1 side of the segment have the constant Color C1 while points on the P2 side have the constant Color C2.

See Also:   Paint
See Also:   Graphics2D.setPaint
version:
   10 Feb 1997


Field Summary
 Colorcolor1
    
 Colorcolor2
    
 booleancyclic
    
 Point2D.Floatp1
    
 Point2D.Floatp2
    

Constructor Summary
public  GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2)
     Constructs a simple acyclic GradientPaint object.
public  GradientPaint(Point2D pt1, Color color1, Point2D pt2, Color color2)
     Constructs a simple acyclic GradientPaint object.
public  GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2, boolean cyclic)
     Constructs either a cyclic or acyclic GradientPaint object depending on the boolean parameter.
public  GradientPaint(Point2D pt1, Color color1, Point2D pt2, Color color2, boolean cyclic)
     Constructs either a cyclic or acyclic GradientPaint object depending on the boolean parameter.

Method Summary
public  PaintContextcreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
     Creates and returns a context used to generate the color pattern.
Parameters:
  cm - ColorModel that receivesthe Paint data.
public  ColorgetColor1()
     Returns the color C1 anchored by the point P1.
public  ColorgetColor2()
     Returns the color C2 anchored by the point P2.
public  Point2DgetPoint1()
     Returns a copy of the point P1 that anchors the first color. a Point2D object that is a copy of the pointthat anchors the first color of this GradientPaint.
public  Point2DgetPoint2()
     Returns a copy of the point P2 which anchors the second color.
public  intgetTransparency()
     Returns the transparency mode for this GradientPaint.
public  booleanisCyclic()
     Returns true if the gradient cycles repeatedly between the two colors C1 and C2.

Field Detail
color1
Color color1(Code)



color2
Color color2(Code)



cyclic
boolean cyclic(Code)



p1
Point2D.Float p1(Code)



p2
Point2D.Float p2(Code)




Constructor Detail
GradientPaint
public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2)(Code)
Constructs a simple acyclic GradientPaint object.
Parameters:
  x1 - x coordinate of the first specifiedPoint in user space
Parameters:
  y1 - y coordinate of the first specifiedPoint in user space
Parameters:
  color1 - Color at the first specified Point
Parameters:
  x2 - x coordinate of the second specifiedPoint in user space
Parameters:
  y2 - y coordinate of the second specifiedPoint in user space
Parameters:
  color2 - Color at the second specified Point
throws:
  NullPointerException - if either one of colors is null



GradientPaint
public GradientPaint(Point2D pt1, Color color1, Point2D pt2, Color color2)(Code)
Constructs a simple acyclic GradientPaint object.
Parameters:
  pt1 - the first specified Point in user space
Parameters:
  color1 - Color at the first specified Point
Parameters:
  pt2 - the second specified Point in user space
Parameters:
  color2 - Color at the second specified Point
throws:
  NullPointerException - if either one of colors or points is null



GradientPaint
public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2, boolean cyclic)(Code)
Constructs either a cyclic or acyclic GradientPaint object depending on the boolean parameter.
Parameters:
  x1 - x coordinate of the first specifiedPoint in user space
Parameters:
  y1 - y coordinate of the first specifiedPoint in user space
Parameters:
  color1 - Color at the first specified Point
Parameters:
  x2 - x coordinate of the second specifiedPoint in user space
Parameters:
  y2 - y coordinate of the second specifiedPoint in user space
Parameters:
  color2 - Color at the second specified Point
Parameters:
  cyclic - true if the gradient pattern should cyclerepeatedly between the two colors; false otherwise



GradientPaint
public GradientPaint(Point2D pt1, Color color1, Point2D pt2, Color color2, boolean cyclic)(Code)
Constructs either a cyclic or acyclic GradientPaint object depending on the boolean parameter.
Parameters:
  pt1 - the first specified Point in user space
Parameters:
  color1 - Color at the first specified Point
Parameters:
  pt2 - the second specified Point in user space
Parameters:
  color2 - Color at the second specified Point
Parameters:
  cyclic - true if the gradient pattern should cyclerepeatedly between the two colors; false otherwise
throws:
  NullPointerException - if either one of colors or points is null




Method Detail
createContext
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)(Code)
Creates and returns a context used to generate the color pattern.
Parameters:
  cm - ColorModel that receivesthe Paint data. This is used only as a hint.
Parameters:
  deviceBounds - the device space bounding box of the graphics primitive being rendered
Parameters:
  userBounds - the user space bounding box of the graphics primitive being rendered
Parameters:
  xform - the AffineTransform from userspace into device space
Parameters:
  hints - the hints that the context object uses to choosebetween rendering alternatives the PaintContext that generates color patterns.
See Also:   PaintContext



getColor1
public Color getColor1()(Code)
Returns the color C1 anchored by the point P1. a Color object that is the coloranchored by P1.



getColor2
public Color getColor2()(Code)
Returns the color C2 anchored by the point P2. a Color object that is the coloranchored by P2.



getPoint1
public Point2D getPoint1()(Code)
Returns a copy of the point P1 that anchors the first color. a Point2D object that is a copy of the pointthat anchors the first color of this GradientPaint.



getPoint2
public Point2D getPoint2()(Code)
Returns a copy of the point P2 which anchors the second color. a Point2D object that is a copy of the pointthat anchors the second color of thisGradientPaint.



getTransparency
public int getTransparency()(Code)
Returns the transparency mode for this GradientPaint. an integer value representing this GradientPaintobject's transparency mode.
See Also:   Transparency



isCyclic
public boolean isCyclic()(Code)
Returns true if the gradient cycles repeatedly between the two colors C1 and C2. true if the gradient cycles repeatedlybetween the two colors; false otherwise.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(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.