gthumb r2375 - in trunk: . doc libgthumb src
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2375 - in trunk: . doc libgthumb src
- Date: Fri, 1 Aug 2008 19:32:58 +0000 (UTC)
Author: mjc
Date: Fri Aug 1 19:32:58 2008
New Revision: 2375
URL: http://svn.gnome.org/viewvc/gthumb?rev=2375&view=rev
Log:
2008-08-01 Michael J. Chudobiak <mjc svn gnome org>
* doc/theme-xml.txt:
* libgthumb/pixbuf-utils.c: (scale_keeping_ratio_min),
(scale_keeping_ratio):
* libgthumb/pixbuf-utils.h:
* src/catalog-web-exporter.c: (catalog_web_exporter_init),
(catalog_web_exporter_set_preview_min_size), (get_var_value),
(image_loader_done), (parse_theme_files):
* src/catalog-web-exporter.h:
Allow a minimum thumbnail size to be specified in the web album
exporter, to handle panoramic images better. Bug #488832.
Patch by Christophe Bisiere, based on Antoine Calando's patch.
Modified:
trunk/ChangeLog
trunk/doc/theme-xml.txt
trunk/libgthumb/pixbuf-utils.c
trunk/libgthumb/pixbuf-utils.h
trunk/src/catalog-web-exporter.c
trunk/src/catalog-web-exporter.h
Modified: trunk/doc/theme-xml.txt
==============================================================================
--- trunk/doc/theme-xml.txt (original)
+++ trunk/doc/theme-xml.txt Fri Aug 1 19:32:58 2008
@@ -72,6 +72,8 @@
thumbnail_height (integer) Output thumbnails of this height
preview_width (integer) Output preview images of this width
preview_height (integer) Output preview images of this height
+ preview_min_width (integer) Output preview images of this minimum width
+ preview_min_height (integer) Output preview images of this minimum height
---
Modified: trunk/libgthumb/pixbuf-utils.c
==============================================================================
--- trunk/libgthumb/pixbuf-utils.c (original)
+++ trunk/libgthumb/pixbuf-utils.c Fri Aug 1 19:32:58 2008
@@ -1237,7 +1237,7 @@
metadata = simple_add_metadata (metadata, "Exif.Image.Orientation", "1");
update_and_save_metadata (local_file, local_file, metadata);
}
-
+
return result;
}
@@ -1312,24 +1312,33 @@
gboolean
-scale_keeping_ratio (int *width,
- int *height,
- int max_width,
- int max_height,
- gboolean allow_upscaling)
+scale_keeping_ratio_min (int *width,
+ int *height,
+ int min_width,
+ int min_height,
+ int max_width,
+ int max_height,
+ gboolean allow_upscaling)
{
double w = *width;
double h = *height;
+ double min_w = min_width;
+ double min_h = min_height;
double max_w = max_width;
double max_h = max_height;
double factor;
int new_width, new_height;
gboolean modified;
- if ((*width < max_width) && (*height < max_height) && !allow_upscaling)
+ if ((*width < max_width) && (*height < max_height)
+ && (!allow_upscaling))
+ return FALSE;
+
+ if (((*width < min_width) || (*height < min_height))
+ && (!allow_upscaling))
return FALSE;
- factor = MIN (max_w / w, max_h / h);
+ factor = MAX ( MIN (max_w / w, max_h / h), MAX (min_w / w, min_h / h) );
new_width = MAX ((int) floor (w * factor + 0.50), 1);
new_height = MAX ((int) floor (h * factor + 0.50), 1);
@@ -1342,6 +1351,23 @@
}
+gboolean
+scale_keeping_ratio (int *width,
+ int *height,
+ int max_width,
+ int max_height,
+ gboolean allow_upscaling)
+{
+ return scale_keeping_ratio_min (width,
+ height,
+ 0,
+ 0,
+ max_width,
+ max_height,
+ allow_upscaling);
+}
+
+
GdkPixbuf*
create_void_pixbuf (int width,
int height)
Modified: trunk/libgthumb/pixbuf-utils.h
==============================================================================
--- trunk/libgthumb/pixbuf-utils.h (original)
+++ trunk/libgthumb/pixbuf-utils.h Fri Aug 1 19:32:58 2008
@@ -58,6 +58,13 @@
char **keys,
char **values,
GError **error);
+gboolean scale_keeping_ratio_min (int *width,
+ int *height,
+ int min_width,
+ int min_height,
+ int max_width,
+ int max_height,
+ gboolean allow_upscaling);
gboolean scale_keeping_ratio (int *width,
int *height,
int max_width,
Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c (original)
+++ trunk/src/catalog-web-exporter.c Fri Aug 1 19:32:58 2008
@@ -433,6 +433,9 @@
ce->resize_max_height = 0;
ce->single_index = FALSE;
+
+ ce->preview_min_width = 0;
+ ce->preview_min_height = 0;
ce->preview_max_width = 0;
ce->preview_max_height = 0;
@@ -634,6 +637,18 @@
void
+catalog_web_exporter_set_preview_min_size (CatalogWebExporter *ce,
+ int width,
+ int height)
+{
+ g_return_if_fail (IS_CATALOG_WEB_EXPORTER (ce));
+
+ ce->preview_min_width = width;
+ ce->preview_min_height = height;
+}
+
+
+void
catalog_web_exporter_set_image_caption (CatalogWebExporter *ce,
GthCaptionFields caption)
{
@@ -806,6 +821,10 @@
return ce->page_cols;
else if (strcmp (var_name, "pages") == 0)
return ce->n_pages;
+ else if (strcmp (var_name, "preview_min_width") == 0)
+ return ce->preview_min_width;
+ else if (strcmp (var_name, "preview_min_height") == 0)
+ return ce->preview_min_height;
else if (strcmp (var_name, "index") == 0)
return GTH_VISIBILITY_INDEX;
else if (strcmp (var_name, "image") == 0)
@@ -2648,10 +2667,12 @@
int w = gdk_pixbuf_get_width (pixbuf);
int h = gdk_pixbuf_get_height (pixbuf);
- if (scale_keeping_ratio (&w, &h,
- ce->preview_max_width,
- ce->preview_max_height,
- FALSE))
+ if (scale_keeping_ratio_min (&w, &h,
+ ce->preview_min_width,
+ ce->preview_min_height,
+ ce->preview_max_width,
+ ce->preview_max_height,
+ FALSE))
{
GdkPixbuf *scaled;
scaled = pixbuf_scale (pixbuf, w, h, GDK_INTERP_BILINEAR);
@@ -2881,6 +2902,15 @@
break;
}
+ width = gth_tag_get_var (ce, tag, "preview_min_width");
+ height = gth_tag_get_var (ce, tag, "preview_min_height");
+
+ if ((width != 0) && (height != 0)) {
+ debug (DEBUG_INFO, "preview min --> %dx%d", width, height);
+ catalog_web_exporter_set_preview_min_size (ce, width, height);
+ break;
+ }
+
break;
default:
Modified: trunk/src/catalog-web-exporter.h
==============================================================================
--- trunk/src/catalog-web-exporter.h (original)
+++ trunk/src/catalog-web-exporter.h Fri Aug 1 19:32:58 2008
@@ -89,6 +89,9 @@
int resize_max_width;
int resize_max_height;
+ int preview_min_width;
+ int preview_min_height;
+
int preview_max_width;
int preview_max_height;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]