I am trying to merge a change to texmanager from the branch to the trunk, but something doesnt look right after I ran svnmerge.py. Look at all the markup in the diff, I can't commit this, can I?
$ svn diff Property changes on: . ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-5294 + /branches/v0_91_maint:1-5294,5299 Index: CHANGELOG =================================================================== --- CHANGELOG (revision 5299) +++ CHANGELOG (working copy) @@ -1,3 +1,13 @@ +<<<<<<< .working +======= +2008-05-29 Fixed two bugs in texmanager.py: + improved comparison of dvipng versions + fixed a bug introduced when get_grey method was added + - DSD + +2008-05-29 Implement path clipping in SVG backend - MGD + +>>>>>>> .merge-right.r5299 2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte characters are used with Type 3 fonts - MGD Index: lib/matplotlib/texmanager.py =================================================================== --- lib/matplotlib/texmanager.py (revision 5299) +++ lib/matplotlib/texmanager.py (working copy) @@ -33,8 +33,14 @@ """ +<<<<<<< .working import copy, glob, md5, os, shutil, sys import numpy as np +======= +import copy, glob, md5, os, shutil, sys, warnings +import distutils.version +import numpy as npy +>>>>>>> .merge-right.r5299 import matplotlib as mpl from matplotlib import rcParams from matplotlib._image import readpng @@ -44,14 +50,15 @@ if sys.platform.startswith('win'): cmd_split = '&' else: cmd_split = ';' -def get_dvipng_version(): +def dvipng_hack_alpha(): stdin, stdout = os.popen4('dvipng -version') for line in stdout: if line.startswith('dvipng '): version = line.split()[-1] mpl.verbose.report('Found dvipng version %s'% version, 'helpful') - return version + version = distutils.version.LooseVersion(version) + return version < distutils.version.LooseVersion('1.6') raise RuntimeError('Could not obtain dvipng version') @@ -78,7 +85,7 @@ if not os.path.exists(texcache): os.mkdir(texcache) - dvipngVersion = get_dvipng_version() + _dvipng_hack_alpha = dvipng_hack_alpha() # mappable cache of rgba_arrayd = {} @@ -364,8 +371,28 @@ pngfile = self.make_png(tex, fontsize, dpi) X = readpng(os.path.join(self.texcache, pngfile)) - if (self.dvipngVersion < '1.6') or rcParams['text.dvipnghack']: - # hack the alpha channel as described in comment above + if self._dvipng_hack_alpha or rcParams['text.dvipnghack']: + # hack the alpha channel + # dvipng assumed a constant background, whereas we want to + # overlay these rasters with antialiasing over arbitrary + # backgrounds that may have other figure elements under them. + # When you set dvipng -bg Transparent, it actually makes the + # alpha channel 1 and does the background compositing and + # antialiasing itself and puts the blended data in the rgb + # channels. So what we do is extract the alpha information + # from the red channel, which is a blend of the default dvipng + # background (white) and foreground (black). So the amount of + # red (or green or blue for that matter since white and black + # blend to a grayscale) is the alpha intensity. Once we + # extract the correct alpha information, we assign it to the + # alpha channel properly and let the users pick their rgb. In + # this way, we can overlay tex strings on arbitrary + # backgrounds with antialiasing + # + # red = alpha*red_foreground + (1-alpha)*red_background + # + # Since the foreground is black (0) and the background is + # white (1) this reduces to red = 1-alpha or alpha = 1-red alpha = np.sqrt(1-X[:,:,0]) else: alpha = X[:,:,-1] @@ -378,26 +405,6 @@ """ Returns latex's rendering of the tex string as an rgba array """ - # dvipng assumes a constant background, whereas we want to - # overlay these rasters with antialiasing over arbitrary - # backgrounds that may have other figure elements under them. - # When you set dvipng -bg Transparent, it actually makes the - # alpha channel 1 and does the background compositing and - # antialiasing itself and puts the blended data in the rgb - # channels. So what we do is extract the alpha information - # from the red channel, which is a blend of the default dvipng - # background (white) and foreground (black). So the amount of - # red (or green or blue for that matter since white and black - # blend to a grayscale) is the alpha intensity. Once we - # extract the correct alpha information, we assign it to the - # alpha channel properly and let the users pick their rgb. In - # this way, we can overlay tex strings on arbitrary - # backgrounds with antialiasing - # - # red = alpha*red_foreground + (1-alpha)*red_background - # - # Since the foreground is black (0) and the background is - # white (1) this reduces to red = 1-alpha or alpha = 1-red if not fontsize: fontsize = rcParams['font.size'] if not dpi: dpi = rcParams['savefig.dpi'] r,g,b = rgb @@ -407,7 +414,11 @@ if Z is None: alpha = self.get_grey(tex, fontsize, dpi) +<<<<<<< .working Z = np.zeros((X.shape[0], X.shape[1], 4), np.float) +======= + Z = npy.zeros((alpha.shape[0], alpha.shape[1], 4), npy.float) +>>>>>>> .merge-right.r5299 Z[:,:,0] = r Z[:,:,1] = g Z[:,:,2] = b ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel