If a pixmap contains a transparent colour, then set it to the colour of the

background. (With thanks to John Levon.)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2780 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-09-21 10:52:48 +00:00
parent 846ea78a7b
commit 70a852b5e1
4 changed files with 25 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2001-09-21 Angus Leeming <a.leeming@ic.ac.uk>
* ImageLoaderXPM.C (runImageLoader): If the pixmap contains a
transparent colour, then set it to the colour of the background.
2001-09-20 Angus Leeming <a.leeming@ic.ac.uk>
* GraphicsCacheItem.C (convertImage): only convert if "from" and "to"

View File

@ -13,6 +13,7 @@
#include <config.h>
#include "ImageLoaderXPM.h"
#include "ColorHandler.h"
#include "frontends/support/LyXImage.h"
#include "frontends/GUIRunTime.h"
#include "support/filetools.h"
@ -66,11 +67,21 @@ ImageLoaderXPM::runImageLoader(string const & filename)
Pixmap pixmap;
Pixmap mask;
// If the pixmap contains a transparent colour, then set it to the
// colour of the background (Angus 21 Sep 2001)
XpmColorSymbol xpm_col;
xpm_col.name = 0;
xpm_col.value = "none";
xpm_col.pixel = lyxColorHandler->colorPixel(LColor::graphicsbg);
XpmAttributes attrib;
attrib.valuemask = XpmCloseness;
attrib.valuemask = XpmCloseness | XpmColorSymbols;
attrib.closeness = 10000;
attrib.valuemask = XpmColorSymbols;
attrib.numsymbols = 1;
attrib.colorsymbols = &xpm_col;
int status = XpmReadFileToPixmap(
display,
XRootWindowOfScreen(screen),
@ -83,7 +94,7 @@ ImageLoaderXPM::runImageLoader(string const & filename)
<< endl;
return ErrorWhileLoading;
}
// This should have been set by the XpmReadFileToPixmap call!
lyx::Assert(attrib.valuemask & XpmSize);

View File

@ -1,3 +1,8 @@
2001-09-21 Angus Leeming <a.leeming@ic.ac.uk>
* insetgraphics.C (draw): remove the previous change. Right place is in
imageLoaderXPM.C.
2001-09-18 Angus Leeming <a.leeming@ic.ac.uk>
* figinset.C (runqueue):

View File

@ -284,12 +284,6 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
// we draw just a rectangle.
if (imageLoaded) {
// Draw a ractangle with the specified color. If the image is
// transparent, this will shine through.
paint.fillRectangle(old_x + 2, baseline - lascent,
lwidth - 4, lascent + ldescent,
LColor::graphicsbg);
paint.image(old_x + 2, baseline - lascent,
lwidth - 4, lascent + ldescent,
cacheHandle->getImage());