Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2020-11-29 10:04:26 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2ca45107d161dc5a7355e38e1c7bdc0826f42321
2ca45107
1 parent
27b28b53
Add PdfGraphics.drawBox()
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
19 additions
and
24 deletions
pdf/lib/src/graphics.dart
pdf/lib/widgets/annotations.dart
pdf/lib/widgets/basic.dart
pdf/lib/widgets/chart/grid_axis.dart
pdf/lib/widgets/chart/grid_cartesian.dart
pdf/lib/widgets/clip.dart
pdf/lib/widgets/decoration.dart
pdf/lib/widgets/image.dart
pdf/lib/widgets/placeholders.dart
pdf/lib/widgets/widget.dart
pdf/lib/src/graphics.dart
View file @
2ca4510
...
...
@@ -234,6 +234,11 @@ class PdfGraphics {
buf
.
putString
(
' re
\n
'
);
}
/// Draws a Rectangle
void
drawBox
(
PdfRect
box
)
{
drawRect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
);
}
/// Draws a Rounded Rectangle
void
drawRRect
(
double
x
,
double
y
,
double
w
,
double
h
,
double
rv
,
double
rh
)
{
moveTo
(
x
,
y
+
rv
);
...
...
pdf/lib/widgets/annotations.dart
View file @
2ca4510
...
...
@@ -239,7 +239,7 @@ class Annotation extends SingleChildWidget {
void
debugPaint
(
Context
context
)
{
context
.
canvas
..
setFillColor
(
PdfColors
.
pink
)
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
fillPath
();
}
...
...
@@ -367,7 +367,7 @@ class Outline extends Anchor {
void
debugPaint
(
Context
context
)
{
context
.
canvas
..
setFillColor
(
PdfColors
.
pink100
)
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
fillPath
();
}
...
...
pdf/lib/widgets/basic.dart
View file @
2ca4510
...
...
@@ -333,7 +333,7 @@ class Align extends SingleChildWidget {
context
.
canvas
..
setStrokeColor
(
PdfColors
.
green
)
..
setLineWidth
(
1
)
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
);
..
draw
Box
(
box
);
if
(
child
==
null
)
{
context
.
canvas
.
strokePath
();
...
...
@@ -498,7 +498,7 @@ class FittedBox extends SingleChildWidget {
context
.
canvas
..
saveContext
()
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
clipPath
()
..
setTransform
(
mat
);
child
.
paint
(
context
);
...
...
pdf/lib/widgets/chart/grid_axis.dart
View file @
2ca4510
...
...
@@ -383,7 +383,7 @@ class FixedAxis<T extends num> extends GridAxis {
case
Axis
.
horizontal
:
context
.
canvas
..
setFillColor
(
PdfColors
.
grey300
)
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
fillPath
();
break
;
case
Axis
.
vertical
:
...
...
pdf/lib/widgets/chart/grid_cartesian.dart
View file @
2ca4510
...
...
@@ -97,12 +97,7 @@ class CartesianGrid extends ChartGrid {
void
clip
(
Context
context
,
PdfPoint
size
)
{
context
.
canvas
..
saveContext
()
..
drawRect
(
gridBox
.
left
,
gridBox
.
bottom
,
gridBox
.
width
,
gridBox
.
height
,
)
..
drawBox
(
gridBox
)
..
clipPath
();
}
...
...
pdf/lib/widgets/clip.dart
View file @
2ca4510
...
...
@@ -27,7 +27,7 @@ class ClipRect extends SingleChildWidget {
context
.
canvas
..
setStrokeColor
(
PdfColors
.
deepPurple
)
..
setLineWidth
(
1
)
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
strokePath
();
}
...
...
@@ -40,7 +40,7 @@ class ClipRect extends SingleChildWidget {
mat
.
translate
(
box
.
x
,
box
.
y
);
context
.
canvas
..
saveContext
()
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
clipPath
()
..
setTransform
(
mat
);
child
.
paint
(
context
);
...
...
pdf/lib/widgets/decoration.dart
View file @
2ca4510
...
...
@@ -197,7 +197,7 @@ class DecorationImage {
context
.
canvas
..
saveContext
()
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
clipPath
()
..
setTransform
(
mat
)
..
drawImage
(
_image
,
0
,
0
,
imageSize
.
x
,
imageSize
.
y
)
...
...
@@ -645,7 +645,7 @@ class BoxDecoration {
);
}
}
context
.
canvas
.
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
);
context
.
canvas
.
draw
Box
(
box
);
}
else
{
if
(
boxShadow
!=
null
)
{
for
(
final
s
in
boxShadow
)
{
...
...
@@ -686,7 +686,7 @@ class BoxDecoration {
switch
(
shape
)
{
case
BoxShape
.
rectangle
:
if
(
borderRadius
==
null
)
{
context
.
canvas
.
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
);
context
.
canvas
.
draw
Box
(
box
);
}
else
{
borderRadius
.
paint
(
context
,
box
);
}
...
...
pdf/lib/widgets/image.dart
View file @
2ca4510
...
...
@@ -64,12 +64,7 @@ void _drawImageRect(PdfGraphics canvas, PdfImage image, PdfRect sourceRect,
canvas
.
saveContext
();
canvas
..
drawRect
(
destinationRect
.
x
,
destinationRect
.
y
,
destinationRect
.
width
,
destinationRect
.
height
,
)
..
drawBox
(
destinationRect
)
..
clipPath
()
..
drawImage
(
image
,
...
...
pdf/lib/widgets/placeholders.dart
View file @
2ca4510
...
...
@@ -63,7 +63,7 @@ class Placeholder extends Widget {
..
lineTo
(
box
.
right
,
box
.
top
)
..
moveTo
(
box
.
x
,
box
.
top
)
..
lineTo
(
box
.
right
,
box
.
y
)
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
setLineWidth
(
strokeWidth
)
..
strokePath
();
}
...
...
pdf/lib/widgets/widget.dart
View file @
2ca4510
...
...
@@ -135,7 +135,7 @@ abstract class Widget {
context
.
canvas
..
setStrokeColor
(
PdfColors
.
purple
)
..
setLineWidth
(
1
)
..
draw
Rect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
)
..
draw
Box
(
box
)
..
strokePath
();
}
}
...
...
Please
register
or
login
to post a comment