From: joncruz Date: Tue, 6 Jun 2006 03:37:34 +0000 (+0000) Subject: Applied patch #1501134 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=aa09636cf6013bccc1414407fb9af04f652b4032;p=inkscape.git Applied patch #1501134 --- diff --git a/ChangeLog b/ChangeLog index 38d217201..f2db872f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,23 @@ -2006-06-02 Jon A. Cruz +2006-06-05 Jon A. Cruz + + * trace/siox.cpp, trace/trace.cpp: + + Applied patch #1501134. + +2006-06-05 Jon A. Cruz * src/dialogs/layers-panel.cpp: Allow action when no layer selected. Fixes bugs #1494646. -2006-06-02 Jon A. Cruz +2006-06-05 Jon A. Cruz * trace/siox.cpp: Applied patch #1500659. -2006-06-02 Jon A. Cruz +2006-06-05 Jon A. Cruz * src/dialogs/layers-panel.h, src/dialogs/layers-panel.cpp: diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index 955446b42..752a14460 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -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; diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index d40fb89d7..408f5c5c3 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -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; }