|
Packit Service |
2781ba |
/* This file is part of GEGL
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* GEGL is free software; you can redistribute it and/or
|
|
Packit Service |
2781ba |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
2781ba |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
2781ba |
* version 3 of the License, or (at your option) any later version.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* GEGL is distributed in the hope that it will be useful,
|
|
Packit Service |
2781ba |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
2781ba |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
2781ba |
* Lesser General Public License for more details.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
2781ba |
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#ifndef __GEGL_SAMPLER_H__
|
|
Packit Service |
2781ba |
#define __GEGL_SAMPLER_H__
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#include <glib-object.h>
|
|
Packit Service |
2781ba |
#include <babl/babl.h>
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/* this file needs to be included by gegl-buffer-private */
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
G_BEGIN_DECLS
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#define GEGL_TYPE_SAMPLER (gegl_sampler_get_type ())
|
|
Packit Service |
2781ba |
#define GEGL_SAMPLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_SAMPLER, GeglSampler))
|
|
Packit Service |
2781ba |
#define GEGL_SAMPLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_SAMPLER, GeglSamplerClass))
|
|
Packit Service |
2781ba |
#define GEGL_IS_SAMPLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_SAMPLER))
|
|
Packit Service |
2781ba |
#define GEGL_IS_SAMPLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_SAMPLER))
|
|
Packit Service |
2781ba |
#define GEGL_SAMPLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_SAMPLER, GeglSamplerClass))
|
|
Packit Service |
2781ba |
#define GEGL_SAMPLER_MIPMAP_LEVELS 3
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
typedef struct _GeglSamplerClass GeglSamplerClass;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
struct _GeglSampler
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
GObject parent_instance;
|
|
Packit Service |
2781ba |
void (* get) (GeglSampler *self,
|
|
Packit Service |
2781ba |
gdouble x,
|
|
Packit Service |
2781ba |
gdouble y,
|
|
Packit Service |
2781ba |
GeglMatrix2 *scale,
|
|
Packit Service |
2781ba |
void *output);
|
|
Packit Service |
2781ba |
/* we cache the getter in the instance, (being able to return the
|
|
Packit Service |
2781ba |
function pointer itself and cache it outside the calling loop
|
|
Packit Service |
2781ba |
would be even quicker.
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/*< private >*/
|
|
Packit Service |
2781ba |
GeglBuffer *buffer;
|
|
Packit Service |
2781ba |
const Babl *format;
|
|
Packit Service |
2781ba |
const Babl *interpolate_format;
|
|
Packit Service |
2781ba |
const Babl *fish;
|
|
Packit Service |
2781ba |
GeglRectangle context_rect[GEGL_SAMPLER_MIPMAP_LEVELS];
|
|
Packit Service |
2781ba |
gpointer sampler_buffer[GEGL_SAMPLER_MIPMAP_LEVELS];
|
|
Packit Service |
2781ba |
GeglRectangle sampler_rectangle[GEGL_SAMPLER_MIPMAP_LEVELS];
|
|
Packit Service |
2781ba |
gdouble x; /* mirrors the currently requested */
|
|
Packit Service |
2781ba |
gdouble y; /* coordinates in the instance */
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
gpointer padding[8]; /* eat from the padding if adding to the struct */
|
|
Packit Service |
2781ba |
};
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
struct _GeglSamplerClass
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
GObjectClass parent_class;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
void (* prepare) (GeglSampler *self);
|
|
Packit Service |
2781ba |
void (* get) (GeglSampler *self,
|
|
Packit Service |
2781ba |
gdouble x,
|
|
Packit Service |
2781ba |
gdouble y,
|
|
Packit Service |
2781ba |
GeglMatrix2 *scale,
|
|
Packit Service |
2781ba |
void *output);
|
|
Packit Service |
2781ba |
void (*set_buffer) (GeglSampler *self,
|
|
Packit Service |
2781ba |
GeglBuffer *buffer);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
gpointer padding[8]; /* eat from the padding if adding to the struct */
|
|
Packit Service |
2781ba |
};
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
GType gegl_sampler_get_type (void) G_GNUC_CONST;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/* virtual method invokers */
|
|
Packit Service |
2781ba |
void gegl_sampler_prepare (GeglSampler *self);
|
|
Packit Service |
2781ba |
void gegl_sampler_set_buffer (GeglSampler *self,
|
|
Packit Service |
2781ba |
GeglBuffer *buffer);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
void gegl_sampler_get (GeglSampler *self,
|
|
Packit Service |
2781ba |
gdouble x,
|
|
Packit Service |
2781ba |
gdouble y,
|
|
Packit Service |
2781ba |
GeglMatrix2 *scale,
|
|
Packit Service |
2781ba |
void *output,
|
|
Packit Service |
2781ba |
GeglAbyssPolicy repeat_mode);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
gfloat * gegl_sampler_get_from_buffer (GeglSampler *sampler,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y);
|
|
Packit Service |
2781ba |
gfloat * gegl_sampler_get_from_mipmap (GeglSampler *sampler,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y,
|
|
Packit Service |
2781ba |
gint level);
|
|
Packit Service |
2781ba |
gfloat *
|
|
Packit Service |
2781ba |
gegl_sampler_get_ptr (GeglSampler *sampler,
|
|
Packit Service |
2781ba |
gint x,
|
|
Packit Service |
2781ba |
gint y);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
G_END_DECLS
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
#endif /* __GEGL_SAMPLER_H__ */
|