[goffice] GOImage: add format info getter.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GOImage: add format info getter.
- Date: Sat, 28 Feb 2015 22:30:13 +0000 (UTC)
commit 2078655041b9e167db4eef462d9732edfbc1047a
Author: Morten Welinder <terra gnome org>
Date: Sat Feb 28 17:30:00 2015 -0500
GOImage: add format info getter.
ChangeLog | 4 ++++
goffice/utils/go-image.c | 22 ++++++++++++++++++++++
goffice/utils/go-image.h | 2 ++
3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f8ca46e..ddeb493 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-02-28 Morten Welinder <terra gnome org>
+
+ * goffice/utils/go-image.c (go_image_get_info): New function.
+
2015-02-28 Jean Brefort <jean brefort normalesup org>
* goffice/utils/go-image.c (go_image_new_from_data): ensure that GOPixbuf
diff --git a/goffice/utils/go-image.c b/goffice/utils/go-image.c
index 8c46650..ead687d 100644
--- a/goffice/utils/go-image.c
+++ b/goffice/utils/go-image.c
@@ -828,3 +828,25 @@ go_image_get_default_dpi (double *dpi_x, double *dpi_y)
*dpi_x = _go_image_dpi_x;
*dpi_y = _go_image_dpi_y;
}
+
+GOImageFormatInfo const *
+go_image_get_info (GOImage *image)
+{
+ if (GO_IS_PIXBUF (image)) {
+ GOImageFormat f;
+ char *typ;
+ g_object_get (image, "image-type", &typ, NULL);
+ f = go_image_get_format_from_name (typ);
+ g_free (typ);
+ return go_image_get_format_info (f);
+ }
+
+ /* Dubious */
+ if (GO_IS_EMF (image))
+ return go_image_get_format_info (GO_IMAGE_FORMAT_EMF);
+ if (GO_IS_SVG (image))
+ return go_image_get_format_info (GO_IMAGE_FORMAT_SVG);
+ if (GO_IS_SPECTRE (image))
+ return go_image_get_format_info (GO_IMAGE_FORMAT_EPS);
+ return NULL;
+}
diff --git a/goffice/utils/go-image.h b/goffice/utils/go-image.h
index 923331f..28f7e03 100644
--- a/goffice/utils/go-image.h
+++ b/goffice/utils/go-image.h
@@ -115,6 +115,8 @@ double go_image_get_height (GOImage const *image);
void go_image_set_default_dpi (double dpi_x, double dpi_y);
void go_image_get_default_dpi (double *dpi_x, double *dpi_y);
+GOImageFormatInfo const *go_image_get_info (GOImage *image);
+
/* Protected */
void _go_image_changed (GOImage *image, double width, double height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]