Revision: 4568
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4568&view=rev
Author: mdboom
Date: 2007-12-03 11:07:36 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
Fix image interpolation edges for Agg 2.4. It no longer needs funny
workarounds with memory copies to interpolate the edges of the image correctly.
Modified Paths:
--------------
branches/transforms/lib/matplotlib/image.py
branches/transforms/src/_image.cpp
Modified: branches/transforms/lib/matplotlib/image.py
===================================================================
--- branches/transforms/lib/matplotlib/image.py 2007-12-03 17:30:46 UTC (rev
4567)
+++ branches/transforms/lib/matplotlib/image.py 2007-12-03 19:07:36 UTC (rev
4568)
@@ -156,9 +156,6 @@
sx = dxintv/self.axes.viewLim.width
sy = dyintv/self.axes.viewLim.height
- if im.get_interpolation()!=_image.NEAREST:
- im.apply_translation(-1, -1)
-
# the viewport translation
tx = (xmin-self.axes.viewLim.x0)/dxintv * numcols
ty = (ymin-self.axes.viewLim.y0)/dyintv * numrows
@@ -382,7 +379,7 @@
if s != None and s != 'nearest':
raise NotImplementedError('Only nearest neighbor supported')
AxesImage.set_interpolation(self, s)
-
+
def get_extent(self):
if self._A is None:
raise RuntimeError('Must set data first')
Modified: branches/transforms/src/_image.cpp
===================================================================
--- branches/transforms/src/_image.cpp 2007-12-03 17:30:46 UTC (rev 4567)
+++ branches/transforms/src/_image.cpp 2007-12-03 19:07:36 UTC (rev 4568)
@@ -379,57 +379,11 @@
double x0, y0, x1, y1;
- if (interpolation==NEAREST) {
- x0 = 0.0;
- x1 = colsIn;
- y0 = 0.0;
- y1 = rowsIn;
- }
- else {
- // if interpolation != nearest, create a new input buffer with the
- // edges mirrored on all size. Then new buffer size is colsIn+2 by
- // rowsIn+2
+ x0 = 0.0;
+ x1 = colsIn;
+ y0 = 0.0;
+ y1 = rowsIn;
- x0 = 1.0;
- x1 = colsIn+1;
- y0 = 1.0;
- y1 = rowsIn+1;
-
-
- bufferPad = new agg::int8u[(rowsIn+2) * (colsIn+2) * BPP];
- if (bufferPad ==NULL)
- throw Py::MemoryError("Image::resize could not allocate memory");
- rbufPad.attach(bufferPad, colsIn+2, rowsIn+2, (colsIn+2) * BPP);
-
- pixfmt pixfpad(rbufPad);
- renderer_base rbpad(pixfpad);
-
- pixfmt pixfin(*rbufIn);
- renderer_base rbin(pixfin);
-
- rbpad.copy_from(*rbufIn, 0, 1, 1);
-
- agg::rect_base<int> firstrow(0, 0, colsIn-1, 0);
- rbpad.copy_from(*rbufIn, &firstrow, 1, 0);
-
- agg::rect_base<int> lastrow(0, rowsIn-1, colsIn-1, rowsIn-1);
- rbpad.copy_from(*rbufIn, &lastrow, 1, 2);
-
- agg::rect_base<int> firstcol(0, 0, 0, rowsIn-1);
- rbpad.copy_from(*rbufIn, &firstcol, 0, 1);
-
- agg::rect_base<int> lastcol(colsIn-1, 0, colsIn-1, rowsIn-1);
- rbpad.copy_from(*rbufIn, &lastcol, 2, 1);
-
- rbpad.copy_pixel(0, 0, rbin.pixel(0,0) );
- rbpad.copy_pixel(0, colsIn+1, rbin.pixel(0,colsIn-1) );
- rbpad.copy_pixel(rowsIn+1, 0, rbin.pixel(rowsIn-1,0) );
- rbpad.copy_pixel(rowsIn+1, colsIn+1, rbin.pixel(rowsIn-1,colsIn-1) );
-
-
- }
-
-
path.move_to(x0, y0);
path.line_to(x1, y0);
path.line_to(x1, y1);
@@ -439,7 +393,7 @@
ras.add_path(imageBox);
typedef agg::image_accessor_clip<pixfmt> img_accessor_type;
-
+
pixfmt pixfmtin(*rbufIn);
img_accessor_type ia(pixfmtin, background);
switch(interpolation)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins