Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Signing verification utilities
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Seal
Building blocks
Signing verification utilities
Commits
a2a11202
Commit
a2a11202
authored
1 year ago
by
Boyan Tsolov
Browse files
Options
Downloads
Patches
Plain Diff
test 234
parent
c93f9d39
No related branches found
No related tags found
1 merge request
!91
DRAFT: TEST (delete when done testing) upgrade yarn
Pipeline
#68506
passed
1 year ago
Stage: install
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dist/utils/qrCodeTemplateUtils.js
+4
-0
4 additions, 0 deletions
dist/utils/qrCodeTemplateUtils.js
src/utils/qrCodeTemplateUtils.ts
+10
-0
10 additions, 0 deletions
src/utils/qrCodeTemplateUtils.ts
with
14 additions
and
0 deletions
dist/utils/qrCodeTemplateUtils.js
+
4
−
0
View file @
a2a11202
...
...
@@ -224,11 +224,13 @@ const putQrCodeOnChromakeyTemplateNodeJS = (qrCodeImageBase64, templateImageBase
throw
new
Error
(
"
NodeJS cannot load qr code image
"
);
}
const
templateImage
=
yield
loadImageNode
(
templateImageBase64
,
document
);
console
.
log
(
'
==11==11111111====
'
,
templateImage
.
width
);
if
(
templateImage
.
width
<
placeholderWidth
||
templateImage
.
height
<
placeholderHeight
)
{
throw
new
Error
(
"
Placeholder is bigger than image
"
);
}
const
templateCanvas
=
document
.
createElement
(
"
canvas
"
);
console
.
log
(
'
===2222TEmplateCanvas===
'
,
templateCanvas
.
width
);
templateCanvas
.
width
=
templateImage
.
width
;
templateCanvas
.
height
=
templateImage
.
height
;
const
templateCtx
=
templateCanvas
.
getContext
(
"
2d
"
);
...
...
@@ -236,6 +238,7 @@ const putQrCodeOnChromakeyTemplateNodeJS = (qrCodeImageBase64, templateImageBase
const
templateImgData
=
templateCtx
.
getImageData
(
0
,
0
,
templateCanvas
.
width
,
templateCanvas
.
height
);
const
placeholderCoordinates
=
findChromakeyBoundaries
(
templateImage
.
width
,
templateImage
.
height
,
templateImgData
,
placeholderWidth
,
placeholderHeight
);
// -2 is for QR to slightly cover borders. To avoid green mask bulging out
console
.
log
(
'
====33333333====qrCodeImage===
'
,
qrCodeImage
.
width
);
const
scaleX
=
((
qrCodeImage
.
width
-
2
)
/
placeholderWidth
)
*
scale
;
const
scaleY
=
((
qrCodeImage
.
height
-
2
)
/
placeholderHeight
)
*
scale
;
qrCodeImage
.
width
*=
scale
;
...
...
@@ -243,6 +246,7 @@ const putQrCodeOnChromakeyTemplateNodeJS = (qrCodeImageBase64, templateImageBase
const
bannerCanvas
=
document
.
createElement
(
"
canvas
"
);
const
scaledTemplateW
=
Math
.
floor
(
templateImage
.
width
*
scaleX
);
const
scaledTemplateH
=
Math
.
floor
(
templateImage
.
height
*
scaleY
);
console
.
log
(
'
=====4444=====BannerCanvas==
'
,
bannerCanvas
.
width
);
bannerCanvas
.
width
=
scaledTemplateW
;
bannerCanvas
.
height
=
scaledTemplateH
;
const
bannerCtx
=
bannerCanvas
.
getContext
(
"
2d
"
);
...
...
This diff is collapsed.
Click to expand it.
src/utils/qrCodeTemplateUtils.ts
+
10
−
0
View file @
a2a11202
...
...
@@ -288,6 +288,8 @@ const putQrCodeOnChromakeyTemplateNodeJS = async (
}
const
templateImage
=
await
loadImageNode
(
templateImageBase64
,
document
);
console
.
log
(
"
==11==11111111====
"
,
templateImage
.
width
);
if
(
templateImage
.
width
<
placeholderWidth
||
templateImage
.
height
<
placeholderHeight
...
...
@@ -296,6 +298,9 @@ const putQrCodeOnChromakeyTemplateNodeJS = async (
}
const
templateCanvas
=
document
.
createElement
(
"
canvas
"
);
console
.
log
(
"
===2222TEmplateCanvas===
"
,
templateCanvas
.
width
);
templateCanvas
.
width
=
templateImage
.
width
;
templateCanvas
.
height
=
templateImage
.
height
;
...
...
@@ -323,6 +328,9 @@ const putQrCodeOnChromakeyTemplateNodeJS = async (
placeholderHeight
);
// -2 is for QR to slightly cover borders. To avoid green mask bulging out
console
.
log
(
"
====33333333====qrCodeImage===
"
,
qrCodeImage
.
width
);
const
scaleX
=
((
qrCodeImage
.
width
-
2
)
/
placeholderWidth
)
*
scale
;
const
scaleY
=
((
qrCodeImage
.
height
-
2
)
/
placeholderHeight
)
*
scale
;
qrCodeImage
.
width
*=
scale
;
...
...
@@ -332,6 +340,8 @@ const putQrCodeOnChromakeyTemplateNodeJS = async (
const
scaledTemplateW
=
Math
.
floor
(
templateImage
.
width
*
scaleX
);
const
scaledTemplateH
=
Math
.
floor
(
templateImage
.
height
*
scaleY
);
console
.
log
(
"
=====4444=====BannerCanvas==
"
,
bannerCanvas
.
width
);
bannerCanvas
.
width
=
scaledTemplateW
;
bannerCanvas
.
height
=
scaledTemplateH
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment