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

blend() and copy() are not pixel accurate for scaling and copying #324

Closed
processing-bugs opened this Issue Feb 10, 2013 · 6 comments

Comments

Projects
None yet
3 participants
@processing-bugs

processing-bugs commented Feb 10, 2013

Original author: spog...@gmail.com (June 30, 2010 08:22:17)

Hi,

After having discussed about it on forum.processing.org, davbol suggested me to submit you the matter as follow :

// purpose: to demonstrate a scaling problem in blend()
size(500,500,P2D);
PGraphics offscreen = createGraphics(width,height,P2D);
beginRecord(offscreen);
background(0);
fill(255);
noStroke();
ellipse(width/2,height/2,width-2,height-2);
endRecord();
// these two should be identical (duh?)
save("onscreen.png");
offscreen.save("offscreen.png");
// this works correctly as far as scaling, same a previous two
// (intended to help 'isolate' scaling problem to blend())
image(offscreen,0,0,width,height);
save("blitted.png");
// this SHOULD be functionally the same as image() above, but...
// this DOES NOT work correctly, as there is a set of
// "one-too-big" errors in PImage.blend() at/around
// line 1492 where sx2/sy2/dx2/dy2 are calculated:
blend(offscreen,0,0,width,height,0,0,width,height,BLEND);
save("blended.png");
// this corrects the scaling, by "hacking" in "one-too-small"
// values that then calculate "one-too-big", so the scaling factor
// is calculated correctly, but problem then is that output
// extent is incorrect (see red fringe)
background(255,0,0);
blend(offscreen,0,0,width-1,height-1,0,0,width-1,height-1,BLEND);
save("blended_hack.png");
exit();
// now layer the various images in Photoshop to
// compare pixels at edges of ellipse

Entire discussion can be read at http://forum.processing.org/#Topic/25080000000037162
where I also regret (sorry for that) graphical results of accumulated rounding errors..

All the best,

Stéphane

Original issue: http://code.google.com/p/processing/issues/detail?id=285

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From f...@processing.org on June 30, 2010 10:59:14
Thanks for the report and the code. Will look into it.

And just to make sure, this is still a problem with the latest pre-release, correct?

processing-bugs commented Feb 10, 2013

From f...@processing.org on June 30, 2010 10:59:14
Thanks for the report and the code. Will look into it.

And just to make sure, this is still a problem with the latest pre-release, correct?

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From spog...@gmail.com on June 30, 2010 13:02:32
Yes, Processing v1.1.

processing-bugs commented Feb 10, 2013

From spog...@gmail.com on June 30, 2010 13:02:32
Yes, Processing v1.1.

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From f...@processing.org on June 30, 2010 13:05:00
No, that's the latest "final" release. Please check with revision 0186, which is listed under "pre-releases" on the download page.

processing-bugs commented Feb 10, 2013

From f...@processing.org on June 30, 2010 13:05:00
No, that's the latest "final" release. Please check with revision 0186, which is listed under "pre-releases" on the download page.

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From spog...@gmail.com on June 30, 2010 13:24:10
OK (sorry), I downloaded the pre-release rev. 0186 and used it.
Strange (but I can make mistakes) :

  1. problem is same with davbol code (red fringe)
  2. outlines disappear with my code (superimposed b&w ellipses)

processing-bugs commented Feb 10, 2013

From spog...@gmail.com on June 30, 2010 13:24:10
OK (sorry), I downloaded the pre-release rev. 0186 and used it.
Strange (but I can make mistakes) :

  1. problem is same with davbol code (red fringe)
  2. outlines disappear with my code (superimposed b&w ellipses)

@benfry benfry removed the bug label Nov 15, 2014

@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Aug 7, 2015

Contributor

Fixed somewhere between 0179 and 0184.

Contributor

JakubValtar commented Aug 7, 2015

Fixed somewhere between 0179 and 0184.

@JakubValtar JakubValtar added revised and removed revision needed labels Aug 7, 2015

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 7, 2015

Member

Thanks

Member

benfry commented Aug 7, 2015

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment