Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ac6cda4d
Commit
ac6cda4d
authored
Sep 23, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes some of the artifacts from textured lines
parent
53f83f79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
textured_line.dart
packages/flutter_sprites/lib/textured_line.dart
+22
-2
No files found.
packages/flutter_sprites/lib/textured_line.dart
View file @
ac6cda4d
...
...
@@ -75,6 +75,8 @@ class TexturedLinePainter {
_calculatedTextureStops
=
null
;
}
bool
removeArtifacts
=
true
;
sky
.
TransferMode
transferMode
=
sky
.
TransferMode
.
srcOver
;
Paint
_cachedPaint
=
new
Paint
();
...
...
@@ -184,8 +186,26 @@ class TexturedLinePainter {
Offset
offset0
=
new
Offset
(
miter
[
0
]
*
halfWidth
,
miter
[
1
]
*
halfWidth
);
Offset
offset1
=
new
Offset
(-
miter
[
0
]
*
halfWidth
,
-
miter
[
1
]
*
halfWidth
);
vertices
.
add
(
point
+
offset0
);
vertices
.
add
(
point
+
offset1
);
Point
vertex0
=
point
+
offset0
;
Point
vertex1
=
point
+
offset1
;
int
vertexCount
=
vertices
.
length
;
if
(
removeArtifacts
&&
vertexCount
>=
2
)
{
Point
oldVertex0
=
vertices
[
vertexCount
-
2
];
Point
oldVertex1
=
vertices
[
vertexCount
-
1
];
Point
intersection
=
GameMath
.
lineIntersection
(
oldVertex0
,
oldVertex1
,
vertex0
,
vertex1
);
if
(
intersection
!=
null
)
{
if
(
GameMath
.
pointQuickDist
(
vertex0
,
intersection
)
<
GameMath
.
pointQuickDist
(
vertex1
,
intersection
))
{
vertex0
=
oldVertex0
;
}
else
{
vertex1
=
oldVertex1
;
}
}
}
vertices
.
add
(
vertex0
);
vertices
.
add
(
vertex1
);
}
void
_calculateTextureStops
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment