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 bilinear filtering for drawimage #72

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

enkimute
Copy link

@enkimute enkimute commented Dec 12, 2018

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
Copy link
Owner

@joshmarinacci joshmarinacci left a comment

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
Copy link
Author

enkimute commented Dec 13, 2021 via email

@charlesr1971
Copy link

@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
Copy link
Author

enkimute commented Dec 14, 2021 via email

@charlesr1971
Copy link

@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