On 2/28/07, Nicolas Grilly <[EMAIL PROTECTED]> wrote:

> Have you seen this patch I proposed several days ago, during your
> vacations? Can you reproduce the problem on your machine and do you
> agree with the solution?

No, I missed it the first time around, thanks for resending.  I've
been battling these half-center alignment problems since we added the
agg backend -- search throughout the _backend_agg.cpp backend for
"snapto".    I do two things differently from you, and we need to
decide on the right approach and do it consistently.

+      ppath->vertex(i, &x, &y);
+      x = x - 0.5;
+      y = y + 0.5;
+      ppath->modify_vertex(i, x, y);

You are subtracting from x and adding to y, and preserving the
original float, whereas I have been truncating to int and adding 0.5
to insure that the number is a pixel center.  Eg,

  //snapto pixel centers
  l = (int)l + 0.5;
  b = (int)b + 0.5;
  r = (int)r + 0.5;
  t = (int)t + 0.5;

What is the justification for subtracting from x and adding to y?  And
do you agree that it is preferable to first truncate to an int before
doing the 0.5 offset to insure the pixel center?

I do agree that it makes more sense to do this in the backend since
the notion of pixel center has no place in the vector backends.  Would
you consider looking over the rest of backend agg and making sure this
is applied consistently and correctly?  In the past, I have been only
applying this adjustment on horizontal and vertical lines, but perhaps
we should apply it to all vertices in the agg backend regardless, as
you are doing in your patch.  I would love to vanquish this pesky
problem once and for all -- it seems that everytime I push it down in
one place, it crops up in another.

JDH

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to