sacuba / explorercanvas

Automatically exported from code.google.com/p/explorercanvas
0 stars 0 forks source link

Image drawing misplaced #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Draw rectangle
  1.0 save canvas
  1.1 Translate canvas to the top left corner of rectangle
  1.2 Draw rectangle (0, 0, width, height);
  1.3 restore canvas
2. Draw image
  2.0 save canvas
  2.1 translate canvas to the top left corner of rectangle
  2.2 draw image (0, 0, width, height)
  2.3 restore canvas

Rectangle should be drawn exactly around the image. But in IE7 it looks
like on the attached screenshot.

I've attached screenshot in IE7 and screenshot in FF and sample page.

Original issue reported on code.google.com by andrey....@gmail.com on 25 Mar 2009 at 3:50

Attachments:

GoogleCodeExporter commented 9 years ago
FWIW this works correctly for me in IE8.

Can someone else verify that this is indeed not working in IE7?

Original comment by erik.arv...@gmail.com on 25 Mar 2009 at 6:19

GoogleCodeExporter commented 9 years ago
I ask my fried look at in IE6. Result screenshot 
http://floomby.ru/content/mMIq11eD5k/

Original comment by andrey....@gmail.com on 25 Mar 2009 at 6:32

GoogleCodeExporter commented 9 years ago
Same thing happening to me in IE6 and IE7.

Original comment by Bean...@gmail.com on 1 Apr 2009 at 3:20

GoogleCodeExporter commented 9 years ago
I have been experiencing similar problems in IE 7 (haven't gotten my project 
working
in IE 6 at all, but that's ok). In my case, I am drawing multiple images. The 
first
image is placed correctly, and the rest are shifted down and to the right. To 
"fix"
the problem, I have an IE scaling factor of .913 that gets multiplied into the 
"real"
coordinates for use on native-supported canvas browsers. Introducing this same 
factor
on the sample code attached by the original poster seems to fix that 
implementation. 

However, in all cases the scaling factor is not pixel-perfect. It looks like 
images
that are drawn closer to the center of the canvas area are spot-on after the 
factor,
and images farther away are off a bit still, tending to be farther from center 
than
they should be.

What's especially curious is that I can sometimes see a flicker of the images 
first
being drawn at the actual pixel-specified location, then quickly disappearing 
and
being redrawn at their actual destination. Maybe I can work up a test page to
calibrate another scaling factor for distance from the center...

Original comment by john.gab...@gmail.com on 17 Apr 2009 at 5:07

GoogleCodeExporter commented 9 years ago
OK, with a better test and more fiddling, I've worked up a better scaling 
factor of
0.9095. This works with very good (but still not perfect) results in the 
attached
example. The grid lines are drawn with lineTo, and the red dots are renders of a
single-pixel image.

The unfortunate reality is that it doesn't work as well in real-life 
applications as
in the sample code. You will notice there are aberrations where the red dots 
will hop
off the intersections of the grid only to hop back at the next-furthest 
intersection
from the top left. These seem to occur throughout the space at semi-regular
intervals. It might be possible to identify a pattern that could be 
counter-coded,
but my "solution" is admittedly more of a hack than a fix already.

I'm watching this issue, so if anyone has questions, I'll see them to respond 
as best
I can. Hope this can be nailed down!

Original comment by john.gab...@gmail.com on 17 Apr 2009 at 9:40

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 24 has been merged into this issue.

Original comment by erik.arv...@gmail.com on 19 Apr 2009 at 7:28

GoogleCodeExporter commented 9 years ago
Can you retry this with revision 60. I believe it is working correctly now.

Original comment by erik.arv...@gmail.com on 25 Apr 2009 at 10:24

GoogleCodeExporter commented 9 years ago
Great! It works for me. thanks!

Original comment by andrey....@gmail.com on 26 Apr 2009 at 5:43

GoogleCodeExporter commented 9 years ago
Thanks, works great now. I thought I still had a residual issue, but it turned 
out to
be my own fault! Thanks again.

Original comment by john.gab...@gmail.com on 1 May 2009 at 5:10

GoogleCodeExporter commented 9 years ago
Although this particular issue has already been fixed, it caused repercussions
elsewhere. I've tested this particular case against my patch. 

The result can be found here:
http://extjs.com/playpen/tm/excanvas-patch/canvas.html

Tommy M

Original comment by tommy.ma...@gmail.com on 20 Jun 2009 at 3:33