gimp/libgimp/gimpbrush_pdb.h

88 lines
5.3 KiB
C
Raw Normal View History

2004-09-29 06:01:21 +08:00
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpbrush_pdb.h
*
* This library is free software: you can redistribute it and/or
2004-09-29 06:01:21 +08:00
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
2004-09-29 06:01:21 +08:00
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
2004-09-29 06:01:21 +08:00
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
2004-09-29 06:01:21 +08:00
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimp.h> can be included directly."
#endif
2004-09-29 06:01:21 +08:00
#ifndef __GIMP_BRUSH_PDB_H__
#define __GIMP_BRUSH_PDB_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
libgimp, pdb: replacing gimp_brush_get_pixels() by gimp_brush_get_buffer()… … and gimp_brush_get_mask(). gimp_brush_get_pixels() was a bit crappy, returning raw data with only dimensions and bpp to go with (no color model/space, no bit depth…). So the assumption is that we work with 8-bit per channel data, possibly with alpha depending of number of channels as deduced from bpp, and very likely in sRGB color space. It might be globally ok with many of the brush formats (and historical brushes) but won't fare well as we improve brush capabilities. - gimp_brush_get_pixels() is in fact made private. - The 2 new functions are using this old PDB call _gimp_brush_get_pixels() to construct buffers. This has some limitations, in particular that it returns only 8-bit per channel sRGB data, but at least the signature won't change when we will improve things in the future (so if some day, we pass fancy brushes in high-bit depth, the method will stay the same). - This new implementation also allows scaling down the brush (keeping aspect ratio) which is useful when you need to fit a brush preview into a drawing widget. - Current implementation stores the buffers at native size in the libgimp's GimpBrush object, hence save re-querying the core every time you need an update. This can be improved as current implementation also means that you don't get updates if the brush changed. This should handle most common use cases for now, though. - Also with this change, I move GimpBrush class implementation into its own dedicated file.
2023-08-18 22:39:11 +08:00
GimpBrush* gimp_brush_new (const gchar *name);
GimpBrush* gimp_brush_get_by_name (const gchar *name);
gboolean gimp_brush_is_generated (GimpBrush *brush);
gboolean gimp_brush_get_info (GimpBrush *brush,
gint *width,
gint *height,
gint *mask_bpp,
gint *color_bpp);
G_GNUC_INTERNAL gboolean _gimp_brush_get_pixels (GimpBrush *brush,
gint *width,
gint *height,
gint *mask_bpp,
GBytes **mask_bytes,
gint *color_bpp,
GBytes **color_bytes);
gint gimp_brush_get_spacing (GimpBrush *brush);
gboolean gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
gboolean gimp_brush_get_shape (GimpBrush *brush,
GimpBrushGeneratedShape *shape);
gboolean gimp_brush_set_shape (GimpBrush *brush,
GimpBrushGeneratedShape shape_in,
GimpBrushGeneratedShape *shape_out);
gboolean gimp_brush_get_radius (GimpBrush *brush,
gdouble *radius);
gboolean gimp_brush_set_radius (GimpBrush *brush,
gdouble radius_in,
gdouble *radius_out);
gboolean gimp_brush_get_spikes (GimpBrush *brush,
gint *spikes);
gboolean gimp_brush_set_spikes (GimpBrush *brush,
gint spikes_in,
gint *spikes_out);
gboolean gimp_brush_get_hardness (GimpBrush *brush,
gdouble *hardness);
gboolean gimp_brush_set_hardness (GimpBrush *brush,
gdouble hardness_in,
gdouble *hardness_out);
gboolean gimp_brush_get_aspect_ratio (GimpBrush *brush,
gdouble *aspect_ratio);
gboolean gimp_brush_set_aspect_ratio (GimpBrush *brush,
gdouble aspect_ratio_in,
gdouble *aspect_ratio_out);
gboolean gimp_brush_get_angle (GimpBrush *brush,
gdouble *angle);
gboolean gimp_brush_set_angle (GimpBrush *brush,
gdouble angle_in,
gdouble *angle_out);
2004-09-29 06:01:21 +08:00
G_END_DECLS
#endif /* __GIMP_BRUSH_PDB_H__ */