PIKApp/app/core/pikacurve.h

129 lines
5.7 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
*
* 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_CURVE_H__
#define __PIKA_CURVE_H__
#include "pikadata.h"
#define PIKA_TYPE_CURVE (pika_curve_get_type ())
#define PIKA_CURVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_CURVE, PikaCurve))
#define PIKA_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_CURVE, PikaCurveClass))
#define PIKA_IS_CURVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_CURVE))
#define PIKA_IS_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_CURVE))
#define PIKA_CURVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_CURVE, PikaCurveClass))
typedef struct _PikaCurvePoint PikaCurvePoint;
typedef struct _PikaCurveClass PikaCurveClass;
struct _PikaCurvePoint
{
gdouble x;
gdouble y;
PikaCurvePointType type;
};
struct _PikaCurve
{
PikaData parent_instance;
PikaCurveType curve_type;
gint n_points;
PikaCurvePoint *points;
gint n_samples;
gdouble *samples;
gboolean identity; /* whether the curve is an identity mapping */
};
struct _PikaCurveClass
{
PikaDataClass parent_class;
};
GType pika_curve_get_type (void) G_GNUC_CONST;
PikaData * pika_curve_new (const gchar *name);
PikaData * pika_curve_get_standard (void);
void pika_curve_reset (PikaCurve *curve,
gboolean reset_type);
void pika_curve_set_curve_type (PikaCurve *curve,
PikaCurveType curve_type);
PikaCurveType pika_curve_get_curve_type (PikaCurve *curve);
gint pika_curve_get_n_points (PikaCurve *curve);
void pika_curve_set_n_samples (PikaCurve *curve,
gint n_samples);
gint pika_curve_get_n_samples (PikaCurve *curve);
gint pika_curve_get_point_at (PikaCurve *curve,
gdouble x);
gint pika_curve_get_closest_point (PikaCurve *curve,
gdouble x,
gdouble y,
gdouble max_distance);
gint pika_curve_add_point (PikaCurve *curve,
gdouble x,
gdouble y);
void pika_curve_delete_point (PikaCurve *curve,
gint point);
void pika_curve_set_point (PikaCurve *curve,
gint point,
gdouble x,
gdouble y);
void pika_curve_move_point (PikaCurve *curve,
gint point,
gdouble y);
void pika_curve_get_point (PikaCurve *curve,
gint point,
gdouble *x,
gdouble *y);
void pika_curve_set_point_type (PikaCurve *curve,
gint point,
PikaCurvePointType type);
PikaCurvePointType pika_curve_get_point_type (PikaCurve *curve,
gint point);
void pika_curve_clear_points (PikaCurve *curve);
void pika_curve_set_curve (PikaCurve *curve,
gdouble x,
gdouble y);
gboolean pika_curve_is_identity (PikaCurve *curve);
void pika_curve_get_uchar (PikaCurve *curve,
gint n_samples,
guchar *samples);
#endif /* __PIKA_CURVE_H__ */