Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Sketch Module #1450

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Added Sketch Module #1450

wants to merge 12 commits into from

Conversation

ataata107
Copy link

@ataata107 ataata107 commented Jan 9, 2020

Fixes #993

Concerns #694
ezgif com-video-to-gif (4)

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with npm test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • ask @publiclab/is-reviewers for help, in a comment below
  • Insert-step functionality is working correct as expected.

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Please make sure to get at least two reviews before asking for merging the PR as that would make the PR more reliable on our part
Thanks!

@ataata107
Copy link
Author

@publiclab/is-reviewers

Will refactor after your reviews

@codecov
Copy link

codecov bot commented Jan 9, 2020

Codecov Report

Merging #1450 into main will increase coverage by 9.17%.
The diff coverage is 65.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1450      +/-   ##
==========================================
+ Coverage   55.11%   64.29%   +9.17%     
==========================================
  Files         117      129      +12     
  Lines        2344     2627     +283     
  Branches      360      419      +59     
==========================================
+ Hits         1292     1689     +397     
+ Misses       1052      938     -114     
Impacted Files Coverage Δ
examples/lib/scopeQuery.js 18.51% <ø> (ø)
src/Modules.js 100.00% <ø> (ø)
src/ui/SetInputStep.js 12.90% <0.00%> (-1.39%) ⬇️
examples/lib/defaultHtmlStepUi.js 11.29% <5.00%> (-0.90%) ⬇️
examples/lib/intermediateHtmlStepUi.js 11.11% <5.55%> (+0.94%) ⬆️
src/modules/Sketch/Module.js 13.33% <13.33%> (ø)
src/util/getImageDimensions.js 15.38% <15.38%> (ø)
examples/lib/insertPreview.js 13.51% <22.22%> (ø)
src/modules/BlobAnalysis/Module.js 30.76% <33.33%> (+2.19%) ⬆️
src/modules/TextOverlay/Module.js 54.54% <33.33%> (+21.21%) ⬆️
... and 84 more

Copy link
Member

@rishabhshuklax rishabhshuklax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few changes are required other than that it looks great! Kudos!!
Also write as many comments as possible to explain methods in Sketcher.js so that in future if someone works on it he/she should be able to do it without much trouble.

src/modules/Sketch/Sketch.js Show resolved Hide resolved
};
}
Sketcher.prototype = {
transformCanvas: function (canvas) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using canvas transform, would it work in node?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will have to see that, @harshkhandeparkar do you know anything about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't work in node. You either need to use puppeteer (refer to the WebGLDistort module) or temporarily, just add a requires field to the info.json which will skip the tests for the module (refer to TextOverlay).

Ideally, we want every module to work in node, and use puppeteer to make it work.
Thanks.

var imageData = context.getImageData(0, 0, width, height);
var pixels = imageData.data;

this.sendProgressUpdate(0, 'Calculating required textures');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being used anywhere?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is visible in the console.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it required though? Or only for debugging purposes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only for debugging

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I think it should be removed. We don't want unnecessary logs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the logs

"description": "Converts image to its sketch.",
"inputs": {
},
"docs-link":""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if you could also write the docs for this module, You can use https://github.com/geraintluff/canvas-sketch/blob/master/README.md for reference and also It'd be great if we could give credits to geraintluff somewhere.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup that will be done

@@ -0,0 +1,8 @@
{
"name": "sketch",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are using canvas so please add a requires field in the info.json. Please refer to the info.json of text overlay and other modules which use canvas.

@gitpod-io
Copy link

gitpod-io bot commented Jul 7, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image to pencil sketch module.
3 participants