172 lines
8.1 KiB
C
172 lines
8.1 KiB
C
/* PIKA - Photo and Image Kooker Application
|
|
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
|
|
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
|
|
*
|
|
* Original copyright, applying to most contents (license remains unchanged):
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* pikaviewrenderer.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 3 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, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __PIKA_VIEW_RENDERER_H__
|
|
#define __PIKA_VIEW_RENDERER_H__
|
|
|
|
|
|
#define PIKA_VIEW_MAX_BORDER_WIDTH 16
|
|
|
|
|
|
#define PIKA_TYPE_VIEW_RENDERER (pika_view_renderer_get_type ())
|
|
#define PIKA_VIEW_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_VIEW_RENDERER, PikaViewRenderer))
|
|
#define PIKA_VIEW_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_VIEW_RENDERER, PikaViewRendererClass))
|
|
#define PIKA_IS_VIEW_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, PIKA_TYPE_VIEW_RENDERER))
|
|
#define PIKA_IS_VIEW_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_VIEW_RENDERER))
|
|
#define PIKA_VIEW_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_VIEW_RENDERER, PikaViewRendererClass))
|
|
|
|
|
|
typedef struct _PikaViewRendererPrivate PikaViewRendererPrivate;
|
|
typedef struct _PikaViewRendererClass PikaViewRendererClass;
|
|
|
|
struct _PikaViewRenderer
|
|
{
|
|
GObject parent_instance;
|
|
|
|
PikaContext *context;
|
|
|
|
GType viewable_type;
|
|
PikaViewable *viewable;
|
|
|
|
gint width;
|
|
gint height;
|
|
gint border_width;
|
|
guint dot_for_dot : 1;
|
|
guint is_popup : 1;
|
|
|
|
PikaViewBorderType border_type;
|
|
PikaRGB border_color;
|
|
|
|
/*< protected >*/
|
|
cairo_surface_t *surface;
|
|
|
|
gint size;
|
|
|
|
/*< private >*/
|
|
PikaViewRendererPrivate *priv;
|
|
};
|
|
|
|
struct _PikaViewRendererClass
|
|
{
|
|
GObjectClass parent_class;
|
|
|
|
GdkPixbuf *frame;
|
|
gint frame_left;
|
|
gint frame_right;
|
|
gint frame_bottom;
|
|
gint frame_top;
|
|
|
|
/* signals */
|
|
void (* update) (PikaViewRenderer *renderer);
|
|
|
|
/* virtual functions */
|
|
void (* set_context) (PikaViewRenderer *renderer,
|
|
PikaContext *context);
|
|
void (* invalidate) (PikaViewRenderer *renderer);
|
|
void (* draw) (PikaViewRenderer *renderer,
|
|
GtkWidget *widget,
|
|
cairo_t *cr,
|
|
gint available_width,
|
|
gint available_height);
|
|
void (* render) (PikaViewRenderer *renderer,
|
|
GtkWidget *widget);
|
|
};
|
|
|
|
|
|
GType pika_view_renderer_get_type (void) G_GNUC_CONST;
|
|
|
|
PikaViewRenderer * pika_view_renderer_new (PikaContext *context,
|
|
GType viewable_type,
|
|
gint size,
|
|
gint border_width,
|
|
gboolean is_popup);
|
|
PikaViewRenderer * pika_view_renderer_new_full (PikaContext *context,
|
|
GType viewable_type,
|
|
gint width,
|
|
gint height,
|
|
gint border_width,
|
|
gboolean is_popup);
|
|
|
|
void pika_view_renderer_set_context (PikaViewRenderer *renderer,
|
|
PikaContext *context);
|
|
void pika_view_renderer_set_viewable (PikaViewRenderer *renderer,
|
|
PikaViewable *viewable);
|
|
void pika_view_renderer_set_size (PikaViewRenderer *renderer,
|
|
gint size,
|
|
gint border_width);
|
|
void pika_view_renderer_set_size_full (PikaViewRenderer *renderer,
|
|
gint width,
|
|
gint height,
|
|
gint border_width);
|
|
void pika_view_renderer_set_dot_for_dot (PikaViewRenderer *renderer,
|
|
gboolean dot_for_dot);
|
|
void pika_view_renderer_set_border_type (PikaViewRenderer *renderer,
|
|
PikaViewBorderType border_type);
|
|
void pika_view_renderer_set_border_color (PikaViewRenderer *renderer,
|
|
const PikaRGB *border_color);
|
|
void pika_view_renderer_set_background (PikaViewRenderer *renderer,
|
|
const gchar *icon_name);
|
|
void pika_view_renderer_set_color_config (PikaViewRenderer *renderer,
|
|
PikaColorConfig *color_config);
|
|
|
|
void pika_view_renderer_invalidate (PikaViewRenderer *renderer);
|
|
void pika_view_renderer_update (PikaViewRenderer *renderer);
|
|
void pika_view_renderer_update_idle (PikaViewRenderer *renderer);
|
|
void pika_view_renderer_remove_idle (PikaViewRenderer *renderer);
|
|
|
|
void pika_view_renderer_draw (PikaViewRenderer *renderer,
|
|
GtkWidget *widget,
|
|
cairo_t *cr,
|
|
gint available_width,
|
|
gint available_height);
|
|
|
|
/* protected */
|
|
|
|
void pika_view_renderer_render_temp_buf_simple (PikaViewRenderer *renderer,
|
|
GtkWidget *widget,
|
|
PikaTempBuf *temp_buf);
|
|
void pika_view_renderer_render_temp_buf (PikaViewRenderer *renderer,
|
|
GtkWidget *widget,
|
|
PikaTempBuf *temp_buf,
|
|
gint temp_buf_x,
|
|
gint temp_buf_y,
|
|
gint channel,
|
|
PikaViewBG inside_bg,
|
|
PikaViewBG outside_bg);
|
|
void pika_view_renderer_render_pixbuf (PikaViewRenderer *renderer,
|
|
GtkWidget *widget,
|
|
GdkPixbuf *pixbuf);
|
|
void pika_view_renderer_render_icon (PikaViewRenderer *renderer,
|
|
GtkWidget *widget,
|
|
const gchar *icon_name);
|
|
PikaColorTransform *
|
|
pika_view_renderer_get_color_transform (PikaViewRenderer *renderer,
|
|
GtkWidget *widget,
|
|
const Babl *src_format,
|
|
const Babl *dest_format);
|
|
void pika_view_renderer_free_color_transform (PikaViewRenderer *renderer);
|
|
|
|
|
|
#endif /* __PIKA_VIEW_RENDERER_H__ */
|