]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsImageXPM.C
Rotate in the same sense as xdvi et al.
[lyx.git] / src / graphics / GraphicsImageXPM.C
index 23f0c3b69cf31113ba1d8a67b4dd57e6452ae775..642c81c1de8a550cce0044a166f85bffb584263f 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "GraphicsImageXPM.h"
 #include "GraphicsParams.h"
-#include "ColorHandler.h"
+#include "frontends/xforms/ColorHandler.h"
 #include "debug.h"
 #include "frontends/GUIRunTime.h" // x11Display, x11Screen
 #include "support/filetools.h"    // IsFileReadable
@@ -31,7 +31,7 @@ namespace grfx {
 ImagePtr GImageXPM::newImage()
 {
        ImagePtr ptr;
-       ptr.reset(new GImageXPM());
+       ptr.reset(new GImageXPM);
        return ptr;
 }
 
@@ -95,14 +95,14 @@ Pixmap GImageXPM::getPixmap() const
 void GImageXPM::load(string const & filename, GImage::SignalTypePtr on_finish)
 {
        if (filename.empty()) {
-               on_finish->emit(false);
+               on_finish->operator()(false);
                return;
        }
 
        if (!image_.empty()) {
                lyxerr[Debug::GRAPHICS]
                        << "Image is loaded already!" << std::endl;
-               on_finish->emit(false);
+               on_finish->operator()(false);
                return;
        }
 
@@ -142,7 +142,7 @@ void GImageXPM::load(string const & filename, GImage::SignalTypePtr on_finish)
                image_.reset(*xpm_image);
        }
 
-       on_finish->emit(success == XpmSuccess);
+       on_finish->operator()(success == XpmSuccess);
 }
 
 
@@ -188,13 +188,18 @@ bool GImageXPM::setPixmap(GParams const & params)
        attrib.valuemask |= XpmColorKey;
 
        // Set the color "none" entry to the color of the background.
-       XpmColorSymbol xpm_col;
-       xpm_col.name = 0;
-       xpm_col.value = "none";
-       xpm_col.pixel = lyxColorHandler->colorPixel(LColor::graphicsbg);
-
-       attrib.numsymbols = 1;
-       attrib.colorsymbols = &xpm_col;
+       XpmColorSymbol xpm_col[2];
+       xpm_col[0].name = 0;
+       xpm_col[0].value = "none";
+       xpm_col[0].pixel = lyxColorHandler->colorPixel(LColor::graphicsbg);
+
+       // some image magick versions use this
+       xpm_col[1].name = 0;
+       xpm_col[1].value = "opaque";
+       xpm_col[1].pixel = lyxColorHandler->colorPixel(LColor::white);
+
+       attrib.numsymbols = 2;
+       attrib.colorsymbols = xpm_col;
        attrib.valuemask |= XpmColorSymbols;
 
        // Load up the pixmap
@@ -277,7 +282,8 @@ void GImageXPM::rotate(GParams const & params)
        // Ascertain the bounding box of the rotated image
        // Rotate about the bottom-left corner
        static double const pi = 3.14159265358979323846;
-       double const angle = double(params.angle) * pi / 180.0;
+       // The minus sign is needed to rotate in the same sense as xdvi et al.
+       double const angle = -double(params.angle) * pi / 180.0;
        double const cos_a = cos(angle);
        double const sin_a = sin(angle);