PIKApp/app/core/pikapickable.h

108 lines
6.3 KiB
C
Raw Normal View History

2023-09-26 00:35:21 +02:00
/* 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-1997 Spencer Kimball and Peter Mattis
*
* pikapickable.h
* Copyright (C) 2004 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_PICKABLE_H__
#define __PIKA_PICKABLE_H__
#define PIKA_TYPE_PICKABLE (pika_pickable_get_type ())
G_DECLARE_INTERFACE (PikaPickable, pika_pickable, PIKA, PICKABLE, GObject)
struct _PikaPickableInterface
{
GTypeInterface base_iface;
/* virtual functions */
void (* flush) (PikaPickable *pickable);
PikaImage * (* get_image) (PikaPickable *pickable);
const Babl * (* get_format) (PikaPickable *pickable);
const Babl * (* get_format_with_alpha) (PikaPickable *pickable);
GeglBuffer * (* get_buffer) (PikaPickable *pickable);
gboolean (* get_pixel_at) (PikaPickable *pickable,
gint x,
gint y,
const Babl *format,
gpointer pixel);
gdouble (* get_opacity_at) (PikaPickable *pickable,
gint x,
gint y);
void (* get_pixel_average) (PikaPickable *pickable,
const GeglRectangle *rect,
const Babl *format,
gpointer pixel);
void (* pixel_to_rgb) (PikaPickable *pickable,
const Babl *format,
gpointer pixel,
PikaRGB *color);
void (* rgb_to_pixel) (PikaPickable *pickable,
const PikaRGB *color,
const Babl *format,
gpointer pixel);
};
void pika_pickable_flush (PikaPickable *pickable);
PikaImage * pika_pickable_get_image (PikaPickable *pickable);
const Babl * pika_pickable_get_format (PikaPickable *pickable);
const Babl * pika_pickable_get_format_with_alpha (PikaPickable *pickable);
GeglBuffer * pika_pickable_get_buffer (PikaPickable *pickable);
gboolean pika_pickable_get_pixel_at (PikaPickable *pickable,
gint x,
gint y,
const Babl *format,
gpointer pixel);
gboolean pika_pickable_get_color_at (PikaPickable *pickable,
gint x,
gint y,
PikaRGB *color);
gdouble pika_pickable_get_opacity_at (PikaPickable *pickable,
gint x,
gint y);
void pika_pickable_get_pixel_average (PikaPickable *pickable,
const GeglRectangle *rect,
const Babl *format,
gpointer pixel);
void pika_pickable_pixel_to_rgb (PikaPickable *pickable,
const Babl *format,
gpointer pixel,
PikaRGB *color);
void pika_pickable_rgb_to_pixel (PikaPickable *pickable,
const PikaRGB *color,
const Babl *format,
gpointer pixel);
void pika_pickable_srgb_to_image_color (PikaPickable *pickable,
const PikaRGB *color,
PikaRGB *image_color);
gboolean pika_pickable_pick_color (PikaPickable *pickable,
gint x,
gint y,
gboolean sample_average,
gdouble average_radius,
gpointer pixel,
PikaRGB *color);
#endif /* __PIKA_PICKABLE_H__ */