SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: John H. <jdh...@ac...> - 2003年11月11日 21:51:32
The GTK and wx backends have the same problem with pixel rounding on
pcolor. I just cured it with GTK and I bet you can do the same for
wx. The trick is to floor the positions and ceil the scales. This
will make it much more likely that the left edge of one rectangle will
align with the right edge of another. Eg, for the GTK backend
 def draw_rectangle(self, gc, filled, x, y, width, height):
 """
 Draw a rectangle at lower left x,y with width and height
 If filled=True, fill the rectangle with the gc foreground
 gc is a GraphicsContext instance
 """
 self.gdkDrawable.draw_rectangle(
 gc.gdkGC, filled, int(x), self.height-int(y+height),
 int(math.ceil(width)), int(math.ceil(height)))
This worked great on my test code.
Secondly, I am considering making a minor backend change for drawing
2D solids (arcs, rectangles, polygons) in the Renderer. Rather than
calling the functions twice, once for edge and once for face, I would
like to define them like
 def draw_rectangle(self, gcEdge, x, y, width, height, gcFace=None):
that is, the gcFace takes the place of fill. If None, don't fill,
otherwise fill with the gc in gcFace.
This will avoid 2 function calls per patch (once on the patch.py end
and once in the backend forwarding it to the underlying renderer, and
will enable backends, eg, postscript, to take advantage of a native
fill commands. For PS, this will at least halve the size of pcolor
output files, which are currently obscenely large.
Comments?
JDH
From: Jeremy O'D. <je...@o-...> - 2003年11月11日 22:39:59
John Hunter said:
>
> The GTK and wx backends have the same problem with pixel rounding on
> pcolor. I just cured it with GTK and I bet you can do the same for
> wx. The trick is to floor the positions and ceil the scales. This
> will make it much more likely that the left edge of one rectangle will
> align with the right edge of another. Eg, for the GTK backend
>
[code snipped]
I'm sure you're right. I'll try it tomorrow.
> Secondly, I am considering making a minor backend change for drawing
> 2D solids (arcs, rectangles, polygons) in the Renderer. Rather than
> calling the functions twice, once for edge and once for face, I would
> like to define them like
>
> def draw_rectangle(self, gcEdge, x, y, width, height, gcFace=3DNone)=
:
>
> that is, the gcFace takes the place of fill. If None, don't fill,
> otherwise fill with the gc in gcFace.
>
> This will avoid 2 function calls per patch (once on the patch.py end
> and once in the backend forwarding it to the underlying renderer, and
> will enable backends, eg, postscript, to take advantage of a native
> fill commands. For PS, this will at least halve the size of pcolor
> output files, which are currently obscenely large.
This seems very sensible. The changes required in backend_wx will be
minimal, and wx has a native fill (well, a brush...), so I can take
advantage of this. Halving the size of PS output is very worthwhile, and
it'll probably double the speed of pcolor on wx.
Regards
Jeremy
From: Andrew S. <as...@in...> - 2003年11月12日 12:33:26
John Hunter wrote:
> Secondly, I am considering making a minor backend change for drawing
> 2D solids (arcs, rectangles, polygons) in the Renderer. Rather than
> calling the functions twice, once for edge and once for face, I would
> like to define them like
> Comments?
Only one comment from me: make sure to leave a way for non-convex 
polygons. It should be possible to draw, for example, a 5 pointed star 
in which the fill shouldn't extend outside the edges.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /