[goffice] Read 24 bits images in EMF.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Read 24 bits images in EMF.
- Date: Sat, 10 Nov 2012 20:22:48 +0000 (UTC)
commit 73c5236bf16668d365cf6c97737bf6d1010eb871
Author: Jean Brefort <jean brefort normalesup org>
Date: Sat Nov 10 21:22:01 2012 +0100
Read 24 bits images in EMF.
ChangeLog | 5 +++++
goffice/utils/go-emf.c | 26 ++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5967f6a..990e95b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-11-10 Jean Brefort <jean brefort normalesup org>
+ * goffice/utils/go-emf.c (go_dib_create_pixbuf_from_data): read 24 bits
+ images.
+
+2012-11-10 Jean Brefort <jean brefort normalesup org>
+
* goffice/graph/gog-axis-color-map.c:
* goffice/graph/gog-theme.c (gog_theme_set_name),
(gog_theme_set_description), (gog_theme_dup), (gog_theme_edit): prepare for
diff --git a/goffice/utils/go-emf.c b/goffice/utils/go-emf.c
index 2ed8806..2b0db4a 100644
--- a/goffice/utils/go-emf.c
+++ b/goffice/utils/go-emf.c
@@ -400,6 +400,32 @@ go_dib_create_pixbuf_from_data (GODibHeader const *header, guint8 const *data)
case 16:
break;
case 24:
+ src_rowstride = (header->width * 3 + 3) / 4 * 4;
+ switch (header->compression) {
+ case 0:
+ if (header->type == 1 && src_rowstride * header->height != header->image_size)
+ g_warning ("Invalid bitmap");
+ src_row = data;
+ row = gdk_pixbuf_get_pixels (pixbuf) + header->height * dst_rowstride;
+ for (i = 0; i < header->height; i++) {
+ row -= dst_rowstride;
+ data = src_row;
+ cur = row;
+ for (j = 0; j < header->width; j++) {
+ cur[0] = data[2];
+ cur[1] = data[1];
+ cur[2] = data[0];
+ cur[3] = 0xff;
+ data += 3;
+ cur += 4;
+ }
+ src_row += src_rowstride;
+ }
+ break;
+ default:
+ g_warning ("Invalid compression for a DIB file");
+ break;
+ }
break;
case 32:
switch (header->compression) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]