Revision: 3958
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3958&view=rev
Author: mdboom
Date: 2007-10-16 12:39:57 -0700 (Tue, 16 Oct 2007)
Log Message:
-----------
figlegends work now. (Phew!) Rendering quality fixes drawing
axis-aligned line segments in Agg.
Modified Paths:
--------------
branches/transforms/PASSED_DEMOS
branches/transforms/lib/matplotlib/axes.py
branches/transforms/lib/matplotlib/backend_bases.py
branches/transforms/lib/matplotlib/backends/backend_ps.py
branches/transforms/lib/matplotlib/figure.py
branches/transforms/lib/matplotlib/image.py
branches/transforms/lib/matplotlib/legend.py
branches/transforms/lib/matplotlib/lines.py
branches/transforms/lib/matplotlib/transforms.py
branches/transforms/src/_backend_agg.cpp
branches/transforms/src/_backend_agg.h
Modified: branches/transforms/PASSED_DEMOS
===================================================================
--- branches/transforms/PASSED_DEMOS 2007-10-16 14:41:29 UTC (rev 3957)
+++ branches/transforms/PASSED_DEMOS 2007-10-16 19:39:57 UTC (rev 3958)
@@ -35,26 +35,26 @@
color_demo.py O
colours.py [???]
contour_demo.py O
-contourf_demo.py [FLOATING POINT EXCEPTION]
-contour_image.py [FLOATING POINT EXCEPTION]
+contourf_demo.py O
+contour_image.py O
coords_demo.py O
coords_report.py O
csd_demo.py O
cursor_demo.py O
-custom_figure_class.py [EXCEPT FOR PS OUTPUT]
+custom_figure_class.py O
customize_rc.py
custom_ticker1.py O
dannys_example.py [REQUIRES NUMERIC]
dash_control.py O
dashpointlabel.py O
-dashtick.py
+dashtick.py O
data_browser.py O
data_helper.py [N/A]
date_demo1.py O
date_demo2.py O
-date_demo_convert.py O [PASSES]
-date_demo_rrule.py O [PASSES]
-date_index_formatter.py O [PASSES]
+date_demo_convert.py O
+date_demo_rrule.py O
+date_index_formatter.py O
dynamic_collection.py O
dynamic_demo.py [GTK]
dynamic_demo_wx.py [WX]
@@ -77,7 +77,7 @@
errorbar_demo.py O
errorbar_limits.py O
figimage_demo.py O
-figlegend_demo.py [HORRIBLY BROKEN]
+figlegend_demo.py O
figtext.py O
fill_between_posneg.py O
fill_between.py O
@@ -94,7 +94,7 @@
glyph_to_path.py [Requires PIL]
gradient_bar.py O
gtk_spreadsheet.py
-hatch_demo.py [Requires PS]
+hatch_demo.py O
histogram_demo_canvasagg.py [???]
histogram_demo.py O
image_demo2.py O
Modified: branches/transforms/lib/matplotlib/axes.py
===================================================================
--- branches/transforms/lib/matplotlib/axes.py 2007-10-16 14:41:29 UTC (rev
3957)
+++ branches/transforms/lib/matplotlib/axes.py 2007-10-16 19:39:57 UTC (rev
3958)
@@ -1248,7 +1248,10 @@
l, b, w, h = self.bbox.bounds
# composite images need special args so they will not
# respect z-order for now
- renderer.draw_image(l, b, im, self.bbox)
+ renderer.draw_image(
+ l, b, im, self.bbox,
+ self.axesPatch.get_path(),
+ self.axesPatch.get_transform())
artists.extend(self.collections)
artists.extend(self.patches)
@@ -4379,6 +4382,7 @@
im.set_data(X)
im.set_alpha(alpha)
self._set_artist_props(im)
+ im.set_clip_path(self.axesPatch)
#if norm is None and shape is None:
# im.set_clim(vmin, vmax)
if vmin is not None or vmax is not None:
Modified: branches/transforms/lib/matplotlib/backend_bases.py
===================================================================
--- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 14:41:29 UTC
(rev 3957)
+++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 19:39:57 UTC
(rev 3958)
@@ -68,7 +68,7 @@
Nlinestyles = len(linestyles)
Naa = len(antialiaseds)
- if (Nfacecolors == 0 and Nedgecolors == 0) or N == 0:
+ if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0:
return
ttransforms = []
@@ -113,7 +113,7 @@
"""
return 1.0
- def draw_image(self, x, y, im, bbox):
+ def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
"""
Draw the Image instance into the current axes; x is the
distance in pixels from the left hand side of the canvas. y is
Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16
14:41:29 UTC (rev 3957)
+++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16
19:39:57 UTC (rev 3958)
@@ -371,7 +371,7 @@
"""
return self.image_magnification
- def draw_image(self, x, y, im, bbox):
+ def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
"""
Draw the Image instance into the current axes; x is the
distance in pixels from the left hand side of the canvas and y
@@ -397,9 +397,16 @@
figh = self.height*72
#print 'values', origin, flipud, figh, h, y
+ clip = []
if bbox is not None:
clipx,clipy,clipw,cliph = bbox.bounds
- clip = '%s clipbox' % _nums_to_str(clipw, cliph, clipx, clipy)
+ clip.append('%s clipbox' % _nums_to_str(clipw, cliph, clipx,
clipy))
+ if clippath is not None:
+ print "clippath"
+ id = self._get_clip_path(clippath, clippath_trans)
+ clip.append('%s' % id)
+ clip = '\n'.join(clip)
+
#y = figh-(y+h)
ps = """gsave
%(clip)s
@@ -507,7 +514,7 @@
Nlinestyles = len(linestyles)
Naa = len(antialiaseds)
- if (Nfacecolors == 0 and Nedgecolors == 0) or N == 0:
+ if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0:
return
for i in range(Ntpaths):
Modified: branches/transforms/lib/matplotlib/figure.py
===================================================================
--- branches/transforms/lib/matplotlib/figure.py 2007-10-16 14:41:29 UTC
(rev 3957)
+++ branches/transforms/lib/matplotlib/figure.py 2007-10-16 19:39:57 UTC
(rev 3958)
@@ -627,7 +627,8 @@
ims)
im.is_grayscale = False
l, b, w, h = self.bbox.bounds
- renderer.draw_image(l, b, im, self.bbox)
+ renderer.draw_image(l, b, im, self.bbox,
+ *self.get_transformed_clip_path_and_affine())
# render the axes
@@ -702,7 +703,6 @@
handles = flatten(handles)
l = Legend(self, handles, labels, *args, **kwargs)
- self._set_artist_props(l)
self.legends.append(l)
return l
Modified: branches/transforms/lib/matplotlib/image.py
===================================================================
--- branches/transforms/lib/matplotlib/image.py 2007-10-16 14:41:29 UTC (rev
3957)
+++ branches/transforms/lib/matplotlib/image.py 2007-10-16 19:39:57 UTC (rev
3958)
@@ -181,7 +181,8 @@
if not self.get_visible(): return
im = self.make_image(renderer.get_image_magnification())
l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds
- renderer.draw_image(l, b, im, self.axes.bbox.frozen())
+ renderer.draw_image(l, b, im, self.axes.bbox.frozen(),
+ *self.get_transformed_clip_path_and_affine())
def contains(self, mouseevent):
"""Test whether the mouse event occured within the image.
@@ -481,7 +482,8 @@
def draw(self, renderer, *args, **kwargs):
if not self.get_visible(): return
im = self.make_image()
- renderer.draw_image(self.ox, self.oy, im, self.figure.bbox)
+ renderer.draw_image(self.ox, self.oy, im, self.figure.bbox,
+ *self.get_transformed_clip_path_and_affine())
def write_png(self, fname):
"""Write the image to png file with fname"""
Modified: branches/transforms/lib/matplotlib/legend.py
===================================================================
--- branches/transforms/lib/matplotlib/legend.py 2007-10-16 14:41:29 UTC
(rev 3957)
+++ branches/transforms/lib/matplotlib/legend.py 2007-10-16 19:39:57 UTC
(rev 3958)
@@ -165,7 +165,8 @@
raise TypeError("Legend needs either Axes or Figure as parent")
self.parent = parent
self._offsetTransform = Affine2D()
- self.set_transform( self._offsetTransform + BboxTransform(Bbox.unit(),
parent.bbox) )
+ self._parentTransform = BboxTransform(Bbox.unit(), parent.bbox)
+ Artist.set_transform(self, self._offsetTransform +
self._parentTransform)
if loc is None:
loc = rcParams["legend.loc"]
@@ -192,6 +193,12 @@
self._loc = loc
+ self.legendPatch = Rectangle(
+ xy=(0.0, 0.0), width=0.5, height=0.5,
+ facecolor='w', edgecolor='k',
+ )
+ self._set_artist_props(self.legendPatch)
+
# make a trial box in the middle of the axes. relocate it
# based on it's bbox
left, top = 0.5, 0.5
@@ -203,20 +210,6 @@
self.texts = self._get_texts(labels, textleft, top)
self.legendHandles = self._get_handles(handles, self.texts)
-
- if len(self.texts):
- left, top = self.texts[-1].get_position()
- HEIGHT = self._approx_text_height()*len(self.texts)
- else:
- HEIGHT = 0.2
-
- bottom = top-HEIGHT
- left -= self.handlelen + self.handletextsep + self.pad
- self.legendPatch = Rectangle(
- xy=(left, bottom), width=0.5, height=HEIGHT,
- facecolor='w', edgecolor='k',
- )
- self._set_artist_props(self.legendPatch)
self._drawFrame = True
def _set_artist_props(self, a):
@@ -282,6 +275,7 @@
legline.update_from(handle)
self._set_artist_props(legline) # after update
legline.set_clip_box(None)
+ legline.set_clip_path(self.legendPatch)
legline.set_markersize(self.markerscale*legline.get_markersize())
ret.append(legline)
@@ -293,12 +287,14 @@
p.update_from(handle)
self._set_artist_props(p)
p.set_clip_box(None)
+ p.set_clip_path(self.legendPatch)
ret.append(p)
elif isinstance(handle, LineCollection):
ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float)
legline = Line2D(self._xdata, ydata)
self._set_artist_props(legline)
legline.set_clip_box(None)
+ legline.set_clip_path(self.legendPatch)
lw = handle.get_linewidth()[0]
dashes = handle.get_dashes()
color = handle.get_colors()[0]
@@ -316,6 +312,7 @@
p.set_edgecolor(handle._edgecolors[0])
self._set_artist_props(p)
p.set_clip_box(None)
+ p.set_clip_path(self.legendPatch)
ret.append(p)
else:
@@ -536,7 +533,7 @@
handle.set_height(h/2)
# Set the data for the legend patch
- bbox = self._get_handle_text_bbox(renderer).frozen()
+ bbox = self._get_handle_text_bbox(renderer)
bbox = bbox.expanded(1 + self.pad, 1 + self.pad)
l, b, w, h = bbox.bounds
Modified: branches/transforms/lib/matplotlib/lines.py
===================================================================
--- branches/transforms/lib/matplotlib/lines.py 2007-10-16 14:41:29 UTC (rev
3957)
+++ branches/transforms/lib/matplotlib/lines.py 2007-10-16 19:39:57 UTC (rev
3958)
@@ -748,7 +748,7 @@
def _draw_diamond(self, renderer, gc, path, path_trans):
side = renderer.points_to_pixels(self._markersize)
- transform = Affine2D().translate(0.5, 0.5).rotate_deg(45).scale(side)
+ transform = Affine2D().translate(-0.5, -0.5).rotate_deg(45).scale(side)
rgbFace = self._get_rgb_face()
renderer.draw_markers(gc, Path.unit_rectangle(), transform,
path, path_trans, rgbFace)
@@ -756,8 +756,8 @@
def _draw_thin_diamond(self, renderer, gc, path, path_trans):
offset = renderer.points_to_pixels(self._markersize)
- transform = Affine2D().translate(0.5, 0.5) \
- .rotate_deg(45).scale(offset * 0.8, offset)
+ transform = Affine2D().translate(-0.5, -0.5) \
+ .rotate_deg(45).scale(offset * 0.6, offset)
rgbFace = self._get_rgb_face()
renderer.draw_markers(gc, Path.unit_rectangle(), transform,
path, path_trans, rgbFace)
Modified: branches/transforms/lib/matplotlib/transforms.py
===================================================================
--- branches/transforms/lib/matplotlib/transforms.py 2007-10-16 14:41:29 UTC
(rev 3957)
+++ branches/transforms/lib/matplotlib/transforms.py 2007-10-16 19:39:57 UTC
(rev 3958)
@@ -822,7 +822,7 @@
raise TypeError(
"Can not add Transform to object of type '%s'" % type(other))
- def __array__(self):
+ def __array__(self, *args, **kwargs):
"""
Used by C/C++ -based backends to get at the array matrix data.
"""
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp 2007-10-16 14:41:29 UTC (rev
3957)
+++ branches/transforms/src/_backend_agg.cpp 2007-10-16 19:39:57 UTC (rev
3958)
@@ -99,7 +99,7 @@
the C++ representation as a std::vector<std::pair<double, double> >
(GCAgg::dash_t)
*/
-void convert_dashes(const Py::Tuple& dashes, bool snap, double dpi,
GCAgg::dash_t& dashes_out,
+void convert_dashes(const Py::Tuple& dashes, double dpi, GCAgg::dash_t&
dashes_out,
double& dashOffset_out) {
if (dashes.length()!=2)
throw Py::ValueError(Printf("Dash descriptor must be a length 2 tuple;
found %d", dashes.length()).str());
@@ -124,10 +124,6 @@
for (size_t i = 0; i < Ndash; i += 2) {
val0 = double(Py::Float(dashSeq[i])) * dpi/72.0;
val1 = double(Py::Float(dashSeq[i+1])) * dpi/72.0;
- if (snap) {
- val0 = (int)val0 + 0.5;
- val1 = (int)val1 + 0.5;
- }
dashes_out.push_back(std::make_pair(val0, val1));
}
}
@@ -143,8 +139,6 @@
conv_quantize(VertexSource& source, bool quantize) :
m_source(&source), m_quantize(quantize) {}
- void set_source(VertexSource& source) { m_source = &source; }
-
void rewind(unsigned path_id) {
m_source->rewind(path_id);
}
@@ -158,18 +152,14 @@
return cmd;
}
- void activate(bool quantize) {
- m_quantize = quantize;
- }
-
private:
VertexSource* m_source;
bool m_quantize;
};
-GCAgg::GCAgg(const Py::Object &gc, double dpi, bool snapto) :
- dpi(dpi), snapto(snapto), isaa(true), linewidth(1.0), alpha(1.0),
+GCAgg::GCAgg(const Py::Object &gc, double dpi) :
+ dpi(dpi), isaa(true), linewidth(1.0), alpha(1.0),
dashOffset(0.0)
{
_VERBOSE("GCAgg::GCAgg");
@@ -184,8 +174,8 @@
_set_clip_path(gc);
}
-GCAgg::GCAgg(double dpi, bool snapto) :
- dpi(dpi), snapto(snapto), isaa(true), linewidth(1.0), alpha(1.0),
+GCAgg::GCAgg(double dpi) :
+ dpi(dpi), isaa(true), linewidth(1.0), alpha(1.0),
dashOffset(0.0)
{
@@ -260,7 +250,7 @@
return;
}
- convert_dashes(dash_obj, snapto, dpi, dashes, dashOffset);
+ convert_dashes(dash_obj, dpi, dashes, dashOffset);
}
void
@@ -435,17 +425,31 @@
bool should_snap(Path& path, const agg::trans_affine& trans) {
// If this is a straight horizontal or vertical line, quantize to nearest
// pixels
- bool snap = false;
- if (path.total_vertices() == 2) {
- double x0, y0, x1, y1;
- path.vertex(0, &x0, &y0);
- trans.transform(&x0, &y0);
- path.vertex(1, &x1, &y1);
+ double x0, y0, x1, y1;
+ unsigned code;
+ code = path.vertex(&x0, &y0);
+ trans.transform(&x0, &y0);
+
+ while ((code = path.vertex(&x1, &y1)) != agg::path_cmd_stop) {
+
+ switch (code) {
+ case agg::path_cmd_curve3:
+ case agg::path_cmd_curve4:
+ path.rewind(0);
+ return false;
+ }
+
trans.transform(&x1, &y1);
- snap = (fabs(x0 - x1) < 1.0 || fabs(y0 - y1) < 1.0);
+ if (!(fabs(x0 - x1) < 0.1 || fabs(y0 - y1) < 0.1)) {
+ path.rewind(0);
+ return false;
+ }
+ x0 = x1;
+ y0 = y1;
}
- return snap;
+ path.rewind(0);
+ return true;
}
Py::Object
@@ -563,10 +567,10 @@
curve_t marker_path_curve(marker_path_transformed);
PathIterator path(path_obj);
+ bool snap = should_snap(path, trans);
transformed_path_t path_transformed(path, trans);
- // bool snap = should_snap(path, trans);
- GCAgg gc = GCAgg(gc_obj, dpi, true);
- quantize_t path_quantized(path_transformed, true);
+ GCAgg gc = GCAgg(gc_obj, dpi);
+ quantize_t path_quantized(path_transformed, snap);
path_quantized.rewind(0);
facepair_t face = _get_rgba_face(face_obj, gc.alpha);
@@ -793,31 +797,37 @@
Py::Object
RendererAgg::draw_image(const Py::Tuple& args) {
_VERBOSE("RendererAgg::draw_image");
- args.verify_length(4);
+ args.verify_length(4, 6);
float x = Py::Float(args[0]);
float y = Py::Float(args[1]);
Image *image = static_cast<Image*>(args[2].ptr());
Py::Object box_obj = args[3];
-
+ Py::Object clippath;
+ agg::trans_affine clippath_trans;
+ if (args.size() == 6) {
+ clippath = args[4];
+ clippath_trans = py_to_agg_transformation_matrix(args[5]);
+ }
+
theRasterizer->reset_clipping();
rendererBase->reset_clipping(true);
set_clipbox(box_obj, rendererBase);
-
+
+ Py::Tuple empty;
pixfmt pixf(*(image->rbufOut));
-
-
- Py::Tuple empty;
image->flipud_out(empty);
+
rendererBase->blend_from(pixf, 0, (int)x, (int)(height-(y+image->rowsOut)));
+
image->flipud_out(empty);
return Py::Object();
}
void RendererAgg::_draw_path(PathIterator& path, agg::trans_affine trans,
- bool snap, bool has_clippath,
- const facepair_t& face, const GCAgg& gc) {
+ bool has_clippath, const facepair_t& face,
+ const GCAgg& gc) {
typedef agg::conv_transform<PathIterator> transformed_path_t;
typedef conv_quantize<transformed_path_t> quantize_t;
typedef agg::conv_curve<quantize_t> curve_t;
@@ -833,6 +843,7 @@
trans *= agg::trans_affine_translation(0.0, (double)height);
// Build the transform stack
+ bool snap = should_snap(path, trans);
transformed_path_t tpath(path, trans);
quantize_t quantized(tpath, snap);
// Benchmarking shows that there is no noticable slowdown to always
@@ -871,25 +882,36 @@
// Render stroke
if (gc.linewidth != 0.0) {
+ double linewidth = gc.linewidth;
+ if (snap)
+ linewidth = round(linewidth);
+
if (gc.dashes.size() == 0) {
stroke_t stroke(curve);
- stroke.width(gc.linewidth);
+ stroke.width(linewidth);
stroke.line_cap(gc.cap);
stroke.line_join(gc.join);
theRasterizer->add_path(stroke);
} else {
dash_t dash(curve);
for (GCAgg::dash_t::const_iterator i = gc.dashes.begin();
- i != gc.dashes.end(); ++i)
- dash.add_dash(i->first, i->second);
+ i != gc.dashes.end(); ++i) {
+ double val0 = i->first;
+ double val1 = i->second;
+ if (snap) {
+ val0 = (int)val0 + 0.5;
+ val1 = (int)val1 + 0.5;
+ }
+ dash.add_dash(val0, val1);
+ }
stroke_dash_t stroke(dash);
stroke.line_cap(gc.cap);
stroke.line_join(gc.join);
- stroke.width(gc.linewidth);
+ stroke.width(linewidth);
theRasterizer->add_path(stroke);
}
- if (gc.isaa && !(snap && gc.linewidth < 1.5)) {
+ if (gc.isaa && !(snap)) {
if (has_clippath) {
pixfmt_amask_type pfa(*pixFmt, *alphaMask);
amask_ren_type r(pfa);
@@ -928,8 +950,7 @@
face_obj = args[3];
PathIterator path(path_obj);
- bool snap = should_snap(path, trans);
- GCAgg gc = GCAgg(gc_obj, dpi, snap);
+ GCAgg gc = GCAgg(gc_obj, dpi);
facepair_t face = _get_rgba_face(face_obj, gc.alpha);
theRasterizer->reset_clipping();
@@ -937,7 +958,7 @@
set_clipbox(gc.cliprect, theRasterizer);
bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
- _draw_path(path, trans, snap, has_clippath, face, gc);
+ _draw_path(path, trans, has_clippath, face, gc);
return Py::Object();
}
@@ -962,7 +983,7 @@
Py::SeqBase<Py::Object> linestyles_obj = args[11];
Py::SeqBase<Py::Int> antialiaseds = args[12];
- GCAgg gc(dpi, false);
+ GCAgg gc(dpi);
PyArrayObject* offsets = NULL;
PyArrayObject* facecolors = NULL;
@@ -973,13 +994,15 @@
if (!offsets || offsets->dimensions[1] != 2)
throw Py::ValueError("Offsets array must be Nx2");
- PyArrayObject* facecolors =
(PyArrayObject*)PyArray_FromObject(facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
+ PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject
+ (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
if (!facecolors ||
(facecolors->nd == 1 && facecolors->dimensions[0] != 0) ||
(facecolors->nd == 2 && facecolors->dimensions[1] != 4))
throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty");
- PyArrayObject* edgecolors =
(PyArrayObject*)PyArray_FromObject(edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
+ PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject
+ (edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
if (!edgecolors ||
(edgecolors->nd == 1 && edgecolors->dimensions[0] != 0) ||
(edgecolors->nd == 2 && edgecolors->dimensions[1] != 4))
@@ -995,10 +1018,10 @@
size_t Nlinestyles = std::min(linestyles_obj.length(), N);
size_t Naa = antialiaseds.length();
- if ((Nfacecolors == 0 && Nedgecolors == 0) || N == 0)
+ if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0)
return Py::Object();
- size_t i = 0;
+ size_t i = 0;
// Convert all of the transforms up front
typedef std::vector<agg::trans_affine> transforms_t;
@@ -1018,7 +1041,7 @@
i = 0;
for (dashes_t::iterator d = dashes.begin();
d != dashes.end(); ++d, ++i) {
- convert_dashes(Py::Tuple(linestyles_obj[i]), false, dpi, d->second,
d->first);
+ convert_dashes(Py::Tuple(linestyles_obj[i]), dpi, d->second, d->first);
}
// Handle any clipping globally
@@ -1034,34 +1057,34 @@
for (i = 0; i < N; ++i) {
PathIterator path(paths[i % Npaths]);
- bool snap = (path.total_vertices() == 2);
- double xo = *(double*)PyArray_GETPTR2(offsets, i %
Noffsets, 0);
- double yo = *(double*)PyArray_GETPTR2(offsets, i %
Noffsets, 1);
+ double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0);
+ double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1);
offset_trans.transform(&xo, &yo);
agg::trans_affine_translation transOffset(xo, yo);
agg::trans_affine& trans = transforms[i % Ntransforms];
if (Nfacecolors) {
size_t fi = i % Nfacecolors;
- face.second =
agg::rgba(*(double*)PyArray_GETPTR2(facecolors, fi, 0),
-
*(double*)PyArray_GETPTR2(facecolors, fi, 1),
-
*(double*)PyArray_GETPTR2(facecolors, fi, 2),
-
*(double*)PyArray_GETPTR2(facecolors, fi, 3));
+ face.second = agg::rgba(*(double*)PyArray_GETPTR2(facecolors, fi, 0),
+ *(double*)PyArray_GETPTR2(facecolors, fi, 1),
+ *(double*)PyArray_GETPTR2(facecolors, fi, 2),
+ *(double*)PyArray_GETPTR2(facecolors, fi, 3));
}
if (Nedgecolors) {
size_t ei = i % Nedgecolors;
- gc.color =
agg::rgba(*(double*)PyArray_GETPTR2(edgecolors, ei, 0),
-
*(double*)PyArray_GETPTR2(edgecolors, ei, 1),
-
*(double*)PyArray_GETPTR2(edgecolors, ei, 2),
-
*(double*)PyArray_GETPTR2(edgecolors, ei, 3));
- gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths]))
* dpi/72.0;
- gc.dashes = dashes[i % Nlinestyles].second;
- gc.dashOffset = dashes[i % Nlinestyles].first;
+ gc.color = agg::rgba(*(double*)PyArray_GETPTR2(edgecolors, ei, 0),
+ *(double*)PyArray_GETPTR2(edgecolors, ei, 1),
+ *(double*)PyArray_GETPTR2(edgecolors, ei, 2),
+ *(double*)PyArray_GETPTR2(edgecolors, ei, 3));
+ gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) *
dpi/72.0;
+ gc.dashes = dashes[i % Nlinestyles].second;
+ gc.dashOffset = dashes[i % Nlinestyles].first;
}
- gc.isaa = bool(Py::Int(antialiaseds[i % Naa]));
- _draw_path(path, trans * transOffset, snap, has_clippath, face, gc);
+ gc.isaa = bool(Py::Int(antialiaseds[i % Naa]));
+
+ _draw_path(path, trans * transOffset, has_clippath, face, gc);
}
} catch (...) {
Py_XDECREF(offsets);
Modified: branches/transforms/src/_backend_agg.h
===================================================================
--- branches/transforms/src/_backend_agg.h 2007-10-16 14:41:29 UTC (rev
3957)
+++ branches/transforms/src/_backend_agg.h 2007-10-16 19:39:57 UTC (rev
3958)
@@ -109,11 +109,10 @@
class GCAgg {
public:
- GCAgg(const Py::Object& gc, double dpi, bool snapto=false);
- GCAgg(double dpi, bool snapto=false);
+ GCAgg(const Py::Object& gc, double dpi);
+ GCAgg(double dpi);
double dpi;
- bool snapto;
bool isaa;
agg::line_cap_e cap;
@@ -219,8 +218,7 @@
void set_clipbox(Py::Object& cliprect, R rasterizer);
bool render_clippath(const Py::Object& clippath, const agg::trans_affine&
clippath_trans);
void _draw_path(PathIterator& path, agg::trans_affine trans,
- bool snap, bool has_clippath,
- const facepair_t& face, const GCAgg& gc);
+ bool has_clippath, const facepair_t& face, const GCAgg& gc);
private:
Py::Object lastclippath;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins