mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
op/clip: make RoundCap and RoundJoin the default stroke style
There's an argument that rounded caps and joins are the simplest stroke, in that it can be defined to cover all pixels within lineWidth distance from the supporting path. However, the more important reason is that the compute renderer natively supports this stroke style (without dashes), and users that don't care (much) about the particular stroke style should get the efficient implementation. A good example is op/clip.Border that strokes a closed path, where the StrokeCap is irrelevant. This is a (subtle) API change. If you have code that relies on the default values of clip.StrokeStyle you may want to set Cap and Join explicitly. See the test changes for examples. On the other hand, you will get much better performance from the default Cap and Join values once the compute renderer becomes the default. Disablethe TestPaintClippedBorder test; dashes round-capped, round-joined strokes doesn't seem to work correctly. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+10
-10
@@ -45,30 +45,30 @@ type StrokeStyle struct {
|
||||
type StrokeCap uint8
|
||||
|
||||
const (
|
||||
// RoundCap caps stroked paths with a round cap, joining the right-hand and
|
||||
// left-hand sides of a stroked path with a half disc of diameter the
|
||||
// stroked path's width.
|
||||
RoundCap StrokeCap = iota
|
||||
|
||||
// FlatCap caps stroked paths with a flat cap, joining the right-hand
|
||||
// and left-hand sides of a stroked path with a straight line.
|
||||
FlatCap StrokeCap = iota
|
||||
FlatCap
|
||||
|
||||
// SquareCap caps stroked paths with a square cap, joining the right-hand
|
||||
// and left-hand sides of a stroked path with a half square of length
|
||||
// the stroked path's width.
|
||||
SquareCap
|
||||
|
||||
// RoundCap caps stroked paths with a round cap, joining the right-hand and
|
||||
// left-hand sides of a stroked path with a half disc of diameter the
|
||||
// stroked path's width.
|
||||
RoundCap
|
||||
)
|
||||
|
||||
// StrokeJoin describes how stroked paths are collated.
|
||||
type StrokeJoin uint8
|
||||
|
||||
const (
|
||||
// BevelJoin joins path segments with sharp bevels.
|
||||
BevelJoin StrokeJoin = iota
|
||||
|
||||
// RoundJoin joins path segments with a round segment.
|
||||
RoundJoin
|
||||
RoundJoin StrokeJoin = iota
|
||||
|
||||
// BevelJoin joins path segments with sharp bevels.
|
||||
BevelJoin
|
||||
)
|
||||
|
||||
// Dash records dashes' lengths and phase for a stroked path.
|
||||
|
||||
Reference in New Issue
Block a user