Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code LNG204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.
java.awt

Class GradientPaint

  • All Implemented Interfaces:
    Paint, Transparency

    public class GradientPaint
    extends Object
    implements Paint
    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, Graphics2D.setPaint(java.awt.Paint)
    • Constructor Detail

      • GradientPaint

        public GradientPaint(float x1,
                     float y1,
                     Color color1,
                     float x2,
                     float y2,
                     Color color2)
        Constructs a simple acyclic GradientPaint object.
        Parameters:
        x1 - x coordinate of the first specified Point in user space
        y1 - y coordinate of the first specified Point in user space
        color1 - Color at the first specified Point
        x2 - x coordinate of the second specified Point in user space
        y2 - y coordinate of the second specified Point in user space
        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)
        Constructs a simple acyclic GradientPaint object.
        Parameters:
        pt1 - the first specified Point in user space
        color1 - Color at the first specified Point
        pt2 - the second specified Point in user space
        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)
        Constructs either a cyclic or acyclic GradientPaint object depending on the boolean parameter.
        Parameters:
        x1 - x coordinate of the first specified Point in user space
        y1 - y coordinate of the first specified Point in user space
        color1 - Color at the first specified Point
        x2 - x coordinate of the second specified Point in user space
        y2 - y coordinate of the second specified Point in user space
        color2 - Color at the second specified Point
        cyclic - true if the gradient pattern should cycle repeatedly between the two colors; false otherwise
      • GradientPaint

        @ConstructorProperties(value={"point1","color1","point2","color2","cyclic"})
        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.
        Parameters:
        pt1 - the first specified Point in user space
        color1 - Color at the first specified Point
        pt2 - the second specified Point in user space
        color2 - Color at the second specified Point
        cyclic - true if the gradient pattern should cycle repeatedly between the two colors; false otherwise
        Throws:
        NullPointerException - if either one of colors or points is null
    • Method Detail

      • getPoint1

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

        public Color getColor1()
        Returns the color C1 anchored by the point P1.
        Returns:
        a Color object that is the color anchored by P1.
      • getPoint2

        public Point2D getPoint2()
        Returns a copy of the point P2 which anchors the second color.
        Returns:
        a Point2D object that is a copy of the point that anchors the second color of this GradientPaint.
      • getColor2

        public Color getColor2()
        Returns the color C2 anchored by the point P2.
        Returns:
        a Color object that is the color anchored by P2.
      • isCyclic

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

        public int getTransparency()
        Returns the transparency mode for this GradientPaint.
        Specified by:
        getTransparency in interface Transparency
        Returns:
        an integer value representing this GradientPaint object's transparency mode.
        See Also:
        Transparency

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-java/awt/gradientpaint.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut