Code

Applied patch #1501134
authorjoncruz <joncruz@users.sourceforge.net>
Tue, 6 Jun 2006 03:37:34 +0000 (03:37 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Tue, 6 Jun 2006 03:37:34 +0000 (03:37 +0000)
ChangeLog
src/trace/siox.cpp
src/trace/trace.cpp

index 38d21720179c24573e96811e05078f768f61175e..f2db872f48d2476143d1973d9180099fff8ada78 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,17 +1,23 @@
-2006-06-02  Jon A. Cruz  <jon@joncruz.org>
+2006-06-05  Jon A. Cruz  <jon@joncruz.org>
+
+       * trace/siox.cpp, trace/trace.cpp:
+
+         Applied patch #1501134.
+
+2006-06-05  Jon A. Cruz  <jon@joncruz.org>
 
        * src/dialogs/layers-panel.cpp:
 
          Allow action when no layer selected.
          Fixes bugs #1494646.
 
-2006-06-02  Jon A. Cruz  <jon@joncruz.org>
+2006-06-05  Jon A. Cruz  <jon@joncruz.org>
 
        * trace/siox.cpp:
 
          Applied patch #1500659.
 
-2006-06-02  Jon A. Cruz  <jon@joncruz.org>
+2006-06-05  Jon A. Cruz  <jon@joncruz.org>
 
        * src/dialogs/layers-panel.h, src/dialogs/layers-panel.cpp:
 
index 955446b42219e341cfee0453685b396bc42be74e..752a14460d5d5578ab3d49f02b369d31522a6f53 100644 (file)
@@ -574,16 +574,19 @@ SioxImage::SioxImage(GdkPixbuf *buf)
  */
 GdkPixbuf *SioxImage::getGdkPixbuf()
 {
+    bool has_alpha = true;
+    int n_channels = has_alpha ? 4 : 3;
+
     guchar *pixdata = (guchar *)
-          malloc(sizeof(guchar) * width * height * 3);
+          malloc(sizeof(guchar) * width * height * n_channels);
     if (!pixdata)
         return NULL;
 
-    int n_channels = 3;
-    int rowstride  = width * 3;
+    int rowstride  = width * n_channels;
 
-    GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB,
-                        0, 8, width, height,
+    GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata,
+                        GDK_COLORSPACE_RGB,
+                        has_alpha, 8, width, height,
                         rowstride, NULL, NULL);
 
     //### Fill in the cells with RGB values
@@ -594,9 +597,13 @@ GdkPixbuf *SioxImage::getGdkPixbuf()
         for (unsigned x=0 ; x < width ; x++)
             {
             unsigned int rgb = getPixel(x, y);
-            p[0] = (rgb >> 16) & 0xff;
-            p[1] = (rgb >>  8) & 0xff;
-            p[2] = (rgb      ) & 0xff;
+            p[0] = (rgb >> 16) & 0xff;//r
+            p[1] = (rgb >>  8) & 0xff;//g
+            p[2] = (rgb      ) & 0xff;//b
+            if ( n_channels > 3 )
+                {
+                p[3] = (rgb >> 24) & 0xff;//a
+                }
             p += n_channels;
             }
         row += rowstride;
index d40fb89d7e67567b2e112c53ec1824e85c78d67f..408f5c5c3b988ef4e640817750a974240367da38 100644 (file)
@@ -170,7 +170,7 @@ Tracer::sioxProcessImage(SPImage *img, GdkPixbuf *origPixbuf)
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (!desktop)
         {
-        g_warning("Trace: No active desktop\n");
+        g_warning(_("Trace: No active desktop"));
         return NULL;
         }
 
@@ -269,7 +269,7 @@ Tracer::sioxProcessImage(SPImage *img, GdkPixbuf *origPixbuf)
             sengine.extractForeground(simage, 0xffffff);
     if (!result.isValid())
         {
-        g_warning("Invalid SIOX result");
+        g_warning(_("Invalid SIOX result"));
         return NULL;
         }