Class Color
- All Implemented Interfaces:
Proxy
PangoColor structure is used to
represent a color in an uncalibrated RGB color-space.-
Constructor Summary
ConstructorsConstructorDescriptionColor()Allocate a new Color.Color(short red, short green, short blue) Allocate a new Color with the fields set to the provided values.Allocate a new Color with the fields set to the provided values.Allocate a new Color.Color(MemorySegment address) Create a Color proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescription@Nullable Colorcopy()Creates a copy ofsrc.voidfree()Frees a color allocated bycopy().static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Color classbooleanFill in the fields of a color from a string specification.booleanparseWithAlpha(@Nullable Out<Short> alpha, String spec) Fill in the fields of a color from a string specification.shortreadBlue()Read the value of the fieldblue.shortRead the value of the fieldgreen.shortreadRed()Read the value of the fieldred.toString()Returns a textual specification ofcolor.voidwriteBlue(short blue) Write a value in the fieldblue.voidwriteGreen(short green) Write a value in the fieldgreen.voidwriteRed(short red) Write a value in the fieldred.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Color
Create a Color proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Color
Allocate a new Color.- Parameters:
arena- to control the memory allocation scope
-
Color
public Color()Allocate a new Color. The memory is allocated withArena.ofAuto(). -
Color
Allocate a new Color with the fields set to the provided values.- Parameters:
red- value for the fieldredgreen- value for the fieldgreenblue- value for the fieldbluearena- to control the memory allocation scope
-
Color
public Color(short red, short green, short blue) Allocate a new Color with the fields set to the provided values. The memory is allocated withArena.ofAuto().- Parameters:
red- value for the fieldredgreen- value for the fieldgreenblue- value for the fieldblue
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readRed
public short readRed()Read the value of the fieldred.- Returns:
- The value of the field
red
-
writeRed
public void writeRed(short red) Write a value in the fieldred.- Parameters:
red- The new value for the fieldred
-
readGreen
public short readGreen()Read the value of the fieldgreen.- Returns:
- The value of the field
green
-
writeGreen
public void writeGreen(short green) Write a value in the fieldgreen.- Parameters:
green- The new value for the fieldgreen
-
readBlue
public short readBlue()Read the value of the fieldblue.- Returns:
- The value of the field
blue
-
writeBlue
public void writeBlue(short blue) Write a value in the fieldblue.- Parameters:
blue- The new value for the fieldblue
-
copy
-
free
public void free()Frees a color allocated bycopy(). -
parse
Fill in the fields of a color from a string specification.The string can either one of a large set of standard names. (Taken from the CSS Color specification, or it can be a value in the form
#rgb,#rrggbb,#rrrgggbbbor#rrrrggggbbbb, wherer,gandbare hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is#fff,#ffffff,#fffffffffand#ffffffffffff.)- Parameters:
spec- a string specifying the new color- Returns:
trueif parsing of the specifier succeeded, otherwisefalse
-
parseWithAlpha
Fill in the fields of a color from a string specification.The string can either one of a large set of standard names. (Taken from the CSS Color specification, or it can be a hexadecimal value in the form
#rgb,#rrggbb,#rrrgggbbbor#rrrrggggbbbbwherer,gandbare hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is#fff,#ffffff,#fffffffffand#ffffffffffff.)Additionally, parse strings of the form
#rgba,#rrggbbaa,#rrrrggggbbbbaaaa, ifalphais notnull, and setalphato the value specified by the hex digits fora. If no alpha component is found inspec,alphais set to 0xffff (for a solid color).- Parameters:
alpha- return location for alphaspec- a string specifying the new color- Returns:
trueif parsing of the specifier succeeded, otherwisefalse- Since:
- 1.46
-
toString
Returns a textual specification ofcolor.The string is in the hexadecimal form
#rrrrggggbbbb, wherer,gandbare hex digits representing the red, green, and blue components respectively.
-