Skip to content

Commit c6f0d98

Browse files
committed
fixed ps image bug
svn path=/trunk/matplotlib/; revision=1673
1 parent 890a1ce commit c6f0d98

File tree

7 files changed

+18
-8
lines changed

7 files changed

+18
-8
lines changed

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
New entries should be added at the top
22

3+
2005-08-24 Fixes a PS image bug reported by Darren - JDH
4+
35
2005-08-23 colors.py: change hex2color() to accept unicode strings as well as
46
normal strings. Use isinstance() instead of types.IntType etc - SC
57

TODO

+6-1
Original file line numberDiff line numberDiff line change
@@ -709,4 +709,9 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
709709

710710
-- DONE merge qt patch.
711711

712-
-- add frac kwarg to
712+
-- properly handle sys.arv, so that it does not conflict with library
713+
usage of mpl. mpl processes -Dagg, --verbose-helpful, etc, itself,
714+
which can conflict with code that uses mpl as a library and process
715+
options itself.
716+
717+
-- Darren's black band ps image problem.

lib/matplotlib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
from __future__ import generators
144144

145145

146-
__version__ = '0.84cvs'
146+
__version__ = '0.84cvs1'
147147
__revision__ = '$Revision$'
148148
__date__ = '$Date$'
149149

lib/matplotlib/backends/backend_ps.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,12 @@ def _rgba(self, im):
277277
return im.as_rgba_str()
278278

279279
def _rgb(self, im):
280-
rgbat = im.as_rgba_str()
281-
rgba = fromstring(rgbat[2], UInt8)
282-
rgba.shape = (rgbat[0], rgbat[1], 4)
280+
h,w,s = im.as_rgba_str()
281+
282+
rgba = fromstring(s, UInt8)
283+
rgba.shape = (h, w, 4)
283284
rgb = rgba[:,:,:3]
284-
return rgbat[0], rgbat[1], rgb.tostring()
285+
return h, w, rgb.tostring()
285286

286287
def _gray(self, im, rc=0.3, gc=0.59, bc=0.11):
287288
rgbat = im.as_rgba_str()
@@ -327,6 +328,7 @@ def draw_image(self, x, y, im, bbox):
327328

328329
figh = self.height*72
329330
#print 'values', origin, flipud, figh, h, y
331+
330332
if bbox is not None:
331333
clipx,clipy,clipw,cliph = bbox.get_bounds()
332334
clip = '%s clipbox' % _nums_to_str(clipw, cliph, clipx, clipy)

lib/matplotlib/texmanager.py

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def make_png(self, tex, dpi, force=0):
136136
prefix = self.get_prefix(tex)
137137
pngfile = os.path.join(self.texcache, '%s_%d.png'% (prefix, dpi))
138138

139+
self.get_dvipng_version() # raises if dvipng is not up-to-date
139140
#print 'makepng', prefix, dvifile, pngfile
140141
command = 'dvipng -bg Transparent -fg "rgb 0.0 0.0 0.0" -D %d -T tight -o "%s" "%s"'% (dpi, pngfile, dvifile)
141142

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
BUILD_WINDOWING = 'auto'
4444

4545

46-
VERBOSE = False # insert lots of diagnostic prints in extension code
46+
VERBOSE = False # insert lots of diagnostic prints in extension code
4747

4848

4949

src/_image.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ Image::_get_output_buffer() {
563563
if (flipy) {
564564
agg::int8u* buffer = new agg::int8u[rowsOut*colsOut*4];
565565
agg::rendering_buffer rb;
566-
rb.attach(buffer, rowsOut, colsOut, colsOut*4);
566+
rb.attach(buffer, colsOut, rowsOut, colsOut*4);
567567
rb.copy_from(*rbufOut);
568568
ret.first = buffer;
569569
ret.second = true;

0 commit comments

Comments
 (0)