mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
app/core/gimptoolinfo.c allow RGB previews and do proper blending for
2002-03-02 Sven Neumann <sven@gimp.org> * app/core/gimptoolinfo.c * app/widgets/gimptoolinfopreview.c: allow RGB previews and do proper blending for RGBA. This is wasted effort since we will change the GimpPreview system anyway, but I couldn't stand the awful look any longer. * app/display/gimpdisplayshell.c * app/gui/file-save-dialog.c: added linebreaks to messages.
This commit is contained in:
parent
fb84125f3f
commit
bf077dd8aa
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2002-03-02 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimptoolinfo.c
|
||||
* app/widgets/gimptoolinfopreview.c: allow RGB previews and do proper
|
||||
blending for RGBA. This is wasted effort since we will change the
|
||||
GimpPreview system anyway, but I couldn't stand the awful look any
|
||||
longer.
|
||||
|
||||
* app/display/gimpdisplayshell.c
|
||||
* app/gui/file-save-dialog.c: added linebreaks to messages.
|
||||
|
||||
2002-03-01 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* themes/Default/images/preferences/Makefile.am
|
||||
|
|
|
@ -167,12 +167,11 @@ temp_buf_new_from_pixbuf (GdkPixbuf *pixbuf,
|
|||
TempBuf *temp_buf;
|
||||
gint pixbuf_width;
|
||||
gint pixbuf_height;
|
||||
gint bytes;
|
||||
guchar transparent[4] = { 0, 0, 0, 0 };
|
||||
guchar *p_data;
|
||||
guchar *t_data;
|
||||
guchar *p;
|
||||
guchar *t;
|
||||
gint x, y;
|
||||
gint y;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
|
||||
|
||||
|
@ -194,26 +193,19 @@ temp_buf_new_from_pixbuf (GdkPixbuf *pixbuf,
|
|||
g_object_ref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
temp_buf = temp_buf_new (width, height, 4, 0, 0, transparent);
|
||||
bytes = gdk_pixbuf_get_n_channels (pixbuf);
|
||||
|
||||
temp_buf = temp_buf_new (width, height, bytes, 0, 0, transparent);
|
||||
|
||||
p_data = gdk_pixbuf_get_pixels (pixbuf);
|
||||
t_data = temp_buf_data (temp_buf);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
p = p_data;
|
||||
t = t_data;
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
*t++ = *p++;
|
||||
*t++ = *p++;
|
||||
*t++ = *p++;
|
||||
*t++ = *p++;
|
||||
}
|
||||
memcpy (t_data, p_data, width * bytes);
|
||||
|
||||
p_data += gdk_pixbuf_get_rowstride (pixbuf);
|
||||
t_data += width * 4;
|
||||
t_data += width * bytes;
|
||||
}
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
|
|
|
@ -420,7 +420,8 @@ file_overwrite (const gchar *filename,
|
|||
overwrite_data->full_filename = g_strdup (filename);
|
||||
overwrite_data->raw_filename = g_strdup (raw_filename);
|
||||
|
||||
overwrite_text = g_strdup_printf (_("%s exists. Overwrite?"), filename);
|
||||
overwrite_text = g_strdup_printf (_("File '%s' exists.\n"
|
||||
"Overwrite it?"), filename);
|
||||
|
||||
query_box = gimp_query_boolean_box (_("File Exists!"),
|
||||
gimp_standard_help_func,
|
||||
|
|
|
@ -2274,8 +2274,8 @@ gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
|
|||
const gchar *image_name)
|
||||
{
|
||||
GtkWidget *mbox;
|
||||
gchar *title_buf;
|
||||
gchar *warning_buf;
|
||||
gchar *title;
|
||||
gchar *warning;
|
||||
|
||||
if (shell->warning_dialog)
|
||||
{
|
||||
|
@ -2283,23 +2283,24 @@ gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
|
|||
return;
|
||||
}
|
||||
|
||||
warning_buf = g_strdup_printf (_("Changes were made to %s.\nClose anyway?"),
|
||||
image_name);
|
||||
title_buf = g_strdup_printf (_("Close %s?"), image_name);
|
||||
title = g_strdup_printf (_("Close %s?"), image_name);
|
||||
|
||||
warning = g_strdup_printf (_("Changes were made to %s.\n"
|
||||
"Close anyway?"), image_name);
|
||||
|
||||
shell->warning_dialog = mbox =
|
||||
gimp_query_boolean_box (title_buf,
|
||||
gimp_query_boolean_box (title,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/really_close.html",
|
||||
FALSE,
|
||||
warning_buf,
|
||||
GTK_STOCK_DIALOG_QUESTION,
|
||||
warning,
|
||||
GTK_STOCK_CLOSE, GTK_STOCK_CANCEL,
|
||||
NULL, NULL,
|
||||
gimp_display_shell_close_warning_callback,
|
||||
shell);
|
||||
|
||||
g_free (title_buf);
|
||||
g_free (warning_buf);
|
||||
g_free (title);
|
||||
g_free (warning);
|
||||
|
||||
gtk_widget_show (mbox);
|
||||
}
|
||||
|
|
|
@ -2274,8 +2274,8 @@ gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
|
|||
const gchar *image_name)
|
||||
{
|
||||
GtkWidget *mbox;
|
||||
gchar *title_buf;
|
||||
gchar *warning_buf;
|
||||
gchar *title;
|
||||
gchar *warning;
|
||||
|
||||
if (shell->warning_dialog)
|
||||
{
|
||||
|
@ -2283,23 +2283,24 @@ gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
|
|||
return;
|
||||
}
|
||||
|
||||
warning_buf = g_strdup_printf (_("Changes were made to %s.\nClose anyway?"),
|
||||
image_name);
|
||||
title_buf = g_strdup_printf (_("Close %s?"), image_name);
|
||||
title = g_strdup_printf (_("Close %s?"), image_name);
|
||||
|
||||
warning = g_strdup_printf (_("Changes were made to %s.\n"
|
||||
"Close anyway?"), image_name);
|
||||
|
||||
shell->warning_dialog = mbox =
|
||||
gimp_query_boolean_box (title_buf,
|
||||
gimp_query_boolean_box (title,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/really_close.html",
|
||||
FALSE,
|
||||
warning_buf,
|
||||
GTK_STOCK_DIALOG_QUESTION,
|
||||
warning,
|
||||
GTK_STOCK_CLOSE, GTK_STOCK_CANCEL,
|
||||
NULL, NULL,
|
||||
gimp_display_shell_close_warning_callback,
|
||||
shell);
|
||||
|
||||
g_free (title_buf);
|
||||
g_free (warning_buf);
|
||||
g_free (title);
|
||||
g_free (warning);
|
||||
|
||||
gtk_widget_show (mbox);
|
||||
}
|
||||
|
|
|
@ -420,7 +420,8 @@ file_overwrite (const gchar *filename,
|
|||
overwrite_data->full_filename = g_strdup (filename);
|
||||
overwrite_data->raw_filename = g_strdup (raw_filename);
|
||||
|
||||
overwrite_text = g_strdup_printf (_("%s exists. Overwrite?"), filename);
|
||||
overwrite_text = g_strdup_printf (_("File '%s' exists.\n"
|
||||
"Overwrite it?"), filename);
|
||||
|
||||
query_box = gimp_query_boolean_box (_("File Exists!"),
|
||||
gimp_standard_help_func,
|
||||
|
|
|
@ -115,14 +115,10 @@ gimp_tool_info_preview_render (GimpPreview *preview)
|
|||
GimpToolInfo *tool_info;
|
||||
TempBuf *temp_buf;
|
||||
TempBuf *render_buf;
|
||||
guchar color[3];
|
||||
gint width;
|
||||
gint height;
|
||||
gint tool_info_width;
|
||||
gint tool_info_height;
|
||||
gint x, y;
|
||||
guchar *src;
|
||||
guchar *dest;
|
||||
gboolean new_buf = FALSE;
|
||||
|
||||
widget = GTK_WIDGET (preview);
|
||||
|
@ -147,43 +143,70 @@ gimp_tool_info_preview_render (GimpPreview *preview)
|
|||
new_buf = TRUE;
|
||||
}
|
||||
|
||||
color[0] = widget->style->bg[widget->state].red >> 8;
|
||||
color[1] = widget->style->bg[widget->state].green >> 8;
|
||||
color[2] = widget->style->bg[widget->state].blue >> 8;
|
||||
|
||||
render_buf = temp_buf_new (width, height, 3, 0, 0, color);
|
||||
|
||||
src = temp_buf_data (temp_buf);
|
||||
dest = temp_buf_data (render_buf);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
switch (temp_buf->bytes)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
if (src[3] != 0)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
*dest++ = *src++;
|
||||
*dest++ = *src++;
|
||||
case 3:
|
||||
render_buf = temp_buf;
|
||||
break;
|
||||
|
||||
src++;
|
||||
}
|
||||
else
|
||||
{
|
||||
src += 4;
|
||||
dest += 3;
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
gint x, y;
|
||||
guchar *src;
|
||||
guchar *dest;
|
||||
guchar color[3];
|
||||
|
||||
color[0] = widget->style->bg[widget->state].red >> 8;
|
||||
color[1] = widget->style->bg[widget->state].green >> 8;
|
||||
color[2] = widget->style->bg[widget->state].blue >> 8;
|
||||
|
||||
render_buf = temp_buf_new (width, height, 3, 0, 0, color);
|
||||
|
||||
src = temp_buf_data (temp_buf);
|
||||
dest = temp_buf_data (render_buf);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
switch (src[3])
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 255:
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
break;
|
||||
default:
|
||||
{
|
||||
guint16 t = 255 - src[3];
|
||||
dest[0] = (src[0] * src[3] + dest[0] * t) >> 8;
|
||||
dest[1] = (src[1] * src[3] + dest[1] * t) >> 8;
|
||||
dest[2] = (src[2] * src[3] + dest[2] * t) >> 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
src += 4;
|
||||
dest += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
render_buf = 0;
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (new_buf)
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
gimp_preview_render_and_flush (preview,
|
||||
render_buf,
|
||||
-1);
|
||||
|
||||
gimp_preview_render_and_flush (preview, render_buf, -1);
|
||||
|
||||
temp_buf_free (render_buf);
|
||||
|
||||
if (new_buf && temp_buf->bytes != 3)
|
||||
temp_buf_free (temp_buf);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
|
Loading…
Reference in a new issue