diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2015-01-04 23:01:42 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2015-01-04 23:01:42 +0100 |
| commit | 248a9af6ad668b6f09f79dda548721756fe11d79 (patch) | |
| tree | 6ace053a06d55935e6ff2ba1bf571ab5d6fa7c61 /src/setup.c | |
| parent | cd4658f7154fbfa58c09c101b9753ef85a62620d (diff) | |
| download | cataract-248a9af6ad668b6f09f79dda548721756fe11d79.tar.xz | |
Introduce new "fixed" thumbnail crop mode
This mode retains given aspect ratio and crops the area from inside of the
source image.
Diffstat (limited to 'src/setup.c')
| -rw-r--r-- | src/setup.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/setup.c b/src/setup.c index d945021..5cfc255 100644 --- a/src/setup.c +++ b/src/setup.c @@ -193,10 +193,14 @@ parse_design_setup_xml (const gchar *filename) if (s2 && g_ascii_strcasecmp (s2, "thumbnail") == 0) image_size->is_thumbnail = TRUE; g_free (s2); + image_size->thumb_crop_style = CROP_STYLE_NORMAL; if (image_size->is_thumbnail) { s2 = xml_file_get_node_attribute (xml, s, "style"); if (s2 && g_ascii_strcasecmp (s2, "squared") == 0) - image_size->squared_thumb = TRUE; + image_size->thumb_crop_style = CROP_STYLE_SQUARED; + else + if (s2 && g_ascii_strcasecmp (s2, "fixed") == 0) + image_size->thumb_crop_style = CROP_STYLE_FIXED; g_free (s2); } g_free (s); @@ -219,6 +223,11 @@ parse_design_setup_xml (const gchar *filename) image_size->square_size = xml_file_get_node_attribute_long_with_default (xml, s, "size", 0); g_free (s); + s = g_strdup_printf ("/design_setup/image_sizes/size[%d]/crop", i + 1); + image_size->crop_width = xml_file_get_node_attribute_long_with_default (xml, s, "w", 0); + image_size->crop_height = xml_file_get_node_attribute_long_with_default (xml, s, "h", 0); + g_free (s); + s = g_strdup_printf ("/design_setup/image_sizes/size[%d]/quality", i + 1); image_size->quality = xml_file_get_node_attribute_long_with_default (xml, s, "value", -1); g_free (s); @@ -347,7 +356,7 @@ makeup_legacy_design (const gchar *filename) image_size->quality = xml_file_get_node_attribute_long_with_default (xml, s, "quality", -1); image_size->no_resize = (i != 0); image_size->is_thumbnail = (i == 0); - image_size->squared_thumb = (i == 0) && squared_thumbs; + image_size->thumb_crop_style = ((i == 0) && squared_thumbs) ? CROP_STYLE_SQUARED : CROP_STYLE_NORMAL; g_free (s); design->image_sizes = g_list_append (design->image_sizes, image_size); } |
