mirror of https://github.com/GNOME/gimp.git
made the default buffer and stock rendering functions public so derived
2003-03-03 Michael Natterer <mitch@gimp.org> * app/widgets/gimppreviewrenderer.[ch]: made the default buffer and stock rendering functions public so derived renderers can use them. Renamed gimp_preview_renderer_render_preview() to gimp_preview_renderer_render_buffer(). * app/widgets/gimppreviewrendererbrush.c * app/widgets/gimppreviewrendererdrawable.c * app/widgets/gimppreviewrendererimage.c: changed accordingly. * app/widgets/gimppreviewrenderertextlayer.[ch]: new renderer for text layers which always renders the stock icon. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimppreviewrenderer-utils.c: changed accordingly.
This commit is contained in:
parent
3fab2a942a
commit
6bfa4f54a0
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2003-03-03 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimppreviewrenderer.[ch]: made the default buffer
|
||||
and stock rendering functions public so derived renderers
|
||||
can use them. Renamed gimp_preview_renderer_render_preview()
|
||||
to gimp_preview_renderer_render_buffer().
|
||||
|
||||
* app/widgets/gimppreviewrendererbrush.c
|
||||
* app/widgets/gimppreviewrendererdrawable.c
|
||||
* app/widgets/gimppreviewrendererimage.c: changed accordingly.
|
||||
|
||||
* app/widgets/gimppreviewrenderertextlayer.[ch]: new renderer
|
||||
for text layers which always renders the stock icon.
|
||||
|
||||
* app/widgets/Makefile.am
|
||||
* app/widgets/widgets-types.h
|
||||
* app/widgets/gimppreviewrenderer-utils.c: changed accordingly.
|
||||
|
||||
2003-03-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/edge.c (edge): fixed a typo in the kernel for
|
||||
|
|
|
@ -137,6 +137,8 @@ libappwidgets_a_sources = \
|
|||
gimppreviewrendererdrawable.h \
|
||||
gimppreviewrendererimage.c \
|
||||
gimppreviewrendererimage.h \
|
||||
gimppreviewrenderertextlayer.c \
|
||||
gimppreviewrenderertextlayer.h \
|
||||
gimppropwidgets.c \
|
||||
gimppropwidgets.h \
|
||||
gimpselectioneditor.c \
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "text/gimptextlayer.h"
|
||||
|
||||
#include "gimppreviewrendererbrush.h"
|
||||
#include "gimppreviewrendererdrawable.h"
|
||||
#include "gimppreviewrenderertextlayer.h"
|
||||
#include "gimppreviewrendererimage.h"
|
||||
|
||||
|
||||
|
@ -50,6 +52,10 @@ gimp_preview_renderer_type_from_viewable_type (GType viewable_type)
|
|||
{
|
||||
type = GIMP_TYPE_PREVIEW_RENDERER_IMAGE;
|
||||
}
|
||||
else if (g_type_is_a (viewable_type, GIMP_TYPE_TEXT_LAYER))
|
||||
{
|
||||
type = GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER;
|
||||
}
|
||||
else if (g_type_is_a (viewable_type, GIMP_TYPE_DRAWABLE))
|
||||
{
|
||||
type = GIMP_TYPE_PREVIEW_RENDERER_DRAWABLE;
|
||||
|
|
|
@ -618,112 +618,21 @@ gimp_preview_renderer_real_render (GimpPreviewRenderer *renderer,
|
|||
{
|
||||
TempBuf *temp_buf;
|
||||
|
||||
if (renderer->no_preview_pixbuf)
|
||||
{
|
||||
g_object_unref (renderer->no_preview_pixbuf);
|
||||
renderer->no_preview_pixbuf = NULL;
|
||||
}
|
||||
|
||||
temp_buf = gimp_viewable_get_preview (renderer->viewable,
|
||||
renderer->width,
|
||||
renderer->height);
|
||||
|
||||
if (temp_buf)
|
||||
{
|
||||
if (temp_buf->width < renderer->width)
|
||||
temp_buf->x = (renderer->width - temp_buf->width) / 2;
|
||||
|
||||
if (temp_buf->height < renderer->height)
|
||||
temp_buf->y = (renderer->height - temp_buf->height) / 2;
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_default_render_buffer (renderer, widget, temp_buf);
|
||||
}
|
||||
else /* no preview available */
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconSet *icon_set;
|
||||
GtkIconSize *sizes;
|
||||
gint n_sizes;
|
||||
gint i;
|
||||
gint width_diff = 1024;
|
||||
gint height_diff = 1024;
|
||||
GtkIconSize icon_size = GTK_ICON_SIZE_MENU;
|
||||
const gchar *stock_id;
|
||||
|
||||
if (renderer->buffer)
|
||||
{
|
||||
g_free (renderer->buffer);
|
||||
renderer->buffer = NULL;
|
||||
}
|
||||
|
||||
stock_id = gimp_viewable_get_stock_id (renderer->viewable);
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, stock_id);
|
||||
|
||||
gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
|
||||
|
||||
for (i = 0; i < n_sizes; i++)
|
||||
{
|
||||
gint icon_width;
|
||||
gint icon_height;
|
||||
|
||||
if (gtk_icon_size_lookup (sizes[i], &icon_width, &icon_height))
|
||||
{
|
||||
if (icon_width <= renderer->width &&
|
||||
icon_height <= renderer->height &&
|
||||
(ABS (icon_width - renderer->width) < width_diff ||
|
||||
ABS (icon_height - renderer->height) < height_diff))
|
||||
{
|
||||
width_diff = ABS (icon_width - renderer->width);
|
||||
height_diff = ABS (icon_height - renderer->height);
|
||||
|
||||
icon_size = sizes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (sizes);
|
||||
|
||||
pixbuf = gtk_icon_set_render_icon (icon_set,
|
||||
widget->style,
|
||||
gtk_widget_get_direction (widget),
|
||||
widget->state,
|
||||
icon_size,
|
||||
widget, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
if (gdk_pixbuf_get_width (pixbuf) > renderer->width ||
|
||||
gdk_pixbuf_get_height (pixbuf) > renderer->height)
|
||||
{
|
||||
GdkPixbuf *scaled_pixbuf;
|
||||
gint pixbuf_width;
|
||||
gint pixbuf_height;
|
||||
|
||||
gimp_viewable_calc_preview_size (renderer->viewable,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
TRUE, 1.0, 1.0,
|
||||
&pixbuf_width,
|
||||
&pixbuf_height,
|
||||
NULL);
|
||||
|
||||
scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
|
||||
pixbuf_width,
|
||||
pixbuf_height,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled_pixbuf;
|
||||
}
|
||||
|
||||
renderer->no_preview_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
gimp_preview_renderer_default_render_stock (renderer, widget, stock_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,6 +650,152 @@ gimp_preview_renderer_size_changed (GimpPreviewRenderer *renderer,
|
|||
|
||||
/* protected functions */
|
||||
|
||||
void
|
||||
gimp_preview_renderer_default_render_buffer (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
TempBuf *temp_buf)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER (renderer));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (temp_buf != NULL);
|
||||
|
||||
if (renderer->no_preview_pixbuf)
|
||||
{
|
||||
g_object_unref (renderer->no_preview_pixbuf);
|
||||
renderer->no_preview_pixbuf = NULL;
|
||||
}
|
||||
|
||||
if (temp_buf->width < renderer->width)
|
||||
temp_buf->x = (renderer->width - temp_buf->width) / 2;
|
||||
|
||||
if (temp_buf->height < renderer->height)
|
||||
temp_buf->y = (renderer->height - temp_buf->height) / 2;
|
||||
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_default_render_stock (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconSet *icon_set;
|
||||
GtkIconSize *sizes;
|
||||
gint n_sizes;
|
||||
gint i;
|
||||
gint width_diff = 1024;
|
||||
gint height_diff = 1024;
|
||||
GtkIconSize icon_size = GTK_ICON_SIZE_MENU;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER (renderer));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (stock_id != NULL);
|
||||
|
||||
if (renderer->no_preview_pixbuf)
|
||||
{
|
||||
g_object_unref (renderer->no_preview_pixbuf);
|
||||
renderer->no_preview_pixbuf = NULL;
|
||||
}
|
||||
|
||||
if (renderer->buffer)
|
||||
{
|
||||
g_free (renderer->buffer);
|
||||
renderer->buffer = NULL;
|
||||
}
|
||||
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, stock_id);
|
||||
|
||||
gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
|
||||
|
||||
for (i = 0; i < n_sizes; i++)
|
||||
{
|
||||
gint icon_width;
|
||||
gint icon_height;
|
||||
|
||||
if (gtk_icon_size_lookup (sizes[i], &icon_width, &icon_height))
|
||||
{
|
||||
if (icon_width <= renderer->width &&
|
||||
icon_height <= renderer->height &&
|
||||
(ABS (icon_width - renderer->width) < width_diff ||
|
||||
ABS (icon_height - renderer->height) < height_diff))
|
||||
{
|
||||
width_diff = ABS (icon_width - renderer->width);
|
||||
height_diff = ABS (icon_height - renderer->height);
|
||||
|
||||
icon_size = sizes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (sizes);
|
||||
|
||||
pixbuf = gtk_icon_set_render_icon (icon_set,
|
||||
widget->style,
|
||||
gtk_widget_get_direction (widget),
|
||||
widget->state,
|
||||
icon_size,
|
||||
widget, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
if (gdk_pixbuf_get_width (pixbuf) > renderer->width ||
|
||||
gdk_pixbuf_get_height (pixbuf) > renderer->height)
|
||||
{
|
||||
GdkPixbuf *scaled_pixbuf;
|
||||
gint pixbuf_width;
|
||||
gint pixbuf_height;
|
||||
|
||||
gimp_viewable_calc_preview_size (renderer->viewable,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
TRUE, 1.0, 1.0,
|
||||
&pixbuf_width,
|
||||
&pixbuf_height,
|
||||
NULL);
|
||||
|
||||
scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
|
||||
pixbuf_width,
|
||||
pixbuf_height,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled_pixbuf;
|
||||
}
|
||||
|
||||
renderer->no_preview_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_render_buffer (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg)
|
||||
{
|
||||
if (! renderer->buffer)
|
||||
renderer->buffer = g_new0 (guchar, renderer->height * renderer->rowstride);
|
||||
|
||||
gimp_preview_render_to_buffer (temp_buf,
|
||||
channel,
|
||||
inside_bg,
|
||||
outside_bg,
|
||||
renderer->buffer,
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
renderer->rowstride,
|
||||
renderer->bytes);
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
||||
gint channel,
|
||||
|
@ -919,26 +974,3 @@ gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
|||
dest_width * dest_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_render_preview (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg)
|
||||
{
|
||||
if (! renderer->buffer)
|
||||
renderer->buffer = g_new0 (guchar, renderer->height * renderer->rowstride);
|
||||
|
||||
gimp_preview_render_to_buffer (temp_buf,
|
||||
channel,
|
||||
inside_bg,
|
||||
outside_bg,
|
||||
renderer->buffer,
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
renderer->rowstride,
|
||||
renderer->bytes);
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,21 @@ void gimp_preview_renderer_draw (GimpPreviewRenderer *renderer,
|
|||
|
||||
/* protected */
|
||||
|
||||
void gimp_preview_renderer_default_render_buffer (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
TempBuf *temp_buf);
|
||||
void gimp_preview_renderer_default_render_stock (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
const gchar *stock_id);
|
||||
void gimp_preview_renderer_render_buffer (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg);
|
||||
|
||||
|
||||
/* general purpose temp_buf to buffer projection function */
|
||||
|
||||
void gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
|
@ -126,11 +141,5 @@ void gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
|||
gint dest_rowstride,
|
||||
gint dest_bytes);
|
||||
|
||||
void gimp_preview_renderer_render_preview (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg);
|
||||
|
||||
|
||||
#endif /* __GIMP_PREVIEW_RENDERER_H__ */
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
static void gimp_preview_renderer_brush_class_init (GimpPreviewRendererBrushClass *klass);
|
||||
static void gimp_preview_renderer_brush_init (GimpPreviewRendererBrush *preview);
|
||||
static void gimp_preview_renderer_brush_init (GimpPreviewRendererBrush *renderer);
|
||||
|
||||
static void gimp_preview_renderer_brush_finalize (GObject *object);
|
||||
static void gimp_preview_renderer_brush_render (GimpPreviewRenderer *renderer,
|
||||
|
@ -147,9 +147,9 @@ gimp_preview_renderer_brush_render (GimpPreviewRenderer *renderer,
|
|||
|
||||
if (renderer->is_popup)
|
||||
{
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
|
@ -174,9 +174,9 @@ gimp_preview_renderer_brush_render (GimpPreviewRenderer *renderer,
|
|||
return;
|
||||
}
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
|
@ -324,9 +324,9 @@ gimp_preview_renderer_brush_render_timeout (gpointer data)
|
|||
renderer->width,
|
||||
renderer->height);
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdrawablepreview.c
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimppreviewrendererdrawable.c
|
||||
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
|
||||
static void gimp_preview_renderer_drawable_class_init (GimpPreviewRendererDrawableClass *klass);
|
||||
static void gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *preview);
|
||||
static void gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *renderer);
|
||||
|
||||
static void gimp_preview_renderer_drawable_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget);
|
||||
|
@ -86,7 +86,7 @@ gimp_preview_renderer_drawable_class_init (GimpPreviewRendererDrawableClass *kla
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *preview)
|
||||
gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *renderer)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -182,9 +182,9 @@ gimp_preview_renderer_drawable_render (GimpPreviewRenderer *renderer,
|
|||
render_buf->y = (height - preview_height) / 2;
|
||||
}
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, render_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_CHECKS);
|
||||
gimp_preview_renderer_render_buffer (renderer, render_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_CHECKS);
|
||||
|
||||
temp_buf_free (render_buf);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
static void gimp_preview_renderer_image_class_init (GimpPreviewRendererImageClass *klass);
|
||||
static void gimp_preview_renderer_image_init (GimpPreviewRendererImage *preview);
|
||||
static void gimp_preview_renderer_image_init (GimpPreviewRendererImage *renderer);
|
||||
|
||||
static void gimp_preview_renderer_image_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget);
|
||||
|
@ -147,10 +147,10 @@ gimp_preview_renderer_image_render (GimpPreviewRenderer *renderer,
|
|||
if (preview_height < renderer->height)
|
||||
render_buf->y = (renderer->height - preview_height) / 2;
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, render_buf,
|
||||
GIMP_PREVIEW_RENDERER_IMAGE (renderer)->channel,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, render_buf,
|
||||
GIMP_PREVIEW_RENDERER_IMAGE (renderer)->channel,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (render_buf);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimppreviewrenderertextlayer.c
|
||||
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimpviewable.h"
|
||||
|
||||
#include "gimppreviewrenderertextlayer.h"
|
||||
|
||||
|
||||
static void gimp_preview_renderer_text_layer_class_init (GimpPreviewRendererTextLayerClass *klass);
|
||||
static void gimp_preview_renderer_text_layer_init (GimpPreviewRendererTextLayer *renderer);
|
||||
|
||||
static void gimp_preview_renderer_text_layer_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget);
|
||||
|
||||
|
||||
static GimpPreviewRendererDrawableClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_preview_renderer_text_layer_get_type (void)
|
||||
{
|
||||
static GType renderer_type = 0;
|
||||
|
||||
if (! renderer_type)
|
||||
{
|
||||
static const GTypeInfo renderer_info =
|
||||
{
|
||||
sizeof (GimpPreviewRendererTextLayerClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_preview_renderer_text_layer_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpPreviewRendererTextLayer),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_preview_renderer_text_layer_init,
|
||||
};
|
||||
|
||||
renderer_type = g_type_register_static (GIMP_TYPE_PREVIEW_RENDERER_DRAWABLE,
|
||||
"GimpPreviewRendererTextLayer",
|
||||
&renderer_info, 0);
|
||||
}
|
||||
|
||||
return renderer_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_renderer_text_layer_class_init (GimpPreviewRendererTextLayerClass *klass)
|
||||
{
|
||||
GimpPreviewRendererClass *renderer_class;
|
||||
|
||||
renderer_class = GIMP_PREVIEW_RENDERER_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
renderer_class->render = gimp_preview_renderer_text_layer_render;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_renderer_text_layer_init (GimpPreviewRendererTextLayer *renderer)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_renderer_text_layer_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
const gchar *stock_id;
|
||||
|
||||
stock_id = gimp_viewable_get_stock_id (renderer->viewable);
|
||||
|
||||
gimp_preview_renderer_default_render_stock (renderer, widget, stock_id);
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimppreviewrenderertextlayer.h
|
||||
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PREVIEW_RENDERER_TEXT_LAYER_H__
|
||||
#define __GIMP_PREVIEW_RENDERER_TEXT_LAYER_H__
|
||||
|
||||
#include "gimppreviewrendererdrawable.h"
|
||||
|
||||
#define GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER (gimp_preview_renderer_text_layer_get_type ())
|
||||
#define GIMP_PREVIEW_RENDERER_TEXT_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER, GimpPreviewRendererTextLayer))
|
||||
#define GIMP_PREVIEW_RENDERER_TEXT_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER, GimpPreviewRendererTextLayerClass))
|
||||
#define GIMP_IS_PREVIEW_RENDERER_TEXT_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER))
|
||||
#define GIMP_IS_PREVIEW_RENDERER_TEXT_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER))
|
||||
#define GIMP_PREVIEW_RENDERER_TEXT_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER, GimpPreviewRendererTextLayerClass))
|
||||
|
||||
|
||||
typedef struct _GimpPreviewRendererTextLayerClass GimpPreviewRendererTextLayerClass;
|
||||
|
||||
struct _GimpPreviewRendererTextLayer
|
||||
{
|
||||
GimpPreviewRendererDrawable parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpPreviewRendererTextLayerClass
|
||||
{
|
||||
GimpPreviewRendererDrawableClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_preview_renderer_text_layer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_PREVIEW_RENDERER_TEXT_LAYER_H__ */
|
|
@ -28,9 +28,11 @@
|
|||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "text/gimptextlayer.h"
|
||||
|
||||
#include "gimppreviewrendererbrush.h"
|
||||
#include "gimppreviewrendererdrawable.h"
|
||||
#include "gimppreviewrenderertextlayer.h"
|
||||
#include "gimppreviewrendererimage.h"
|
||||
|
||||
|
||||
|
@ -50,6 +52,10 @@ gimp_preview_renderer_type_from_viewable_type (GType viewable_type)
|
|||
{
|
||||
type = GIMP_TYPE_PREVIEW_RENDERER_IMAGE;
|
||||
}
|
||||
else if (g_type_is_a (viewable_type, GIMP_TYPE_TEXT_LAYER))
|
||||
{
|
||||
type = GIMP_TYPE_PREVIEW_RENDERER_TEXT_LAYER;
|
||||
}
|
||||
else if (g_type_is_a (viewable_type, GIMP_TYPE_DRAWABLE))
|
||||
{
|
||||
type = GIMP_TYPE_PREVIEW_RENDERER_DRAWABLE;
|
||||
|
|
|
@ -618,112 +618,21 @@ gimp_preview_renderer_real_render (GimpPreviewRenderer *renderer,
|
|||
{
|
||||
TempBuf *temp_buf;
|
||||
|
||||
if (renderer->no_preview_pixbuf)
|
||||
{
|
||||
g_object_unref (renderer->no_preview_pixbuf);
|
||||
renderer->no_preview_pixbuf = NULL;
|
||||
}
|
||||
|
||||
temp_buf = gimp_viewable_get_preview (renderer->viewable,
|
||||
renderer->width,
|
||||
renderer->height);
|
||||
|
||||
if (temp_buf)
|
||||
{
|
||||
if (temp_buf->width < renderer->width)
|
||||
temp_buf->x = (renderer->width - temp_buf->width) / 2;
|
||||
|
||||
if (temp_buf->height < renderer->height)
|
||||
temp_buf->y = (renderer->height - temp_buf->height) / 2;
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_default_render_buffer (renderer, widget, temp_buf);
|
||||
}
|
||||
else /* no preview available */
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconSet *icon_set;
|
||||
GtkIconSize *sizes;
|
||||
gint n_sizes;
|
||||
gint i;
|
||||
gint width_diff = 1024;
|
||||
gint height_diff = 1024;
|
||||
GtkIconSize icon_size = GTK_ICON_SIZE_MENU;
|
||||
const gchar *stock_id;
|
||||
|
||||
if (renderer->buffer)
|
||||
{
|
||||
g_free (renderer->buffer);
|
||||
renderer->buffer = NULL;
|
||||
}
|
||||
|
||||
stock_id = gimp_viewable_get_stock_id (renderer->viewable);
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, stock_id);
|
||||
|
||||
gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
|
||||
|
||||
for (i = 0; i < n_sizes; i++)
|
||||
{
|
||||
gint icon_width;
|
||||
gint icon_height;
|
||||
|
||||
if (gtk_icon_size_lookup (sizes[i], &icon_width, &icon_height))
|
||||
{
|
||||
if (icon_width <= renderer->width &&
|
||||
icon_height <= renderer->height &&
|
||||
(ABS (icon_width - renderer->width) < width_diff ||
|
||||
ABS (icon_height - renderer->height) < height_diff))
|
||||
{
|
||||
width_diff = ABS (icon_width - renderer->width);
|
||||
height_diff = ABS (icon_height - renderer->height);
|
||||
|
||||
icon_size = sizes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (sizes);
|
||||
|
||||
pixbuf = gtk_icon_set_render_icon (icon_set,
|
||||
widget->style,
|
||||
gtk_widget_get_direction (widget),
|
||||
widget->state,
|
||||
icon_size,
|
||||
widget, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
if (gdk_pixbuf_get_width (pixbuf) > renderer->width ||
|
||||
gdk_pixbuf_get_height (pixbuf) > renderer->height)
|
||||
{
|
||||
GdkPixbuf *scaled_pixbuf;
|
||||
gint pixbuf_width;
|
||||
gint pixbuf_height;
|
||||
|
||||
gimp_viewable_calc_preview_size (renderer->viewable,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
TRUE, 1.0, 1.0,
|
||||
&pixbuf_width,
|
||||
&pixbuf_height,
|
||||
NULL);
|
||||
|
||||
scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
|
||||
pixbuf_width,
|
||||
pixbuf_height,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled_pixbuf;
|
||||
}
|
||||
|
||||
renderer->no_preview_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
gimp_preview_renderer_default_render_stock (renderer, widget, stock_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,6 +650,152 @@ gimp_preview_renderer_size_changed (GimpPreviewRenderer *renderer,
|
|||
|
||||
/* protected functions */
|
||||
|
||||
void
|
||||
gimp_preview_renderer_default_render_buffer (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
TempBuf *temp_buf)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER (renderer));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (temp_buf != NULL);
|
||||
|
||||
if (renderer->no_preview_pixbuf)
|
||||
{
|
||||
g_object_unref (renderer->no_preview_pixbuf);
|
||||
renderer->no_preview_pixbuf = NULL;
|
||||
}
|
||||
|
||||
if (temp_buf->width < renderer->width)
|
||||
temp_buf->x = (renderer->width - temp_buf->width) / 2;
|
||||
|
||||
if (temp_buf->height < renderer->height)
|
||||
temp_buf->y = (renderer->height - temp_buf->height) / 2;
|
||||
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_default_render_stock (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconSet *icon_set;
|
||||
GtkIconSize *sizes;
|
||||
gint n_sizes;
|
||||
gint i;
|
||||
gint width_diff = 1024;
|
||||
gint height_diff = 1024;
|
||||
GtkIconSize icon_size = GTK_ICON_SIZE_MENU;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER (renderer));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (stock_id != NULL);
|
||||
|
||||
if (renderer->no_preview_pixbuf)
|
||||
{
|
||||
g_object_unref (renderer->no_preview_pixbuf);
|
||||
renderer->no_preview_pixbuf = NULL;
|
||||
}
|
||||
|
||||
if (renderer->buffer)
|
||||
{
|
||||
g_free (renderer->buffer);
|
||||
renderer->buffer = NULL;
|
||||
}
|
||||
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, stock_id);
|
||||
|
||||
gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
|
||||
|
||||
for (i = 0; i < n_sizes; i++)
|
||||
{
|
||||
gint icon_width;
|
||||
gint icon_height;
|
||||
|
||||
if (gtk_icon_size_lookup (sizes[i], &icon_width, &icon_height))
|
||||
{
|
||||
if (icon_width <= renderer->width &&
|
||||
icon_height <= renderer->height &&
|
||||
(ABS (icon_width - renderer->width) < width_diff ||
|
||||
ABS (icon_height - renderer->height) < height_diff))
|
||||
{
|
||||
width_diff = ABS (icon_width - renderer->width);
|
||||
height_diff = ABS (icon_height - renderer->height);
|
||||
|
||||
icon_size = sizes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (sizes);
|
||||
|
||||
pixbuf = gtk_icon_set_render_icon (icon_set,
|
||||
widget->style,
|
||||
gtk_widget_get_direction (widget),
|
||||
widget->state,
|
||||
icon_size,
|
||||
widget, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
if (gdk_pixbuf_get_width (pixbuf) > renderer->width ||
|
||||
gdk_pixbuf_get_height (pixbuf) > renderer->height)
|
||||
{
|
||||
GdkPixbuf *scaled_pixbuf;
|
||||
gint pixbuf_width;
|
||||
gint pixbuf_height;
|
||||
|
||||
gimp_viewable_calc_preview_size (renderer->viewable,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
TRUE, 1.0, 1.0,
|
||||
&pixbuf_width,
|
||||
&pixbuf_height,
|
||||
NULL);
|
||||
|
||||
scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
|
||||
pixbuf_width,
|
||||
pixbuf_height,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled_pixbuf;
|
||||
}
|
||||
|
||||
renderer->no_preview_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_render_buffer (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg)
|
||||
{
|
||||
if (! renderer->buffer)
|
||||
renderer->buffer = g_new0 (guchar, renderer->height * renderer->rowstride);
|
||||
|
||||
gimp_preview_render_to_buffer (temp_buf,
|
||||
channel,
|
||||
inside_bg,
|
||||
outside_bg,
|
||||
renderer->buffer,
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
renderer->rowstride,
|
||||
renderer->bytes);
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
||||
gint channel,
|
||||
|
@ -919,26 +974,3 @@ gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
|||
dest_width * dest_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_render_preview (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg)
|
||||
{
|
||||
if (! renderer->buffer)
|
||||
renderer->buffer = g_new0 (guchar, renderer->height * renderer->rowstride);
|
||||
|
||||
gimp_preview_render_to_buffer (temp_buf,
|
||||
channel,
|
||||
inside_bg,
|
||||
outside_bg,
|
||||
renderer->buffer,
|
||||
renderer->width,
|
||||
renderer->height,
|
||||
renderer->rowstride,
|
||||
renderer->bytes);
|
||||
|
||||
renderer->needs_render = FALSE;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,21 @@ void gimp_preview_renderer_draw (GimpPreviewRenderer *renderer,
|
|||
|
||||
/* protected */
|
||||
|
||||
void gimp_preview_renderer_default_render_buffer (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
TempBuf *temp_buf);
|
||||
void gimp_preview_renderer_default_render_stock (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget,
|
||||
const gchar *stock_id);
|
||||
void gimp_preview_renderer_render_buffer (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg);
|
||||
|
||||
|
||||
/* general purpose temp_buf to buffer projection function */
|
||||
|
||||
void gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
|
@ -126,11 +141,5 @@ void gimp_preview_render_to_buffer (TempBuf *temp_buf,
|
|||
gint dest_rowstride,
|
||||
gint dest_bytes);
|
||||
|
||||
void gimp_preview_renderer_render_preview (GimpPreviewRenderer *renderer,
|
||||
TempBuf *temp_buf,
|
||||
gint channel,
|
||||
GimpPreviewBG inside_bg,
|
||||
GimpPreviewBG outside_bg);
|
||||
|
||||
|
||||
#endif /* __GIMP_PREVIEW_RENDERER_H__ */
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
static void gimp_preview_renderer_brush_class_init (GimpPreviewRendererBrushClass *klass);
|
||||
static void gimp_preview_renderer_brush_init (GimpPreviewRendererBrush *preview);
|
||||
static void gimp_preview_renderer_brush_init (GimpPreviewRendererBrush *renderer);
|
||||
|
||||
static void gimp_preview_renderer_brush_finalize (GObject *object);
|
||||
static void gimp_preview_renderer_brush_render (GimpPreviewRenderer *renderer,
|
||||
|
@ -147,9 +147,9 @@ gimp_preview_renderer_brush_render (GimpPreviewRenderer *renderer,
|
|||
|
||||
if (renderer->is_popup)
|
||||
{
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
|
@ -174,9 +174,9 @@ gimp_preview_renderer_brush_render (GimpPreviewRenderer *renderer,
|
|||
return;
|
||||
}
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
|
@ -324,9 +324,9 @@ gimp_preview_renderer_brush_render_timeout (gpointer data)
|
|||
renderer->width,
|
||||
renderer->height);
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, temp_buf, -1,
|
||||
GIMP_PREVIEW_BG_WHITE,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdrawablepreview.c
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimppreviewrendererdrawable.c
|
||||
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
|
||||
static void gimp_preview_renderer_drawable_class_init (GimpPreviewRendererDrawableClass *klass);
|
||||
static void gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *preview);
|
||||
static void gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *renderer);
|
||||
|
||||
static void gimp_preview_renderer_drawable_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget);
|
||||
|
@ -86,7 +86,7 @@ gimp_preview_renderer_drawable_class_init (GimpPreviewRendererDrawableClass *kla
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *preview)
|
||||
gimp_preview_renderer_drawable_init (GimpPreviewRendererDrawable *renderer)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -182,9 +182,9 @@ gimp_preview_renderer_drawable_render (GimpPreviewRenderer *renderer,
|
|||
render_buf->y = (height - preview_height) / 2;
|
||||
}
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, render_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_CHECKS);
|
||||
gimp_preview_renderer_render_buffer (renderer, render_buf, -1,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_CHECKS);
|
||||
|
||||
temp_buf_free (render_buf);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
static void gimp_preview_renderer_image_class_init (GimpPreviewRendererImageClass *klass);
|
||||
static void gimp_preview_renderer_image_init (GimpPreviewRendererImage *preview);
|
||||
static void gimp_preview_renderer_image_init (GimpPreviewRendererImage *renderer);
|
||||
|
||||
static void gimp_preview_renderer_image_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget);
|
||||
|
@ -147,10 +147,10 @@ gimp_preview_renderer_image_render (GimpPreviewRenderer *renderer,
|
|||
if (preview_height < renderer->height)
|
||||
render_buf->y = (renderer->height - preview_height) / 2;
|
||||
|
||||
gimp_preview_renderer_render_preview (renderer, render_buf,
|
||||
GIMP_PREVIEW_RENDERER_IMAGE (renderer)->channel,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
gimp_preview_renderer_render_buffer (renderer, render_buf,
|
||||
GIMP_PREVIEW_RENDERER_IMAGE (renderer)->channel,
|
||||
GIMP_PREVIEW_BG_CHECKS,
|
||||
GIMP_PREVIEW_BG_WHITE);
|
||||
|
||||
temp_buf_free (render_buf);
|
||||
}
|
||||
|
|
|
@ -29,17 +29,18 @@
|
|||
|
||||
/* non-widget objects */
|
||||
|
||||
typedef struct _GimpDeviceInfo GimpDeviceInfo;
|
||||
typedef struct _GimpDialogFactory GimpDialogFactory;
|
||||
typedef struct _GimpItemFactory GimpItemFactory;
|
||||
typedef struct _GimpMenuFactory GimpMenuFactory;
|
||||
typedef struct _GimpDeviceInfo GimpDeviceInfo;
|
||||
typedef struct _GimpDialogFactory GimpDialogFactory;
|
||||
typedef struct _GimpItemFactory GimpItemFactory;
|
||||
typedef struct _GimpMenuFactory GimpMenuFactory;
|
||||
|
||||
typedef struct _GimpCellRendererViewable GimpCellRendererViewable;
|
||||
typedef struct _GimpCellRendererViewable GimpCellRendererViewable;
|
||||
|
||||
typedef struct _GimpPreviewRenderer GimpPreviewRenderer;
|
||||
typedef struct _GimpPreviewRendererBrush GimpPreviewRendererBrush;
|
||||
typedef struct _GimpPreviewRendererDrawable GimpPreviewRendererDrawable;
|
||||
typedef struct _GimpPreviewRendererImage GimpPreviewRendererImage;
|
||||
typedef struct _GimpPreviewRenderer GimpPreviewRenderer;
|
||||
typedef struct _GimpPreviewRendererBrush GimpPreviewRendererBrush;
|
||||
typedef struct _GimpPreviewRendererDrawable GimpPreviewRendererDrawable;
|
||||
typedef struct _GimpPreviewRendererTextLayer GimpPreviewRendererTextLayer;
|
||||
typedef struct _GimpPreviewRendererImage GimpPreviewRendererImage;
|
||||
|
||||
|
||||
/* widgets */
|
||||
|
|
Loading…
Reference in New Issue