Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
esc_pos_print_plus
Project
Project
Details
Activity
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
Dio Maulana
esc_pos_print_plus
Commits
5bebb082
Commit
5bebb082
authored
Sep 04, 2019
by
Andrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
printImageRaster: added highDensity params.
parent
6017fbca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
printer.dart
lib/src/printer.dart
+6
-7
No files found.
lib/src/printer.dart
View file @
5bebb082
...
@@ -469,16 +469,18 @@ class Printer {
...
@@ -469,16 +469,18 @@ class Printer {
/// Print image using GS v 0 (obsolete command)
/// Print image using GS v 0 (obsolete command)
///
///
/// [image] is an instanse of class from [Image library](https://pub.dev/packages/image)
/// [image] is an instanse of class from [Image library](https://pub.dev/packages/image)
void
printImageRaster
(
Image
imgSrc
)
{
void
printImageRaster
(
Image
imgSrc
,
{
bool
highDensityHorizontal
=
true
,
bool
highDensityVertical
=
true
,
})
{
final
Image
image
=
Image
.
from
(
imgSrc
);
// make a copy
final
Image
image
=
Image
.
from
(
imgSrc
);
// make a copy
const
bool
highDensityHorizontal
=
true
;
const
bool
highDensityVertical
=
true
;
final
int
widthPx
=
image
.
width
;
final
int
widthPx
=
image
.
width
;
final
int
heightPx
=
image
.
height
;
final
int
heightPx
=
image
.
height
;
final
int
widthBytes
=
(
widthPx
+
7
)
~/
8
;
final
int
widthBytes
=
(
widthPx
+
7
)
~/
8
;
const
int
densityByte
=
final
int
densityByte
=
(
highDensityVertical
?
0
:
1
)
+
(
highDensityHorizontal
?
0
:
2
);
(
highDensityVertical
?
0
:
1
)
+
(
highDensityHorizontal
?
0
:
2
);
final
List
<
int
>
header
=
List
.
from
(
cRasterImg
.
codeUnits
);
final
List
<
int
>
header
=
List
.
from
(
cRasterImg
.
codeUnits
);
...
@@ -498,13 +500,10 @@ class Printer {
...
@@ -498,13 +500,10 @@ class Printer {
oneChannelBytes
.
add
(
buffer
[
i
]);
oneChannelBytes
.
add
(
buffer
[
i
]);
}
}
// print('after invert len: ${oneChannelBytes.length}');
// Add some empty pixels at the end of each line (to make the width divisible by 8)
// Add some empty pixels at the end of each line (to make the width divisible by 8)
final
targetWidth
=
(
widthPx
+
8
)
-
(
widthPx
%
8
);
final
targetWidth
=
(
widthPx
+
8
)
-
(
widthPx
%
8
);
final
missingPx
=
targetWidth
-
widthPx
;
final
missingPx
=
targetWidth
-
widthPx
;
final
extra
=
Uint8List
(
missingPx
);
final
extra
=
Uint8List
(
missingPx
);
// print('curW: $widthPx, targetW: $targetWidth, missingPx: $missingPx');
for
(
int
i
=
0
;
i
<
heightPx
;
i
++)
{
for
(
int
i
=
0
;
i
<
heightPx
;
i
++)
{
final
pos
=
(
i
*
widthPx
+
widthPx
)
+
i
*
missingPx
;
final
pos
=
(
i
*
widthPx
+
widthPx
)
+
i
*
missingPx
;
oneChannelBytes
.
insertAll
(
pos
,
extra
);
oneChannelBytes
.
insertAll
(
pos
,
extra
);
...
...
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