You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(5) |
2
(4) |
3
(2) |
4
(4) |
5
(2) |
6
(32) |
7
(34) |
8
(19) |
9
(6) |
10
(7) |
11
(14) |
12
(1) |
13
(2) |
14
(8) |
15
(5) |
16
(5) |
17
(8) |
18
(8) |
19
(6) |
20
(9) |
21
(12) |
22
(1) |
23
(2) |
24
(8) |
25
(2) |
26
(1) |
27
(2) |
28
(3) |
29
|
30
(2) |
|
|
|
Revision: 7630 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7630&view=rev Author: mdboom Date: 2009年09月02日 20:48:06 +0000 (2009年9月02日) Log Message: ----------- Add Gouraud triangle support to PS backend. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009年09月02日 19:31:32 UTC (rev 7629) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009年09月02日 20:48:06 UTC (rev 7630) @@ -754,6 +754,57 @@ """ % locals() self._pswriter.write(ps) + def draw_gouraud_triangle(self, gc, points, colors, trans): + self.draw_gouraud_triangles(gc, points.reshape((1, 3, 2)), + colors.reshape((1, 3, 4)), trans) + + def draw_gouraud_triangles(self, gc, points, colors, trans): + assert len(points) == len(colors) + assert points.ndim == 3 + assert points.shape[1] == 3 + assert points.shape[2] == 2 + assert colors.ndim == 3 + assert colors.shape[1] == 3 + assert colors.shape[2] == 4 + + points = trans.transform(points) + + shape = points.shape + flat_points = points.reshape((shape[0] * shape[1], 2)) + flat_colors = colors.reshape((shape[0] * shape[1], 4)) + points_min = npy.min(flat_points, axis=0) - (1 << 8) + points_max = npy.max(flat_points, axis=0) + (1 << 8) + factor = float(0xffffffff) / (points_max - points_min) + + xmin, ymin = points_min + xmax, ymax = points_max + + streamarr = npy.empty( + (shape[0] * shape[1],), + dtype=[('flags', 'u1'), + ('points', '>u4', (2,)), + ('colors', 'u1', (3,))]) + streamarr['flags'] = 0 + streamarr['points'] = (flat_points - points_min) * factor + streamarr['colors'] = flat_colors[:, :3] * 255.0 + + stream = quote_ps_string(streamarr.tostring()) + + self._pswriter.write(""" +gsave +<< /ShadingType 4 + /ColorSpace [/DeviceRGB] + /BitsPerCoordinate 32 + /BitsPerComponent 8 + /BitsPerFlag 8 + /AntiAlias true + /Decode [ %(xmin)f %(xmax)f %(ymin)f %(ymax)f 0 1 0 1 0 1 ] + /DataSource (%(stream)s) +>> +shfill +grestore +""" % locals()) + def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None): """ Emit the PostScript sniplet 'ps' with all the attributes from 'gc' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7629 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7629&view=rev Author: mdboom Date: 2009年09月02日 19:31:32 +0000 (2009年9月02日) Log Message: ----------- Add Gouraud triangle support (of a fashion) to SVG backend. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2009年09月02日 19:30:30 UTC (rev 7628) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2009年09月02日 19:31:32 UTC (rev 7629) @@ -2,6 +2,8 @@ import os, codecs, base64, tempfile, urllib, gzip, cStringIO +import numpy as np + try: from hashlib import md5 except ImportError: @@ -54,6 +56,7 @@ self._path_collection_id = 0 self._imaged = {} self._hatchd = {} + self._n_gradients = 0 self.mathtext_parser = MathTextParser('SVG') svgwriter.write(svgProlog%(width,height,width,height)) @@ -298,6 +301,63 @@ self._path_collection_id += 1 + def draw_gouraud_triangle(self, gc, points, colors, trans): + # This uses a method described here: + # + # http://www.svgopen.org/2005/papers/Converting3DFaceToSVG/index.html + # + # that uses three overlapping linear gradients to simulate a + # Gouraud triangle. Each gradient goes from fully opaque in + # one corner to fully transparent along the opposite edge. + # The line between the stop points is perpendicular to the + # opposite edge. Underlying these three gradients is a solid + # triangle whose color is the average of all three points. + + trans_and_flip = self._make_flip_transform(trans) + tpoints = trans_and_flip.transform(points) + write = self._svgwriter.write + + write('<defs>') + for i in range(3): + x1, y1 = points[i] + x2, y2 = points[(i + 1) % 3] + x3, y3 = points[(i + 2) % 3] + c = colors[i][:3] + + if x2 == x3: + xb = x2 + yb = y1 + elif y2 == y3: + xb = x1 + yb = y2 + else: + m1 = (y2 - y3) / (x2 - x3) + b1 = y2 - (m1 * x2) + m2 = -(1.0 / m1) + b2 = y1 - (m2 * x1) + xb = (-b1 + b2) / (m1 - m2) + yb = m2 * xb + b2 + + write('<linearGradient id="GR%x_%d" x1="%f" y1="%f" x2="%f" y2="%f" gradientUnits="userSpaceOnUse">' % + (self._n_gradients, i, x1, y1, xb, yb)) + write('<stop offset="0" stop-color="%s" stop-opacity="1.0"/>' % rgb2hex(c)) + write('<stop offset="1" stop-color="%s" stop-opacity="0.0"/>' % rgb2hex(c)) + write('</linearGradient>') + + # Define the triangle itself as a "def" since we use it 4 times + write('<polygon id="GT%x" points="%f %f %f %f %f %f"/>' % + (self._n_gradients, x1, y1, x2, y2, x3, y3)) + write('</defs>\n') + + avg_color = np.sum(colors[:, :3], axis=0) / 3.0 + write('<use xlink:href="#GT%x" fill="%s"/>\n' % + (self._n_gradients, rgb2hex(avg_color))) + for i in range(3): + write('<use xlink:href="#GT%x" fill="url(#GR%x_%d)" filter="url(#colorAdd)"/>\n' % + (self._n_gradients, self._n_gradients, i)) + + self._n_gradients += 1 + def draw_image(self, gc, x, y, im): # MGDTODO: Support clippath here trans = [1,0,0,1,0,0] @@ -305,7 +365,7 @@ if rcParams['svg.image_noscale']: trans = list(im.get_matrix()) trans[5] = -trans[5] - transstr = 'transform="matrix(%f %f %f %f %f %f)" '%tuple(trans) + transstr = 'transform="matrix(%f %f %f %f %f %f)" ' % tuple(trans) assert trans[1] == 0 assert trans[2] == 0 numrows,numcols = im.get_size() @@ -672,4 +732,5 @@ xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="svg1"> +<filter id="colorAdd"><feComposite in="SourceGraphic" in2="BackgroundImage" operator="arithmetic" k2="1" k3="1"/></filter> """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7628 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7628&view=rev Author: mdboom Date: 2009年09月02日 19:30:30 +0000 (2009年9月02日) Log Message: ----------- Improve memory management and error handling in draw_gouraud_triangle(s) in the Agg backend. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009年09月02日 00:44:16 UTC (rev 7627) +++ trunk/matplotlib/src/_backend_agg.cpp 2009年09月02日 19:30:30 UTC (rev 7628) @@ -1094,14 +1094,14 @@ throw Py::ValueError("Offsets array must be Nx2"); } - PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject + facecolors = (PyArrayObject*)PyArray_FromObject (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); if (!facecolors || (PyArray_NDIM(facecolors) == 1 && PyArray_DIM(facecolors, 0) != 0) || (PyArray_NDIM(facecolors) == 2 && PyArray_DIM(facecolors, 1) != 4)) throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty"); - PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject + edgecolors = (PyArrayObject*)PyArray_FromObject (edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); if (!edgecolors || (PyArray_NDIM(edgecolors) == 1 && PyArray_DIM(edgecolors, 0) != 0) || @@ -1459,13 +1459,14 @@ RendererAgg::_draw_gouraud_triangle(const GCAgg& gc, const double* points, const double* colors, agg::trans_affine trans) { - typedef agg::rgba8 color_t; - typedef agg::span_gouraud_rgba<color_t> span_gen_t; - typedef agg::span_allocator<color_t> span_alloc_t; + typedef agg::rgba8 color_t; + typedef agg::span_gouraud_rgba<color_t> span_gen_t; + typedef agg::span_allocator<color_t> span_alloc_t; theRasterizer.reset_clipping(); rendererBase.reset_clipping(true); set_clipbox(gc.cliprect, theRasterizer); + /* TODO: Support clip paths */ trans *= agg::trans_affine_scaling(1.0, -1.0); trans *= agg::trans_affine_translation(0.0, (double)height); @@ -1492,8 +1493,8 @@ 0.5); theRasterizer.add_path(span_gen); - agg::render_scanlines_aa( - theRasterizer, slineP8, rendererBase, span_alloc, span_gen); + + agg::render_scanlines_aa(theRasterizer, slineP8, rendererBase, span_alloc, span_gen); } Py::Object @@ -1501,36 +1502,40 @@ _VERBOSE("RendererAgg::draw_gouraud_triangle"); args.verify_length(4); - //segments, trans, clipbox, colors, linewidths, antialiaseds GCAgg gc(args[0], dpi); Py::Object points_obj = args[1]; Py::Object colors_obj = args[2]; agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr()); - PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny - (points_obj.ptr(), PyArray_DOUBLE, 2, 2); - if (!points || - PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2) - throw Py::ValueError("points must be a 3x2 numpy array"); + PyArrayObject* points = NULL; + PyArrayObject* colors = NULL; - PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny - (colors_obj.ptr(), PyArray_DOUBLE, 2, 2); - if (!colors || - PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4) - throw Py::ValueError("colors must be a 3x4 numpy array"); + try { + points = (PyArrayObject*)PyArray_ContiguousFromAny + (points_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!points || + PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2) { + throw Py::ValueError("points must be a 3x2 numpy array"); + } - try { + colors = (PyArrayObject*)PyArray_ContiguousFromAny + (colors_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!colors || + PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4) { + throw Py::ValueError("colors must be a 3x4 numpy array"); + } + _draw_gouraud_triangle( gc, (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors), trans); } catch (...) { - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); throw; } - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); return Py::Object(); } @@ -1544,42 +1549,45 @@ typedef agg::span_gouraud_rgba<color_t> span_gen_t; typedef agg::span_allocator<color_t> span_alloc_t; - //segments, trans, clipbox, colors, linewidths, antialiaseds GCAgg gc(args[0], dpi); Py::Object points_obj = args[1]; Py::Object colors_obj = args[2]; agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr()); - PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny - (points_obj.ptr(), PyArray_DOUBLE, 3, 3); - if (!points || - PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2) - throw Py::ValueError("points must be a Nx3x2 numpy array"); + PyArrayObject* points = NULL; + PyArrayObject* colors = NULL; - PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny - (colors_obj.ptr(), PyArray_DOUBLE, 3, 3); - if (!colors || - PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4) - throw Py::ValueError("colors must be a Nx3x4 numpy array"); + try { + points = (PyArrayObject*)PyArray_ContiguousFromAny + (points_obj.ptr(), PyArray_DOUBLE, 3, 3); + if (!points || + PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2) { + throw Py::ValueError("points must be a Nx3x2 numpy array"); + } - if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0)) { - throw Py::ValueError("points and colors arrays must be the same length"); - } + colors = (PyArrayObject*)PyArray_ContiguousFromAny + (colors_obj.ptr(), PyArray_DOUBLE, 3, 3); + if (!colors || + PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4) { + throw Py::ValueError("colors must be a Nx3x4 numpy array"); + } - try { + if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0)) { + throw Py::ValueError("points and colors arrays must be the same length"); + } + for (int i = 0; i < PyArray_DIM(points, 0); ++i) { - _draw_gouraud_triangle( - gc, (double*)PyArray_GETPTR1(points, i), (double*)PyArray_GETPTR1(colors, i), trans); + _draw_gouraud_triangle(gc, (double*)PyArray_GETPTR1(points, i), (double*)PyArray_GETPTR1(colors, i), trans); } } catch (...) { - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); throw; } - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); return Py::Object(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7627 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7627&view=rev Author: mdehoon Date: 2009年09月02日 00:44:16 +0000 (2009年9月02日) Log Message: ----------- Allowing mouse dragging with three-button mice. Modified Paths: -------------- trunk/matplotlib/src/_macosx.m Modified: trunk/matplotlib/src/_macosx.m =================================================================== --- trunk/matplotlib/src/_macosx.m 2009年09月01日 14:44:50 UTC (rev 7626) +++ trunk/matplotlib/src/_macosx.m 2009年09月02日 00:44:16 UTC (rev 7627) @@ -349,8 +349,10 @@ - (void)mouseMoved:(NSEvent*)event; - (void)rightMouseDown:(NSEvent*)event; - (void)rightMouseUp:(NSEvent*)event; +- (void)rightMouseDragged:(NSEvent*)event; - (void)otherMouseDown:(NSEvent*)event; - (void)otherMouseUp:(NSEvent*)event; +- (void)otherMouseDragged:(NSEvent*)event; - (void)setRubberband:(NSRect)rect; - (void)removeRubberband; - (const char*)convertKeyEvent:(NSEvent*)event; @@ -4744,6 +4746,23 @@ PyGILState_Release(gstate); } +- (void)rightMouseDragged:(NSEvent *)event +{ + int x, y; + NSPoint location = [event locationInWindow]; + location = [self convertPoint: location fromView: nil]; + x = location.x; + y = location.y; + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y); + if(result) + Py_DECREF(result); + else + PyErr_Print(); + + PyGILState_Release(gstate); +} + - (void)otherMouseDown:(NSEvent *)event { int x, y; @@ -4784,6 +4803,23 @@ PyGILState_Release(gstate); } +- (void)otherMouseDragged:(NSEvent *)event +{ + int x, y; + NSPoint location = [event locationInWindow]; + location = [self convertPoint: location fromView: nil]; + x = location.x; + y = location.y; + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y); + if(result) + Py_DECREF(result); + else + PyErr_Print(); + + PyGILState_Release(gstate); +} + - (void)setRubberband:(NSRect)rect { if (!NSIsEmptyRect(rubberband)) [self setNeedsDisplayInRect: rubberband]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.