Skip to content

added bilinear filtering for drawimage#72

Open
enkimute wants to merge 4 commits into
joshmarinacci:masterfrom
enkimute:master
Open

added bilinear filtering for drawimage#72
enkimute wants to merge 4 commits into
joshmarinacci:masterfrom
enkimute:master

Conversation

@enkimute

@enkimute enkimute commented Dec 12, 2018

Copy link
Copy Markdown

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [x ] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • [x ] All new and existing tests passed.

Description

enkimute and others added 4 commits December 12, 2018 17:36
Fixes bug when alpha from foreground image would overwrite alpha from background image
Use composite when drawing images

@joshmarinacci joshmarinacci left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This looks good to me. I approve.

@enkimute

enkimute commented Dec 13, 2021 via email

Copy link
Copy Markdown
Author

@charlesr1971

Copy link
Copy Markdown

@enkimute Does this help to smooth drawImage() results of a clip.
So for instance I have clipped an image, using an arc(), to create a circular avatar.
But, it is aliased.

Will your fix, effectively create anti-aliasing?

Thank you 🙏

@enkimute

enkimute commented Dec 14, 2021 via email

Copy link
Copy Markdown
Author

@charlesr1971

Copy link
Copy Markdown

@enkimute Hi Steven. Thanks for your reply.
Well I have created an image at 1200px X 1200px, but when I scale it down, it looks even more pixellated!

My code is:

const scaleX = 0.5;
const scaleY = 0.5;
 
const width = img.width * scaleX;
const height = img.height * scaleY;
 
const resized = PImage.make(width, height, null);
const ctx = resized.getContext('2d');
 
ctx.drawImage(
img,
0,
0,
img.width,
img.height,
0,
0,
width,
height
);

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.

4 participants