Class Color
- All Implemented Interfaces:
Proxy
PangoColor
structure is used to
represent a color in an uncalibrated RGB color-space.-
Constructor Summary
ConstructorDescriptionColor()
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 TypeMethodDescriptioncopy()
Creates a copy of this Color.void
free()
Frees a color allocated bycopy()
.static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the Color classboolean
Fill in the fields of a color from a string specification.boolean
parseWithAlpha
(@Nullable Out<Short> alpha, String spec) Fill in the fields of a color from a string specification.short
readBlue()
Read the value of the fieldblue
.short
Read the value of the fieldgreen
.short
readRed()
Read the value of the fieldred
.toString()
Returns a textual specification of this Color.void
writeBlue
(short blue) Write a value in the fieldblue
.void
writeGreen
(short green) Write a value in the fieldgreen
.void
writeRed
(short red) Write a value in the fieldred
.Methods inherited from class io.github.jwharm.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 fieldred
green
- value for the fieldgreen
blue
- value for the fieldblue
arena
- 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 fieldred
green
- value for the fieldgreen
blue
- 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
,#rrrgggbbb
or#rrrrggggbbbb
, wherer
,g
andb
are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is#fff
,#ffffff
,#fffffffff
and#ffffffffffff
.)- Parameters:
spec
- a string specifying the new color- Returns:
true
if 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
,#rrrgggbbb
or#rrrrggggbbbb
wherer
,g
andb
are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is#fff
,#ffffff
,#fffffffff
and#ffffffffffff
.)Additionally, parse strings of the form
#rgba
,#rrggbbaa
,#rrrrggggbbbbaaaa
, ifalpha
is notnull
, and setalpha
to the value specified by the hex digits fora
. If no alpha component is found inspec
,alpha
is set to 0xffff (for a solid color).- Parameters:
alpha
- return location for alphaspec
- a string specifying the new color- Returns:
true
if parsing of the specifier succeeded, otherwisefalse
-
toString
Returns a textual specification of this Color.The string is in the hexadecimal form
#rrrrggggbbbb
, wherer
,g
andb
are hex digits representing the red, green, and blue components respectively.
-