From d6f4d2c57774930556d4dd226139cd99df23dffd Mon Sep 17 00:00:00 2001 From: kramm Date: Tue, 22 Feb 2005 19:25:40 +0000 Subject: [PATCH] libart 2.3.16 --- lib/art/art_affine.h | 93 +++++++++++++++++++ lib/art/art_alphagamma.h | 55 ++++++++++++ lib/art/art_bpath.h | 59 ++++++++++++ lib/art/art_config.h | 10 +++ lib/art/art_filterlevel.h | 68 ++++++++++++++ lib/art/art_gray_svp.h | 46 ++++++++++ lib/art/art_misc.h | 96 ++++++++++++++++++++ lib/art/art_pathcode.h | 39 ++++++++ lib/art/art_pixbuf.h | 104 ++++++++++++++++++++++ lib/art/art_point.h | 38 ++++++++ lib/art/art_rect.h | 78 ++++++++++++++++ lib/art/art_rect_svp.h | 47 ++++++++++ lib/art/art_rect_uta.h | 43 +++++++++ lib/art/art_render.h | 183 ++++++++++++++++++++++++++++++++++++++ lib/art/art_render_gradient.h | 86 ++++++++++++++++++ lib/art/art_render_mask.h | 47 ++++++++++ lib/art/art_render_svp.h | 47 ++++++++++ lib/art/art_rgb.h | 44 +++++++++ lib/art/art_rgb_a_affine.h | 52 +++++++++++ lib/art/art_rgb_affine.h | 50 +++++++++++ lib/art/art_rgb_affine_private.h | 39 ++++++++ lib/art/art_rgb_bitmap_affine.h | 52 +++++++++++ lib/art/art_rgb_pixbuf_affine.h | 52 +++++++++++ lib/art/art_rgb_rgba_affine.h | 51 +++++++++++ lib/art/art_rgb_svp.h | 55 ++++++++++++ lib/art/art_rgba.h | 49 ++++++++++ lib/art/art_svp.h | 68 ++++++++++++++ lib/art/art_svp_intersect.h | 70 +++++++++++++++ lib/art/art_svp_ops.h | 44 +++++++++ lib/art/art_svp_point.h | 49 ++++++++++ lib/art/art_svp_render_aa.h | 67 ++++++++++++++ lib/art/art_svp_vpath.h | 44 +++++++++ lib/art/art_svp_vpath_stroke.h | 70 +++++++++++++++ lib/art/art_svp_wind.h | 57 ++++++++++++ lib/art/art_uta.h | 72 +++++++++++++++ lib/art/art_uta_ops.h | 42 +++++++++ lib/art/art_uta_rect.h | 42 +++++++++ lib/art/art_uta_svp.h | 45 ++++++++++ lib/art/art_uta_vpath.h | 50 +++++++++++ lib/art/art_vpath.h | 71 +++++++++++++++ lib/art/art_vpath_bpath.h | 48 ++++++++++ lib/art/art_vpath_dash.h | 50 +++++++++++ lib/art/art_vpath_svp.h | 43 +++++++++ lib/art/config.h | 3 + lib/art/libart.h | 39 ++++++++ 45 files changed, 2557 insertions(+) create mode 100644 lib/art/art_affine.h create mode 100644 lib/art/art_alphagamma.h create mode 100644 lib/art/art_bpath.h create mode 100644 lib/art/art_config.h create mode 100644 lib/art/art_filterlevel.h create mode 100644 lib/art/art_gray_svp.h create mode 100644 lib/art/art_misc.h create mode 100644 lib/art/art_pathcode.h create mode 100644 lib/art/art_pixbuf.h create mode 100644 lib/art/art_point.h create mode 100644 lib/art/art_rect.h create mode 100644 lib/art/art_rect_svp.h create mode 100644 lib/art/art_rect_uta.h create mode 100644 lib/art/art_render.h create mode 100644 lib/art/art_render_gradient.h create mode 100644 lib/art/art_render_mask.h create mode 100644 lib/art/art_render_svp.h create mode 100644 lib/art/art_rgb.h create mode 100644 lib/art/art_rgb_a_affine.h create mode 100644 lib/art/art_rgb_affine.h create mode 100644 lib/art/art_rgb_affine_private.h create mode 100644 lib/art/art_rgb_bitmap_affine.h create mode 100644 lib/art/art_rgb_pixbuf_affine.h create mode 100644 lib/art/art_rgb_rgba_affine.h create mode 100644 lib/art/art_rgb_svp.h create mode 100644 lib/art/art_rgba.h create mode 100644 lib/art/art_svp.h create mode 100644 lib/art/art_svp_intersect.h create mode 100644 lib/art/art_svp_ops.h create mode 100644 lib/art/art_svp_point.h create mode 100644 lib/art/art_svp_render_aa.h create mode 100644 lib/art/art_svp_vpath.h create mode 100644 lib/art/art_svp_vpath_stroke.h create mode 100644 lib/art/art_svp_wind.h create mode 100644 lib/art/art_uta.h create mode 100644 lib/art/art_uta_ops.h create mode 100644 lib/art/art_uta_rect.h create mode 100644 lib/art/art_uta_svp.h create mode 100644 lib/art/art_uta_vpath.h create mode 100644 lib/art/art_vpath.h create mode 100644 lib/art/art_vpath_bpath.h create mode 100644 lib/art/art_vpath_dash.h create mode 100644 lib/art/art_vpath_svp.h create mode 100644 lib/art/config.h create mode 100644 lib/art/libart.h diff --git a/lib/art/art_affine.h b/lib/art/art_affine.h new file mode 100644 index 0000000..9752ad8 --- /dev/null +++ b/lib/art/art_affine.h @@ -0,0 +1,93 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_AFFINE_H__ +#define __ART_AFFINE_H__ + +#ifdef LIBART_COMPILATION +#include "art_point.h" +#else +#include "art_point.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void +art_affine_point (ArtPoint *dst, const ArtPoint *src, + const double affine[6]); + +void +art_affine_invert (double dst_affine[6], const double src_affine[6]); + +/* flip the matrix, FALSE, FALSE is a simple copy operation, and + TRUE, TRUE equals a rotation by 180 degrees */ +void +art_affine_flip (double dst_affine[6], const double src_affine[6], + int horz, int vert); + +void +art_affine_to_string (char str[128], const double src[6]); + +void +art_affine_multiply (double dst[6], + const double src1[6], const double src2[6]); + +/* set up the identity matrix */ +void +art_affine_identity (double dst[6]); + +/* set up a scaling matrix */ +void +art_affine_scale (double dst[6], double sx, double sy); + +/* set up a rotation matrix; theta is given in degrees */ +void +art_affine_rotate (double dst[6], double theta); + +/* set up a shearing matrix; theta is given in degrees */ +void +art_affine_shear (double dst[6], double theta); + +/* set up a translation matrix */ +void +art_affine_translate (double dst[6], double tx, double ty); + + +/* find the affine's "expansion factor", i.e. the scale amount */ +double +art_affine_expansion (const double src[6]); + +/* Determine whether the affine transformation is rectilinear, + i.e. whether a rectangle aligned to the grid is transformed into + another rectangle aligned to the grid. */ +int +art_affine_rectilinear (const double src[6]); + +/* Determine whether two affine transformations are equal within grid allignment */ +int +art_affine_equal (double matrix1[6], double matrix2[6]); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_AFFINE_H__ */ diff --git a/lib/art/art_alphagamma.h b/lib/art/art_alphagamma.h new file mode 100644 index 0000000..94e91f5 --- /dev/null +++ b/lib/art/art_alphagamma.h @@ -0,0 +1,55 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_ALPHAGAMMA_H__ +#define __ART_ALPHAGAMMA_H__ + +/* Alphagamma tables */ + +#ifdef LIBART_COMPILATION +#include "art_misc.h" +#else +#include "art_misc.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtAlphaGamma ArtAlphaGamma; + +struct _ArtAlphaGamma { + /*< private >*/ + double gamma; + int invtable_size; + int table[256]; + art_u8 invtable[1]; +}; + +ArtAlphaGamma * +art_alphagamma_new (double gamma); + +void +art_alphagamma_free (ArtAlphaGamma *alphagamma); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_H__ */ diff --git a/lib/art/art_bpath.h b/lib/art/art_bpath.h new file mode 100644 index 0000000..12b99d9 --- /dev/null +++ b/lib/art/art_bpath.h @@ -0,0 +1,59 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_BPATH_H__ +#define __ART_BPATH_H__ + +#ifdef LIBART_COMPILATION +#include "art_misc.h" +#include "art_point.h" +#include "art_pathcode.h" +#else +#include "art_misc.h" +#include "art_point.h" +#include "art_pathcode.h" +#endif + +/* Basic data structures and constructors for bezier paths */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtBpath ArtBpath; + +struct _ArtBpath { + /*< public >*/ + ArtPathcode code; + double x1; + double y1; + double x2; + double y2; + double x3; + double y3; +}; + +ArtBpath * +art_bpath_affine_transform (const ArtBpath *src, const double matrix[6]); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_BPATH_H__ */ diff --git a/lib/art/art_config.h b/lib/art/art_config.h new file mode 100644 index 0000000..b0e74ad --- /dev/null +++ b/lib/art/art_config.h @@ -0,0 +1,10 @@ +/* Automatically generated by gen_art_config.c */ + +#define ART_SIZEOF_CHAR 1 +#define ART_SIZEOF_SHORT 2 +#define ART_SIZEOF_INT 4 +#define ART_SIZEOF_LONG 4 + +typedef unsigned char art_u8; +typedef unsigned short art_u16; +typedef unsigned int art_u32; diff --git a/lib/art/art_filterlevel.h b/lib/art/art_filterlevel.h new file mode 100644 index 0000000..1f4be48 --- /dev/null +++ b/lib/art/art_filterlevel.h @@ -0,0 +1,68 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_FILTERLEVEL_H__ +#define __ART_FILTERLEVEL_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef enum { + ART_FILTER_NEAREST, + ART_FILTER_TILES, + ART_FILTER_BILINEAR, + ART_FILTER_HYPER +} ArtFilterLevel; + +/* NEAREST is nearest neighbor. It is the fastest and lowest quality. + + TILES is an accurate simulation of the PostScript image operator + without any interpolation enabled; each pixel is rendered as a tiny + parallelogram of solid color, the edges of which are implemented + with antialiasing. It resembles nearest neighbor for enlargement, + and bilinear for reduction. + + BILINEAR is bilinear interpolation. For enlargement, it is + equivalent to point-sampling the ideal bilinear-interpolated + image. For reduction, it is equivalent to laying down small tiles + and integrating over the coverage area. + + HYPER is the highest quality reconstruction function. It is derived + from the hyperbolic filters in Wolberg's "Digital Image Warping," + and is formally defined as the hyperbolic-filter sampling the ideal + hyperbolic-filter interpolated image (the filter is designed to be + idempotent for 1:1 pixel mapping). It is the slowest and highest + quality. + + Note: at this stage of implementation, most filter modes are likely + not to be implemented. + + Note: cubic filtering is missing from this list, because there isn't + much point - hyper is just as fast to implement and slightly better + in quality. + +*/ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_PATHCODE_H__ */ diff --git a/lib/art/art_gray_svp.h b/lib/art/art_gray_svp.h new file mode 100644 index 0000000..c581693 --- /dev/null +++ b/lib/art/art_gray_svp.h @@ -0,0 +1,46 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* Render a sorted vector path into a graymap. */ + +#ifndef __ART_GRAY_SVP_H__ +#define __ART_GRAY_SVP_H__ + +#ifdef LIBART_COMPILATION +#include "art_misc.h" +#include "art_svp.h" +#else +#include "art_misc.h" +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void +art_gray_svp_aa (const ArtSVP *svp, + int x0, int y0, int x1, int y1, + art_u8 *buf, int rowstride); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_GRAY_SVP_H__ */ diff --git a/lib/art/art_misc.h b/lib/art/art_misc.h new file mode 100644 index 0000000..f8d5053 --- /dev/null +++ b/lib/art/art_misc.h @@ -0,0 +1,96 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* Simple macros to set up storage allocation and basic types for libart + functions. */ + +#ifndef __ART_MISC_H__ +#define __ART_MISC_H__ + +#include /* for malloc, etc. */ + +/* The art_config.h file is automatically generated by + gen_art_config.c and contains definitions of + ART_SIZEOF_{CHAR,SHORT,INT,LONG} and art_u{8,16,32}. */ +#ifdef LIBART_COMPILATION +#include "art_config.h" +#else +#include "art_config.h" +#endif + +#define art_alloc malloc +#define art_free free +#define art_realloc realloc + +/* These aren't, strictly speaking, configuration macros, but they're + damn handy to have around, and may be worth playing with for + debugging. */ +#define art_new(type, n) ((type *)art_alloc ((n) * sizeof(type))) + +#define art_renew(p, type, n) ((type *)art_realloc (p, (n) * sizeof(type))) + +/* This one must be used carefully - in particular, p and max should + be variables. They can also be pstruct->el lvalues. */ +#define art_expand(p, type, max) do { if(max) { p = art_renew (p, type, max <<= 1); } else { max = 1; p = art_new(type, 1); } } while (0) + +typedef int art_boolean; +#define ART_FALSE 0 +#define ART_TRUE 1 + +/* define pi */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif /* M_PI */ + +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif /* M_SQRT2 */ + +/* Provide macros to feature the GCC function attribute. + */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) +#define ART_GNUC_PRINTF( format_idx, arg_idx ) \ + __attribute__((format (printf, format_idx, arg_idx))) +#define ART_GNUC_NORETURN \ + __attribute__((noreturn)) +#else /* !__GNUC__ */ +#define ART_GNUC_PRINTF( format_idx, arg_idx ) +#define ART_GNUC_NORETURN +#endif /* !__GNUC__ */ + +#ifdef __cplusplus +extern "C" { +#endif + +void ART_GNUC_NORETURN +art_die (const char *fmt, ...) ART_GNUC_PRINTF (1, 2); + +void +art_warn (const char *fmt, ...) ART_GNUC_PRINTF (1, 2); + +void +art_dprint (const char *fmt, ...) ART_GNUC_PRINTF (1, 2); + +#ifdef __cplusplus +} +#endif + +#define ART_USE_NEW_INTERSECTOR + +#endif /* __ART_MISC_H__ */ diff --git a/lib/art/art_pathcode.h b/lib/art/art_pathcode.h new file mode 100644 index 0000000..87979ce --- /dev/null +++ b/lib/art/art_pathcode.h @@ -0,0 +1,39 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_PATHCODE_H__ +#define __ART_PATHCODE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef enum { + ART_MOVETO, + ART_MOVETO_OPEN, + ART_CURVETO, + ART_LINETO, + ART_END +} ArtPathcode; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_PATHCODE_H__ */ diff --git a/lib/art/art_pixbuf.h b/lib/art/art_pixbuf.h new file mode 100644 index 0000000..126f71f --- /dev/null +++ b/lib/art/art_pixbuf.h @@ -0,0 +1,104 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_PIXBUF_H__ +#define __ART_PIXBUF_H__ + +/* A generic data structure for holding a buffer of pixels. One way + to think about this module is as a virtualization over specific + pixel buffer formats. */ + +#ifdef LIBART_COMPILATION +#include "art_misc.h" +#else +#include "art_misc.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef void (*ArtDestroyNotify) (void *func_data, void *data); + +typedef struct _ArtPixBuf ArtPixBuf; + +typedef enum { + ART_PIX_RGB + /* gray, cmyk, lab, ... ? */ +} ArtPixFormat; + + +/* The pixel buffer consists of width * height pixels, each of which + has n_channels samples. It is stored in simple packed format. */ + +struct _ArtPixBuf { + /*< public >*/ + ArtPixFormat format; + int n_channels; + int has_alpha; + int bits_per_sample; + + art_u8 *pixels; + int width; + int height; + int rowstride; + void *destroy_data; + ArtDestroyNotify destroy; +}; + +/* allocate an ArtPixBuf from art_alloc()ed pixels (automated destruction) */ +ArtPixBuf * +art_pixbuf_new_rgb (art_u8 *pixels, int width, int height, int rowstride); + +ArtPixBuf * +art_pixbuf_new_rgba (art_u8 *pixels, int width, int height, int rowstride); + +/* allocate an ArtPixBuf from constant pixels (no destruction) */ +ArtPixBuf * +art_pixbuf_new_const_rgb (const art_u8 *pixels, int width, int height, int rowstride); + +ArtPixBuf * +art_pixbuf_new_const_rgba (const art_u8 *pixels, int width, int height, int rowstride); + +/* allocate an ArtPixBuf and notify creator upon destruction */ +ArtPixBuf * +art_pixbuf_new_rgb_dnotify (art_u8 *pixels, int width, int height, int rowstride, + void *dfunc_data, ArtDestroyNotify dfunc); + +ArtPixBuf * +art_pixbuf_new_rgba_dnotify (art_u8 *pixels, int width, int height, int rowstride, + void *dfunc_data, ArtDestroyNotify dfunc); + +/* free an ArtPixBuf with destroy notification */ +void +art_pixbuf_free (ArtPixBuf *pixbuf); + +/* deprecated function, use the _dnotify variants for allocation instead */ +void +art_pixbuf_free_shallow (ArtPixBuf *pixbuf); + +ArtPixBuf * +art_pixbuf_duplicate (const ArtPixBuf *pixbuf); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_point.h b/lib/art/art_point.h new file mode 100644 index 0000000..1efcda6 --- /dev/null +++ b/lib/art/art_point.h @@ -0,0 +1,38 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_POINT_H__ +#define __ART_POINT_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtPoint ArtPoint; + +struct _ArtPoint { + /*< public >*/ + double x, y; +}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_POINT_H__ */ diff --git a/lib/art/art_rect.h b/lib/art/art_rect.h new file mode 100644 index 0000000..088079f --- /dev/null +++ b/lib/art/art_rect.h @@ -0,0 +1,78 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RECT_H__ +#define __ART_RECT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _ArtDRect ArtDRect; +typedef struct _ArtIRect ArtIRect; + +struct _ArtDRect { + /*< public >*/ + double x0, y0, x1, y1; +}; + +struct _ArtIRect { + /*< public >*/ + int x0, y0, x1, y1; +}; + +/* Make a copy of the rectangle. */ +void art_irect_copy (ArtIRect *dest, const ArtIRect *src); + +/* Find the smallest rectangle that includes both source rectangles. */ +void art_irect_union (ArtIRect *dest, + const ArtIRect *src1, const ArtIRect *src2); + +/* Return the intersection of the two rectangles */ +void art_irect_intersect (ArtIRect *dest, + const ArtIRect *src1, const ArtIRect *src2); + +/* Return true if the rectangle is empty. */ +int art_irect_empty (const ArtIRect *src); + +/* Make a copy of the rectangle. */ +void art_drect_copy (ArtDRect *dest, const ArtDRect *src); + +/* Find the smallest rectangle that includes both source rectangles. */ +void art_drect_union (ArtDRect *dest, + const ArtDRect *src1, const ArtDRect *src2); + +/* Return the intersection of the two rectangles */ +void art_drect_intersect (ArtDRect *dest, + const ArtDRect *src1, const ArtDRect *src2); + +/* Return true if the rectangle is empty. */ +int art_drect_empty (const ArtDRect *src); + +void +art_drect_affine_transform (ArtDRect *dst, const ArtDRect *src, + const double matrix[6]); + +void art_drect_to_irect (ArtIRect *dst, ArtDRect *src); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rect_svp.h b/lib/art/art_rect_svp.h new file mode 100644 index 0000000..2df5c03 --- /dev/null +++ b/lib/art/art_rect_svp.h @@ -0,0 +1,47 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RECT_SVP_H__ +#define __ART_RECT_SVP_H__ + +/* Find the bounding box of a sorted vector path. */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#else +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void +art_drect_svp (ArtDRect *bbox, const ArtSVP *svp); + +/* Compute the bounding box of the svp and union it in to the + existing bounding box. */ +void +art_drect_svp_union (ArtDRect *bbox, const ArtSVP *svp); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_RECT_SVP_H__ */ diff --git a/lib/art/art_rect_uta.h b/lib/art/art_rect_uta.h new file mode 100644 index 0000000..bfe6719 --- /dev/null +++ b/lib/art/art_rect_uta.h @@ -0,0 +1,43 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RECT_UTA_H__ +#define __ART_RECT_UTA_H__ + +#ifdef LIBART_COMPILATION +#include "art_rect.h" +#include "art_uta.h" +#else +#include "art_rect.h" +#include "art_uta.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtIRect * +art_rect_list_from_uta (ArtUta *uta, int max_width, int max_height, + int *p_nrects); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_RECT_UTA_H__ */ diff --git a/lib/art/art_render.h b/lib/art/art_render.h new file mode 100644 index 0000000..744c816 --- /dev/null +++ b/lib/art/art_render.h @@ -0,0 +1,183 @@ +/* + * art_render.h: Modular rendering architecture. + * + * Libart_LGPL - library of basic graphic primitives + * Copyright (C) 2000 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RENDER_H__ +#define __ART_RENDER_H__ + +#ifdef LIBART_COMPILATION +#include "art_alphagamma.h" +#else +#include "art_alphagamma.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Render object */ + +#ifndef ART_MAX_DEPTH +#define ART_MAX_DEPTH 16 +#endif + +#if ART_MAX_DEPTH == 16 +typedef art_u16 ArtPixMaxDepth; +#define ART_PIX_MAX_FROM_8(x) ((x) | ((x) << 8)) +#define ART_PIX_8_FROM_MAX(x) (((x) + 0x80 - (((x) + 0x80) >> 8)) >> 8) +#else +#if ART_MAX_DEPTH == 8 +typedef art_u8 ArtPixMaxDepth; +#define ART_PIX_MAX_FROM_8(x) (x) +#define ART_PIX_8_FROM_MAX(x) (x) +#else +#error ART_MAX_DEPTH must be either 8 or 16 +#endif +#endif + +#define ART_MAX_CHAN 16 + +typedef struct _ArtRender ArtRender; +typedef struct _ArtRenderCallback ArtRenderCallback; +typedef struct _ArtRenderMaskRun ArtRenderMaskRun; +typedef struct _ArtImageSource ArtImageSource; +typedef struct _ArtMaskSource ArtMaskSource; + +typedef enum { + ART_ALPHA_NONE = 0, + ART_ALPHA_SEPARATE = 1, + ART_ALPHA_PREMUL = 2 +} ArtAlphaType; + +typedef enum { + ART_COMPOSITE_NORMAL, + ART_COMPOSITE_MULTIPLY, + /* todo: more */ + ART_COMPOSITE_CUSTOM +} ArtCompositingMode; + +typedef enum { + ART_IMAGE_SOURCE_CAN_CLEAR = 1, + ART_IMAGE_SOURCE_CAN_COMPOSITE = 2 +} ArtImageSourceFlags; + +struct _ArtRenderMaskRun { + int x; + int alpha; +}; + +struct _ArtRenderCallback { + void (*render) (ArtRenderCallback *self, ArtRender *render, + art_u8 *dest, int y); + void (*done) (ArtRenderCallback *self, ArtRender *render); +}; + +struct _ArtImageSource { + ArtRenderCallback super; + void (*negotiate) (ArtImageSource *self, ArtRender *render, + ArtImageSourceFlags *p_flags, + int *p_buf_depth, ArtAlphaType *p_alpha_type); +}; + +struct _ArtMaskSource { + ArtRenderCallback super; + int (*can_drive) (ArtMaskSource *self, ArtRender *render); + /* For each mask source, ::prepare() is invoked if it is not + a driver, or ::invoke_driver() if it is. */ + void (*invoke_driver) (ArtMaskSource *self, ArtRender *render); + void (*prepare) (ArtMaskSource *self, ArtRender *render, art_boolean first); +}; + +struct _ArtRender { + /* parameters of destination image */ + int x0, y0; + int x1, y1; + art_u8 *pixels; + int rowstride; + int n_chan; + int depth; + ArtAlphaType alpha_type; + + art_boolean clear; + ArtPixMaxDepth clear_color[ART_MAX_CHAN + 1]; + art_u32 opacity; /* [0..0x10000] */ + + ArtCompositingMode compositing_mode; + + ArtAlphaGamma *alphagamma; + + art_u8 *alpha_buf; + + /* parameters of intermediate buffer */ + int buf_depth; + ArtAlphaType buf_alpha; + art_u8 *image_buf; + + /* driving alpha scanline data */ + /* A "run" is a contiguous sequence of x values with the same alpha value. */ + int n_run; + ArtRenderMaskRun *run; + + /* A "span" is a contiguous sequence of x values with non-zero alpha. */ + int n_span; + int *span_x; + + art_boolean need_span; +}; + +ArtRender * +art_render_new (int x0, int y0, int x1, int y1, + art_u8 *pixels, int rowstride, + int n_chan, int depth, ArtAlphaType alpha_type, + ArtAlphaGamma *alphagamma); + +void +art_render_invoke (ArtRender *render); + +void +art_render_clear (ArtRender *render, const ArtPixMaxDepth *clear_color); + +void +art_render_clear_rgb (ArtRender *render, art_u32 clear_rgb); + +void +art_render_mask_solid (ArtRender *render, int opacity); + +void +art_render_image_solid (ArtRender *render, ArtPixMaxDepth *color); + +/* The next two functions are for custom mask sources only. */ +void +art_render_add_mask_source (ArtRender *render, ArtMaskSource *mask_source); + +void +art_render_invoke_callbacks (ArtRender *render, art_u8 *dest, int y); + +/* The following function is for custom image sources only. */ +void +art_render_add_image_source (ArtRender *render, ArtImageSource *image_source); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_RENDER_H__ */ + diff --git a/lib/art/art_render_gradient.h b/lib/art/art_render_gradient.h new file mode 100644 index 0000000..307512e --- /dev/null +++ b/lib/art/art_render_gradient.h @@ -0,0 +1,86 @@ +/* + * art_render_gradient.h: Gradient image source for modular rendering. + * + * Libart_LGPL - library of basic graphic primitives + * Copyright (C) 2000 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Raph Levien + * Alexander Larsson + */ + +#ifndef __ART_RENDER_GRADIENT_H__ +#define __ART_RENDER_GRADIENT_H__ + +#ifdef LIBART_COMPILATION +#include "art_filterlevel.h" +#include "art_render.h" +#else +#include "art_filterlevel.h" +#include "art_render.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtGradientLinear ArtGradientLinear; +typedef struct _ArtGradientRadial ArtGradientRadial; +typedef struct _ArtGradientStop ArtGradientStop; + +typedef enum { + ART_GRADIENT_PAD, + ART_GRADIENT_REFLECT, + ART_GRADIENT_REPEAT +} ArtGradientSpread; + +struct _ArtGradientLinear { + double a; + double b; + double c; + ArtGradientSpread spread; + int n_stops; + ArtGradientStop *stops; +}; + +struct _ArtGradientRadial { + double affine[6]; /* transforms user coordinates to unit circle */ + double fx, fy; /* focal point in unit circle coords */ + int n_stops; + ArtGradientStop *stops; +}; + +struct _ArtGradientStop { + double offset; + ArtPixMaxDepth color[ART_MAX_CHAN + 1]; +}; + +void +art_render_gradient_linear (ArtRender *render, + const ArtGradientLinear *gradient, + ArtFilterLevel level); + +void +art_render_gradient_radial (ArtRender *render, + const ArtGradientRadial *gradient, + ArtFilterLevel level); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_RENDER_GRADIENT_H__ */ diff --git a/lib/art/art_render_mask.h b/lib/art/art_render_mask.h new file mode 100644 index 0000000..d3bd90c --- /dev/null +++ b/lib/art/art_render_mask.h @@ -0,0 +1,47 @@ +/* + * art_render_mask.h: Alpha mask source for modular rendering. + * + * Libart_LGPL - library of basic graphic primitives + * Copyright (C) 2000 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Raph Levien + */ + +#ifndef __ART_RENDER_MASK_H__ +#define __ART_RENDER_MASK_H__ + +#ifdef LIBART_COMPILATION +#include "art_render.h" +#else +#include "art_render.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void +art_render_mask (ArtRender *render, + int x0, int y0, int x1, int y1, + const art_u8 *mask_buf, int rowstride); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_RENDER_MASK_H__ */ diff --git a/lib/art/art_render_svp.h b/lib/art/art_render_svp.h new file mode 100644 index 0000000..5e34789 --- /dev/null +++ b/lib/art/art_render_svp.h @@ -0,0 +1,47 @@ +/* + * art_render_svp.h: SVP mask source for modular rendering. + * + * Libart_LGPL - library of basic graphic primitives + * Copyright (C) 2000 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Raph Levien + */ + +#ifndef __ART_RENDER_SVP_H__ +#define __ART_RENDER_SVP_H__ + +#ifdef LIBART_COMPILATION +#include "art_render.h" +#include "art_svp.h" +#else +#include "art_render.h" +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void +art_render_svp (ArtRender *render, const ArtSVP *svp); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_RENDER_SVP_H__ */ diff --git a/lib/art/art_rgb.h b/lib/art/art_rgb.h new file mode 100644 index 0000000..36fec00 --- /dev/null +++ b/lib/art/art_rgb.h @@ -0,0 +1,44 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_H__ +#define __ART_RGB_H__ + +#ifdef LIBART_COMPILATION +#include "art_misc.h" +#else +#include "art_misc.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void +art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n); + +void +art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha, + int n); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rgb_a_affine.h b/lib/art/art_rgb_a_affine.h new file mode 100644 index 0000000..e970013 --- /dev/null +++ b/lib/art/art_rgb_a_affine.h @@ -0,0 +1,52 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_A_AFFINE_H__ +#define __ART_RGB_A_AFFINE_H__ + +/* This module handles compositing of affine-transformed alpha only images + over rgb pixel buffers. */ + +#ifdef LIBART_COMPILATION +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#else +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void +art_rgb_a_affine (art_u8 *dst, + int x0, int y0, int x1, int y1, int dst_rowstride, + const art_u8 *src, + int src_width, int src_height, int src_rowstride, + art_u32 rgb, + const double affine[6], + ArtFilterLevel level, + ArtAlphaGamma *alphagamma); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rgb_affine.h b/lib/art/art_rgb_affine.h new file mode 100644 index 0000000..68d023a --- /dev/null +++ b/lib/art/art_rgb_affine.h @@ -0,0 +1,50 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_AFFINE_H__ +#define __ART_RGB_AFFINE_H__ + +/* This module handles compositing of affine-transformed rgb images + over rgb pixel buffers. */ + +#ifdef LIBART_COMPILATION +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#else +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void +art_rgb_affine (art_u8 *dst, int x0, int y0, int x1, int y1, int dst_rowstride, + const art_u8 *src, + int src_width, int src_height, int src_rowstride, + const double affine[6], + ArtFilterLevel level, + ArtAlphaGamma *alphagamma); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rgb_affine_private.h b/lib/art/art_rgb_affine_private.h new file mode 100644 index 0000000..edaf0e3 --- /dev/null +++ b/lib/art/art_rgb_affine_private.h @@ -0,0 +1,39 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_AFFINE_PRIVATE_H__ +#define __ART_RGB_AFFINE_PRIVATE_H__ + +/* This module handles compositing of affine-transformed rgb images + over rgb pixel buffers. */ + +#ifdef __cplusplus +extern "C" { +#endif + +void +art_rgb_affine_run (int *p_x0, int *p_x1, int y, + int src_width, int src_height, + const double affine[6]); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rgb_bitmap_affine.h b/lib/art/art_rgb_bitmap_affine.h new file mode 100644 index 0000000..f6ee039 --- /dev/null +++ b/lib/art/art_rgb_bitmap_affine.h @@ -0,0 +1,52 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_BITMAP_AFFINE_H__ +#define __ART_RGB_BITMAP_AFFINE_H__ + +/* This module handles compositing of affine-transformed bitmap images + over rgb pixel buffers. */ + +#ifdef LIBART_COMPILATION +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#else +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void +art_rgb_bitmap_affine (art_u8 *dst, + int x0, int y0, int x1, int y1, int dst_rowstride, + const art_u8 *src, + int src_width, int src_height, int src_rowstride, + art_u32 rgba, + const double affine[6], + ArtFilterLevel level, + ArtAlphaGamma *alphagamma); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rgb_pixbuf_affine.h b/lib/art/art_rgb_pixbuf_affine.h new file mode 100644 index 0000000..b99f2da --- /dev/null +++ b/lib/art/art_rgb_pixbuf_affine.h @@ -0,0 +1,52 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_PIXBUF_AFFINE_H__ +#define __ART_RGB_PIXBUF_AFFINE_H__ + +/* This module handles compositing of affine-transformed generic + pixbuf images over rgb pixel buffers. */ + +#ifdef LIBART_COMPILATION +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#include "art_pixbuf.h" +#else +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#include "art_pixbuf.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void +art_rgb_pixbuf_affine (art_u8 *dst, + int x0, int y0, int x1, int y1, int dst_rowstride, + const ArtPixBuf *pixbuf, + const double affine[6], + ArtFilterLevel level, + ArtAlphaGamma *alphagamma); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rgb_rgba_affine.h b/lib/art/art_rgb_rgba_affine.h new file mode 100644 index 0000000..79ce0d1 --- /dev/null +++ b/lib/art/art_rgb_rgba_affine.h @@ -0,0 +1,51 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_RGBA_AFFINE_H__ +#define __ART_RGB_RGBA_AFFINE_H__ + +/* This module handles compositing of affine-transformed rgba images + over rgb pixel buffers. */ + +#ifdef LIBART_COMPILATION +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#else +#include "art_filterlevel.h" +#include "art_alphagamma.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void +art_rgb_rgba_affine (art_u8 *dst, + int x0, int y0, int x1, int y1, int dst_rowstride, + const art_u8 *src, + int src_width, int src_height, int src_rowstride, + const double affine[6], + ArtFilterLevel level, + ArtAlphaGamma *alphagamma); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/art/art_rgb_svp.h b/lib/art/art_rgb_svp.h new file mode 100644 index 0000000..72d69c7 --- /dev/null +++ b/lib/art/art_rgb_svp.h @@ -0,0 +1,55 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGB_SVP_H__ +#define __ART_RGB_SVP_H__ + +/* Render a sorted vector path into an RGB buffer. */ + +#ifdef LIBART_COMPILATION +#include "art_alphagamma.h" +#include "art_svp.h" +#else +#include "art_alphagamma.h" +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void +art_rgb_svp_aa (const ArtSVP *svp, + int x0, int y0, int x1, int y1, + art_u32 fg_color, art_u32 bg_color, + art_u8 *buf, int rowstride, + ArtAlphaGamma *alphagamma); + +void +art_rgb_svp_alpha (const ArtSVP *svp, + int x0, int y0, int x1, int y1, + art_u32 rgba, + art_u8 *buf, int rowstride, + ArtAlphaGamma *alphagamma); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_RGB_SVP_H__ */ diff --git a/lib/art/art_rgba.h b/lib/art/art_rgba.h new file mode 100644 index 0000000..77412e9 --- /dev/null +++ b/lib/art/art_rgba.h @@ -0,0 +1,49 @@ +/* + * art_rgba.h: Functions for manipulating RGBA pixel data. + * + * Libart_LGPL - library of basic graphic primitives + * Copyright (C) 2000 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_RGBA_H__ +#define __ART_RGBA_H__ + +#ifdef LIBART_COMPILATION +#include "art_misc.h" +#else +#include "art_misc.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void +art_rgba_rgba_composite (art_u8 *dst, const art_u8 *src, int n); + +void +art_rgba_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n); + +void +art_rgba_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/lib/art/art_svp.h b/lib/art/art_svp.h new file mode 100644 index 0000000..4f88e8b --- /dev/null +++ b/lib/art/art_svp.h @@ -0,0 +1,68 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_H__ +#define __ART_SVP_H__ + +/* Basic data structures and constructors for sorted vector paths */ + +#ifdef LIBART_COMPILATION +#include "art_rect.h" +#include "art_point.h" +#else +#include "art_rect.h" +#include "art_point.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtSVP ArtSVP; +typedef struct _ArtSVPSeg ArtSVPSeg; + +struct _ArtSVPSeg { + int n_points; + int dir; /* == 0 for "up", 1 for "down" */ + ArtDRect bbox; + ArtPoint *points; +}; + +struct _ArtSVP { + int n_segs; + ArtSVPSeg segs[1]; +}; + +int +art_svp_add_segment (ArtSVP **p_vp, int *pn_segs_max, + int **pn_points_max, + int n_points, int dir, ArtPoint *points, + ArtDRect *bbox); + +void +art_svp_free (ArtSVP *svp); + +int +art_svp_seg_compare (const void *s1, const void *s2); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_H__ */ diff --git a/lib/art/art_svp_intersect.h b/lib/art/art_svp_intersect.h new file mode 100644 index 0000000..845601a --- /dev/null +++ b/lib/art/art_svp_intersect.h @@ -0,0 +1,70 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 2001 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_INTERSECT_H__ +#define __ART_SVP_INTERSECT_H__ + +/* The funky new SVP intersector. */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#else +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef ART_WIND_RULE_DEFINED +#define ART_WIND_RULE_DEFINED +typedef enum { + ART_WIND_RULE_NONZERO, + ART_WIND_RULE_INTERSECT, + ART_WIND_RULE_ODDEVEN, + ART_WIND_RULE_POSITIVE +} ArtWindRule; +#endif + +typedef struct _ArtSvpWriter ArtSvpWriter; + +struct _ArtSvpWriter { + int (*add_segment) (ArtSvpWriter *self, int wind_left, int delta_wind, + double x, double y); + void (*add_point) (ArtSvpWriter *self, int seg_id, double x, double y); + void (*close_segment) (ArtSvpWriter *self, int seg_id); +}; + +ArtSvpWriter * +art_svp_writer_rewind_new (ArtWindRule rule); + +ArtSVP * +art_svp_writer_rewind_reap (ArtSvpWriter *self); + +int +art_svp_seg_compare (const void *s1, const void *s2); + +void +art_svp_intersector (const ArtSVP *in, ArtSvpWriter *out); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_INTERSECT_H__ */ diff --git a/lib/art/art_svp_ops.h b/lib/art/art_svp_ops.h new file mode 100644 index 0000000..1104731 --- /dev/null +++ b/lib/art/art_svp_ops.h @@ -0,0 +1,44 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_OPS_H__ +#define __ART_SVP_OPS_H__ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#else +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Vector path set operations, over sorted vpaths. */ + +ArtSVP *art_svp_union (const ArtSVP *svp1, const ArtSVP *svp2); +ArtSVP *art_svp_intersect (const ArtSVP *svp1, const ArtSVP *svp2); +ArtSVP *art_svp_diff (const ArtSVP *svp1, const ArtSVP *svp2); +ArtSVP *art_svp_minus (const ArtSVP *svp1, const ArtSVP *svp2); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_OPS_H__ */ diff --git a/lib/art/art_svp_point.h b/lib/art/art_svp_point.h new file mode 100644 index 0000000..5c21204 --- /dev/null +++ b/lib/art/art_svp_point.h @@ -0,0 +1,49 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1999 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_POINT_H__ +#define __ART_SVP_POINT_H__ + +/* Determine whether a point is inside, or near, an svp. */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#else +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +int +art_svp_point_wind (ArtSVP *svp, double x, double y); + +double +art_svp_point_dist (ArtSVP *svp, double x, double y); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_H__ */ + + + + diff --git a/lib/art/art_svp_render_aa.h b/lib/art/art_svp_render_aa.h new file mode 100644 index 0000000..7e1bddb --- /dev/null +++ b/lib/art/art_svp_render_aa.h @@ -0,0 +1,67 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_RENDER_AA_H__ +#define __ART_SVP_RENDER_AA_H__ + +/* The spiffy antialiased renderer for sorted vector paths. */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#else +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtSVPRenderAAStep ArtSVPRenderAAStep; +typedef struct _ArtSVPRenderAAIter ArtSVPRenderAAIter; + +struct _ArtSVPRenderAAStep { + int x; + int delta; /* stored with 16 fractional bits */ +}; + +ArtSVPRenderAAIter * +art_svp_render_aa_iter (const ArtSVP *svp, + int x0, int y0, int x1, int y1); + +void +art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start, + ArtSVPRenderAAStep **p_steps, int *p_n_steps); + +void +art_svp_render_aa_iter_done (ArtSVPRenderAAIter *iter); + +void +art_svp_render_aa (const ArtSVP *svp, + int x0, int y0, int x1, int y1, + void (*callback) (void *callback_data, + int y, + int start, + ArtSVPRenderAAStep *steps, int n_steps), + void *callback_data); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_RENDER_AA_H__ */ diff --git a/lib/art/art_svp_vpath.h b/lib/art/art_svp_vpath.h new file mode 100644 index 0000000..21c3d69 --- /dev/null +++ b/lib/art/art_svp_vpath.h @@ -0,0 +1,44 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_VPATH_H__ +#define __ART_SVP_VPATH_H__ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#include "art_vpath.h" +#else +#include "art_svp.h" +#include "art_vpath.h" +#endif + +/* Sort vector paths into sorted vector paths. */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtSVP * +art_svp_from_vpath (ArtVpath *vpath); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_VPATH_H__ */ diff --git a/lib/art/art_svp_vpath_stroke.h b/lib/art/art_svp_vpath_stroke.h new file mode 100644 index 0000000..b9236ab --- /dev/null +++ b/lib/art/art_svp_vpath_stroke.h @@ -0,0 +1,70 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_VPATH_STROKE_H__ +#define __ART_SVP_VPATH_STROKE_H__ + +/* Sort vector paths into sorted vector paths. */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#include "art_vpath.h" +#else +#include "art_svp.h" +#include "art_vpath.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef enum { + ART_PATH_STROKE_JOIN_MITER, + ART_PATH_STROKE_JOIN_ROUND, + ART_PATH_STROKE_JOIN_BEVEL +} ArtPathStrokeJoinType; + +typedef enum { + ART_PATH_STROKE_CAP_BUTT, + ART_PATH_STROKE_CAP_ROUND, + ART_PATH_STROKE_CAP_SQUARE +} ArtPathStrokeCapType; + +ArtSVP * +art_svp_vpath_stroke (ArtVpath *vpath, + ArtPathStrokeJoinType join, + ArtPathStrokeCapType cap, + double line_width, + double miter_limit, + double flatness); + +/* This version may have winding numbers exceeding 1. */ +ArtVpath * +art_svp_vpath_stroke_raw (ArtVpath *vpath, + ArtPathStrokeJoinType join, + ArtPathStrokeCapType cap, + double line_width, + double miter_limit, + double flatness); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_VPATH_STROKE_H__ */ diff --git a/lib/art/art_svp_wind.h b/lib/art/art_svp_wind.h new file mode 100644 index 0000000..2b7efc5 --- /dev/null +++ b/lib/art/art_svp_wind.h @@ -0,0 +1,57 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_SVP_WIND_H__ +#define __ART_SVP_WIND_H__ + +/* Primitive intersection and winding number operations on sorted + vector paths. */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#else +#include "art_svp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef ART_WIND_RULE_DEFINED +#define ART_WIND_RULE_DEFINED +typedef enum { + ART_WIND_RULE_NONZERO, + ART_WIND_RULE_INTERSECT, + ART_WIND_RULE_ODDEVEN, + ART_WIND_RULE_POSITIVE +} ArtWindRule; +#endif + +ArtSVP * +art_svp_uncross (ArtSVP *vp); + +ArtSVP * +art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_SVP_WIND_H__ */ diff --git a/lib/art/art_uta.h b/lib/art/art_uta.h new file mode 100644 index 0000000..943840f --- /dev/null +++ b/lib/art/art_uta.h @@ -0,0 +1,72 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_UTA_H__ +#define __ART_UTA_H__ + +/* Basic data structures and constructors for microtile arrays */ + +#ifdef LIBART_COMPILATION +#include "art_misc.h" +#else +#include "art_misc.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef art_u32 ArtUtaBbox; +typedef struct _ArtUta ArtUta; + +#define ART_UTA_BBOX_CONS(x0, y0, x1, y1) (((x0) << 24) | ((y0) << 16) | \ + ((x1) << 8) | (y1)) + +#define ART_UTA_BBOX_X0(ub) ((ub) >> 24) +#define ART_UTA_BBOX_Y0(ub) (((ub) >> 16) & 0xff) +#define ART_UTA_BBOX_X1(ub) (((ub) >> 8) & 0xff) +#define ART_UTA_BBOX_Y1(ub) ((ub) & 0xff) + +#define ART_UTILE_SHIFT 5 +#define ART_UTILE_SIZE (1 << ART_UTILE_SHIFT) + +/* Coordinates are shifted right by ART_UTILE_SHIFT wrt the real + coordinates. */ +struct _ArtUta { + int x0; + int y0; + int width; + int height; + ArtUtaBbox *utiles; +}; + +ArtUta * +art_uta_new (int x0, int y0, int x1, int y1); + +ArtUta * +art_uta_new_coords (int x0, int y0, int x1, int y1); + +void +art_uta_free (ArtUta *uta); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_UTA_H__ */ diff --git a/lib/art/art_uta_ops.h b/lib/art/art_uta_ops.h new file mode 100644 index 0000000..0cec287 --- /dev/null +++ b/lib/art/art_uta_ops.h @@ -0,0 +1,42 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_UTA_OPS_H__ +#define __ART_UTA_OPS_H__ + +/* Basic operations on microtile arrays */ + +#ifdef LIBART_COMPILATION +#include "art_uta.h" +#else +#include "art_uta.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtUta * +art_uta_union (ArtUta *uta1, ArtUta *uta2); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_UTA_OPS_H__ */ diff --git a/lib/art/art_uta_rect.h b/lib/art/art_uta_rect.h new file mode 100644 index 0000000..ba0a779 --- /dev/null +++ b/lib/art/art_uta_rect.h @@ -0,0 +1,42 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_UTA_RECT_H__ +#define __ART_UTA_RECT_H__ + +#ifdef LIBART_COMPILATION +#include "art_rect.h" +#include "art_uta.h" +#else +#include "art_rect.h" +#include "art_uta.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtUta * +art_uta_from_irect (ArtIRect *bbox); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_UTA_RECT_H__ */ diff --git a/lib/art/art_uta_svp.h b/lib/art/art_uta_svp.h new file mode 100644 index 0000000..85da01f --- /dev/null +++ b/lib/art/art_uta_svp.h @@ -0,0 +1,45 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_UTA_SVP_H__ +#define __ART_UTA_SVP_H__ + +/* Basic data structures and constructors for microtile arrays */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#include "art_uta.h" +#else +#include "art_svp.h" +#include "art_uta.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtUta * +art_uta_from_svp (const ArtSVP *svp); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_UTA_SVP_H__ */ + diff --git a/lib/art/art_uta_vpath.h b/lib/art/art_uta_vpath.h new file mode 100644 index 0000000..149bbb7 --- /dev/null +++ b/lib/art/art_uta_vpath.h @@ -0,0 +1,50 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_UTA_VPATH_H__ +#define __ART_UTA_VPATH_H__ + +/* Basic data structures and constructors for microtile arrays */ + +#ifdef LIBART_COMPILATION +#include "art_uta.h" +#include "art_vpath.h" +#else +#include "art_uta.h" +#include "art_vpath.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtUta * +art_uta_from_vpath (const ArtVpath *vec); + +/* This is a private function: */ +void +art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1, + int *rbuf, int rbuf_rowstride); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_UTA_VPATH_H__ */ + diff --git a/lib/art/art_vpath.h b/lib/art/art_vpath.h new file mode 100644 index 0000000..5849b54 --- /dev/null +++ b/lib/art/art_vpath.h @@ -0,0 +1,71 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_VPATH_H__ +#define __ART_VPATH_H__ + +#ifdef LIBART_COMPILATION +#include "art_rect.h" +#include "art_pathcode.h" +#else +#include "art_rect.h" +#include "art_pathcode.h" +#endif + +/* Basic data structures and constructors for simple vector paths */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtVpath ArtVpath; + +/* CURVETO is not allowed! */ +struct _ArtVpath { + ArtPathcode code; + double x; + double y; +}; + +/* Some of the functions need to go into their own modules */ + +void +art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max, + ArtPathcode code, double x, double y); + +ArtVpath * +art_vpath_new_circle (double x, double y, double r); + +ArtVpath * +art_vpath_affine_transform (const ArtVpath *src, const double matrix[6]); + +void +art_vpath_bbox_drect (const ArtVpath *vec, ArtDRect *drect); + +void +art_vpath_bbox_irect (const ArtVpath *vec, ArtIRect *irect); + +ArtVpath * +art_vpath_perturb (ArtVpath *src); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_VPATH_H__ */ diff --git a/lib/art/art_vpath_bpath.h b/lib/art/art_vpath_bpath.h new file mode 100644 index 0000000..fbde70f --- /dev/null +++ b/lib/art/art_vpath_bpath.h @@ -0,0 +1,48 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_VPATH_BPATH_H__ +#define __ART_VPATH_BPATH_H__ + +#ifdef LIBART_COMPILATION +#include "art_bpath.h" +#include "art_vpath.h" +#else +#include "art_bpath.h" +#include "art_vpath.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtPoint *art_bezier_to_vec (double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3, + ArtPoint *p, + int level); + +ArtVpath *art_bez_path_to_vec (const ArtBpath *bez, double flatness); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_VPATH_BPATH_H__ */ diff --git a/lib/art/art_vpath_dash.h b/lib/art/art_vpath_dash.h new file mode 100644 index 0000000..e2bf0c3 --- /dev/null +++ b/lib/art/art_vpath_dash.h @@ -0,0 +1,50 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1999 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_VPATH_DASH_H__ +#define __ART_VPATH_DASH_H__ + +/* Apply a dash style to a vector path. */ + +#ifdef LIBART_COMPILATION +#include "art_vpath.h" +#else +#include "art_vpath.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ArtVpathDash ArtVpathDash; + +struct _ArtVpathDash { + double offset; + int n_dash; + double *dash; +}; + +ArtVpath * +art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_VPATH_DASH_H__ */ diff --git a/lib/art/art_vpath_svp.h b/lib/art/art_vpath_svp.h new file mode 100644 index 0000000..6a1a39d --- /dev/null +++ b/lib/art/art_vpath_svp.h @@ -0,0 +1,43 @@ +/* Libart_LGPL - library of basic graphic primitives + * Copyright (C) 1998 Raph Levien + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __ART_VPATH_SVP_H__ +#define __ART_VPATH_SVP_H__ + +/* "Unsort" a sorted vector path into an ordinary vector path. */ + +#ifdef LIBART_COMPILATION +#include "art_svp.h" +#include "art_vpath.h" +#else +#include "art_svp.h" +#include "art_vpath.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +ArtVpath *art_vpath_from_svp (const ArtSVP *svp); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ART_VPATH_SVP_H__ */ diff --git a/lib/art/config.h b/lib/art/config.h new file mode 100644 index 0000000..ae21de4 --- /dev/null +++ b/lib/art/config.h @@ -0,0 +1,3 @@ +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ diff --git a/lib/art/libart.h b/lib/art/libart.h new file mode 100644 index 0000000..d8ef08e --- /dev/null +++ b/lib/art/libart.h @@ -0,0 +1,39 @@ +#ifndef LIBART_H +#define LIBART_H 1 + +#include "art_affine.h" +#include "art_alphagamma.h" +#include "art_bpath.h" +#include "art_filterlevel.h" +#include "art_gray_svp.h" +#include "art_misc.h" +#include "art_pathcode.h" +#include "art_pixbuf.h" +#include "art_point.h" +#include "art_rect.h" +#include "art_rect_svp.h" +#include "art_rect_uta.h" +#include "art_rgb.h" +#include "art_rgb_affine.h" +#include "art_rgb_bitmap_affine.h" +#include "art_rgb_pixbuf_affine.h" +#include "art_rgb_rgba_affine.h" +#include "art_rgb_svp.h" +#include "art_svp.h" +#include "art_svp_ops.h" +#include "art_svp_point.h" +#include "art_svp_render_aa.h" +#include "art_svp_vpath.h" +#include "art_svp_vpath_stroke.h" +#include "art_svp_wind.h" +#include "art_uta.h" +#include "art_uta_ops.h" +#include "art_uta_rect.h" +#include "art_uta_svp.h" +#include "art_uta_vpath.h" +#include "art_vpath.h" +#include "art_vpath_bpath.h" +#include "art_vpath_dash.h" +#include "art_vpath_svp.h" + +#endif -- 1.7.10.4