karbon

art_render_misc.h

00001 /* This file is part of the KDE project.
00002  * art_render_misc.c: Here I store some routines I feel should be in libart :)
00003  *
00004  * Copyright (C) 2002, The Karbon Developers
00005  *
00006  * This code is adapted from :
00007  *
00008  * art_render_gradient.h: Gradient image source for modular rendering.
00009  *
00010  * Libart_LGPL - library of basic graphic primitives
00011  * Copyright (C) 2000 Raph Levien
00012  *
00013  * This library is free software; you can redistribute it and/or
00014  * modify it under the terms of the GNU Library General Public
00015  * License as published by the Free Software Foundation; either
00016  * version 2 of the License, or (at your option) any later version.
00017  *
00018  * This library is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  * Library General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU Library General Public
00024  * License along with this library; if not, write to the
00025  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00026  * Boston, MA 02110-1301, USA.
00027  *
00028  * Authors: Raph Levien <raph@acm.org>
00029  *          Alexander Larsson <alla@lysator.liu.se>
00030  */
00031 
00032 #ifndef __ART_RENDER_MISC_H__
00033 #define __ART_RENDER_MISC_H__
00034 
00035 #ifdef LIBART_COMPILATION
00036 #include "art_filterlevel.h"
00037 #include "art_render.h"
00038 #else
00039 #include <libart_lgpl/art_filterlevel.h>
00040 #include <libart_lgpl/art_render.h>
00041 #endif
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif /* __cplusplus */
00046 
00047 typedef struct _ArtGradientLinear ArtGradientLinear;
00048 typedef struct _ArtGradientRadial ArtGradientRadial;
00049 typedef struct _ArtGradientConical ArtGradientConical;
00050 typedef struct _ArtGradientStop ArtGradientStop;
00051 
00052 typedef enum {
00053   ART_GRADIENT_PAD,
00054   ART_GRADIENT_REFLECT,
00055   ART_GRADIENT_REPEAT
00056 } ArtGradientSpread;
00057 
00058 struct _ArtGradientLinear {
00059   double a;
00060   double b;
00061   double c;
00062   ArtGradientSpread spread;
00063   int n_stops;
00064   ArtGradientStop *stops;
00065 };
00066 
00067 struct _ArtGradientRadial {
00068   double affine[6]; /* transforms user coordinates to unit circle */
00069   double fx, fy;    /* focal point in unit circle coords */
00070   int n_stops;
00071   ArtGradientSpread spread;
00072   ArtGradientStop *stops;
00073 };
00074 
00075 struct _ArtGradientConical {
00076     double cx, cy;    /* focal point in unit circle coords */
00077     double r;         /* focal point in unit circle coords */
00078     ArtGradientSpread spread;
00079     art_u8 *buf;
00080     int n_stops;
00081     ArtGradientStop *stops;
00082 };
00083 
00084 
00085 struct _ArtGradientStop {
00086   double offset;
00087   ArtPixMaxDepth color[ART_MAX_CHAN + 1];
00088 };
00089 
00090 void
00091 art_karbon_render_gradient_linear (ArtRender *render,
00092                 const ArtGradientLinear *gradient,
00093                 ArtFilterLevel level);
00094 
00095 void
00096 art_karbon_render_gradient_radial (ArtRender *render,
00097                 const ArtGradientRadial *gradient,
00098                 ArtFilterLevel level);
00099 
00100 void
00101 art_karbon_render_gradient_conical (ArtRender *render,
00102                   const ArtGradientConical *gradient,
00103                   ArtFilterLevel level);
00104 
00105 #ifdef __cplusplus
00106 }
00107 #endif /* __cplusplus */
00108 
00109 #endif /* __ART_RENDER_MISC_H__ */
KDE Home | KDE Accessibility Home | Description of Access Keys