app: don't use GimpImageType in gimp_image_new_from_template()

This commit is contained in:
Michael Natterer
2012-04-07 14:22:45 +02:00
parent 3ddfa42c80
commit e250c02bc7

View File

@ -84,11 +84,11 @@ gimp_image_new_from_template (Gimp *gimp,
GimpTemplate *template, GimpTemplate *template,
GimpContext *context) GimpContext *context)
{ {
GimpImage *image; GimpImage *image;
GimpLayer *layer; GimpLayer *layer;
GimpImageType type; gint width, height;
gint width, height; gboolean has_alpha;
const gchar *comment; const gchar *comment;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_TEMPLATE (template), NULL); g_return_val_if_fail (GIMP_IS_TEMPLATE (template), NULL);
@ -124,20 +124,13 @@ gimp_image_new_from_template (Gimp *gimp,
width = gimp_image_get_width (image); width = gimp_image_get_width (image);
height = gimp_image_get_height (image); height = gimp_image_get_height (image);
switch (gimp_template_get_fill_type (template)) if (gimp_template_get_fill_type (template) == GIMP_TRANSPARENT_FILL)
{ has_alpha = TRUE;
case GIMP_TRANSPARENT_FILL: else
type = ((gimp_template_get_image_type (template) == GIMP_RGB) ? has_alpha = FALSE;
GIMP_RGBA_IMAGE : GIMP_GRAYA_IMAGE);
break;
default:
type = ((gimp_template_get_image_type (template) == GIMP_RGB) ?
GIMP_RGB_IMAGE : GIMP_GRAY_IMAGE);
break;
}
layer = gimp_layer_new (image, width, height, layer = gimp_layer_new (image, width, height,
gimp_image_get_format (image, type), gimp_image_get_layer_format (image, has_alpha),
_("Background"), _("Background"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);