Class Stroke
- All Implemented Interfaces:
Proxy
- Since:
- 4.14
-
Constructor Summary
ConstructorsConstructorDescriptionStroke(float lineWidth) Creates a newGskStrokewith the givenlineWidth.Stroke(MemorySegment address) Create a Stroke proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of aGskStroke.static booleanequal(@Nullable MemorySegment stroke1, @Nullable MemorySegment stroke2) Checks if two strokes are identical.voidfree()Frees aGskStroke.@org.jspecify.annotations.Nullable float @Nullable []getDash()Gets the dash array in use.floatGets the dash offset.Gets the line cap used.Gets the line join used.floatGets the line width used.floatGets the miter limit.static @Nullable TypegetType()Get the GType of the Stroke classvoidsetDash(@org.jspecify.annotations.Nullable float @Nullable [] dash) Sets the dash pattern to use.voidsetDashOffset(float offset) Sets the offset into the dash pattern where dashing should begin.voidsetLineCap(LineCap lineCap) Sets the line cap to be used when stroking.voidsetLineJoin(LineJoin lineJoin) Sets the line join to be used when stroking.voidsetLineWidth(float lineWidth) Sets the line width to be used when stroking.voidsetMiterLimit(float limit) Sets the miter limit to be used when stroking.voidtoCairo(org.freedesktop.cairo.Context cr) A helper function that sets the stroke parameters of a cairo context from aGskStroke.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Stroke
Create a Stroke proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Stroke
public Stroke(float lineWidth) Creates a newGskStrokewith the givenlineWidth.- Parameters:
lineWidth- line width of the stroke. Must be > 0- Since:
- 4.14
-
-
Method Details
-
getType
-
equal
Checks if two strokes are identical.- Parameters:
stroke1- the first strokestroke2- the second stroke- Returns:
- true if the two strokes are equal, false otherwise
- Since:
- 4.14
-
copy
-
free
public void free()Frees aGskStroke.- Since:
- 4.14
-
getDash
public @org.jspecify.annotations.Nullable float @Nullable [] getDash()Gets the dash array in use.- Returns:
- the dash array or
NULLif the dash array is empty - Since:
- 4.14
-
getDashOffset
public float getDashOffset()Gets the dash offset.- Returns:
- the dash offset
- Since:
- 4.14
-
getLineCap
Gets the line cap used.See
Gsk.LineCapfor details.- Returns:
- the line cap
- Since:
- 4.14
-
getLineJoin
Gets the line join used.See
Gsk.LineJoinfor details.- Returns:
- the line join
- Since:
- 4.14
-
getLineWidth
public float getLineWidth()Gets the line width used.- Returns:
- the line width
- Since:
- 4.14
-
getMiterLimit
public float getMiterLimit()Gets the miter limit.- Returns:
- the miter limit
- Since:
- 4.14
-
setDash
public void setDash(@org.jspecify.annotations.Nullable float @Nullable [] dash) Sets the dash pattern to use.A dash pattern is specified by an array of alternating non-negative values. Each value provides the length of alternate "on" and "off" portions of the stroke.
Each "on" segment will have caps applied as if the segment were a separate contour. In particular, it is valid to use an "on" length of 0 with
Gsk.LineCap.roundorGsk.LineCap.squareto draw dots or squares along a path.If
nDashis 0, if all elements indashare 0, or if there are negative values indash,then dashing is disabled.If
nDashis 1, an alternating "on" and "off" pattern with the single dash length provided is assumed.If
nDashis uneven, the dash array will be used with the first element indashdefining an "on" or "off" in alternating passes through the array.You can specify a starting offset into the dash with
setDashOffset(float).- Parameters:
dash- the array of dashes- Since:
- 4.14
-
setDashOffset
public void setDashOffset(float offset) Sets the offset into the dash pattern where dashing should begin.This is an offset into the length of the path, not an index into the array values of the dash array.
See
setDash(float[])for more details on dashing.- Parameters:
offset- offset into the dash pattern- Since:
- 4.14
-
setLineCap
Sets the line cap to be used when stroking.See
Gsk.LineCapfor details.- Parameters:
lineCap- the line cap- Since:
- 4.14
-
setLineJoin
Sets the line join to be used when stroking.See
Gsk.LineJoinfor details.- Parameters:
lineJoin- the line join to use- Since:
- 4.14
-
setLineWidth
public void setLineWidth(float lineWidth) Sets the line width to be used when stroking.The line width must be >= 0.
- Parameters:
lineWidth- width of the line in pixels- Since:
- 4.14
-
setMiterLimit
public void setMiterLimit(float limit) Sets the miter limit to be used when stroking.The miter limit is the distance from the corner where sharp turns of joins get cut off.
The limit is specfied in units of line width and must be non-negative.
For joins of type
Gsk.LineJoin.miterthat exceed the miter limit, the join gets rendered as if it was of typeGsk.LineJoin.bevel.- Parameters:
limit- the miter limit- Since:
- 4.14
-
toCairo
public void toCairo(org.freedesktop.cairo.Context cr) A helper function that sets the stroke parameters of a cairo context from aGskStroke.- Parameters:
cr- the cairo context to configure- Since:
- 4.14
-