Package limn.graphics
Record Class LinearGradient
java.lang.Object
java.lang.Record
limn.graphics.LinearGradient
- All Implemented Interfaces:
Paint
public record LinearGradient(float x0, float y0, float x1, float y1, Color start, Color end)
extends Record
implements Paint
Two-stop linear gradient from
(x0,y0) (color start) to
(x1,y1) (color end), clamped beyond the endpoints. Points
are in the same logical coordinate space as the shape being painted.-
Constructor Summary
ConstructorsConstructorDescriptionLinearGradient(float x0, float y0, float x1, float y1, Color start, Color end) Creates an instance of aLinearGradientrecord class. -
Method Summary
Modifier and TypeMethodDescriptionend()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.start()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.floatx0()Returns the value of thex0record component.floatx1()Returns the value of thex1record component.floaty0()Returns the value of they0record component.floaty1()Returns the value of they1record component.
-
Constructor Details
-
LinearGradient
Creates an instance of aLinearGradientrecord class.- Parameters:
x0- the value for thex0record componenty0- the value for they0record componentx1- the value for thex1record componenty1- the value for they1record componentstart- the value for thestartrecord componentend- the value for theendrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
x0
public float x0()Returns the value of thex0record component.- Returns:
- the value of the
x0record component
-
y0
public float y0()Returns the value of they0record component.- Returns:
- the value of the
y0record component
-
x1
public float x1()Returns the value of thex1record component.- Returns:
- the value of the
x1record component
-
y1
public float y1()Returns the value of they1record component.- Returns:
- the value of the
y1record component
-
start
Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-