lock xft, plugin index builder lock, clear clip thumbnails, clear vwin clock, setpoin...
[goodguy/history.git] / cinelerra-5.1 / guicast / workarounds.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef WORKAROUNDS_H
23 #define WORKAROUNDS_H
24
25 #include <stdint.h>
26
27 class Workarounds
28 {
29 public:
30         Workarounds() {};
31         ~Workarounds() {};
32
33         static void copy_int(int &a, int &b);
34         static void copy_double(double *a, double b);
35         static double divide_double(double a, double b);
36         static void clamp(int32_t &x, int32_t y, int32_t z);
37         static void clamp(int64_t &x, int64_t y, int64_t z);
38         static void clamp(float &x, float y, float z);
39         static void clamp(double &x, double y, double z);
40         static float pow(float x, float y);
41 };
42
43 #ifdef HAVE_XFT
44 // not thread safe
45
46 #include <X11/Xft/Xft.h>
47 #include "ft2build.h"
48 #include FT_GLYPH_H
49 #include FT_BBOX_H
50 #include FT_OUTLINE_H
51 #include FT_STROKER_H
52 #include <fontconfig/fontconfig.h>
53 #include <fontconfig/fcfreetype.h>
54
55 FcBool xftInitFtLibrary(void);
56 Bool xftDefaultHasRender(Display *dpy);
57 FcBool xftCharExists(Display *dpy, XftFont *pub, FcChar32 ucs4);
58 void xftTextExtents8(Display *dpy, XftFont *pub,
59                 _Xconst FcChar8 *string, int len, XGlyphInfo *extents);
60 void xftTextExtentsUtf8(Display *dpy, XftFont *pub,
61                 _Xconst FcChar8 *string, int len, XGlyphInfo *extents);
62 void xftTextExtents32(Display *dpy, XftFont *pub,
63                 _Xconst FcChar32 *string, int len, XGlyphInfo *extents);
64 XftDraw *xftDrawCreate(Display *dpy, Drawable drawable, Visual *visual,
65                 Colormap colormap);
66 XftDraw *xftDrawCreateBitmap(Display *dpy, Pixmap bitmap);
67 void xftDrawDestroy(XftDraw *draw);
68 void xftDrawString32(XftDraw *draw, _Xconst XftColor *color, XftFont *pub,
69                 int x, int y, _Xconst FcChar32 *string, int len);
70 Bool xftColorAllocValue(Display *dpy, Visual *visual,
71                 Colormap cmap, _Xconst XRenderColor *color, XftColor *result);
72 void xftColorFree(Display *dpy, Visual *visual, Colormap cmap, XftColor *color);
73 XftFont *xftFontOpenName(Display *dpy, int screen, _Xconst char *name);
74 XftFont *xftFontOpenXlfd(Display *dpy, int screen, _Xconst char *xlfd);
75 XftFont *xftFontOpenPattern(Display *dpy, FcPattern *pattern);
76 void xftFontClose(Display *dpy, XftFont *pub);
77
78 FT_Error ft_Done_Face(FT_Face face);
79 FT_Error ft_Done_FreeType(FT_Library library);
80 void ft_Done_Glyph(FT_Glyph glyph);
81 FT_UInt ft_Get_Char_Index(FT_Face face, FT_ULong charcode);
82 FT_Error ft_Get_Glyph(FT_GlyphSlot slot, FT_Glyph *aglyph);
83 FT_Error ft_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph,
84                 FT_UInt kern_mode, FT_Vector *akerning);
85 FT_Error ft_Init_FreeType(FT_Library *alibrary);
86 FT_Error ft_Load_Char(FT_Face face, FT_ULong char_code, FT_Int32 load_flags);
87 FT_Error ft_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags);
88 FT_Error ft_New_Face(FT_Library library, const char *filepathname, FT_Long face_index,
89                 FT_Face *aface);
90 FT_Error ft_Outline_Done(FT_Library library, FT_Outline *outline);
91 FT_Error ft_Outline_Get_BBox(FT_Outline *outline, FT_BBox *abbox);
92 FT_Error ft_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline,
93                 const FT_Bitmap *abitmap);
94 FT_Error ft_Outline_New(FT_Library library, FT_UInt numPoints, FT_Int numContours,
95                 FT_Outline *anoutline);
96 void ft_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset);
97 FT_Error ft_Select_Charmap(FT_Face face, FT_Encoding encoding);
98 FT_Error ft_Set_Pixel_Sizes(FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height);
99 void ft_Stroker_Done(FT_Stroker stroker);
100 void ft_Stroker_Export(FT_Stroker stroker, FT_Outline *outline);
101 FT_Error ft_Stroker_GetCounts(FT_Stroker stroker, FT_UInt *anum_points,
102                 FT_UInt *anum_contours);
103 FT_Error ft_Stroker_New(FT_Library library, FT_Stroker *astroker);
104 FT_Error ft_Stroker_ParseOutline(FT_Stroker stroker, FT_Outline *outline,
105                 FT_Bool opened);
106 void ft_Stroker_Set(FT_Stroker stroker, FT_Fixed radius, FT_Stroker_LineCap line_cap,
107                 FT_Stroker_LineJoin line_join, FT_Fixed miter_limit);
108
109 FcBool fcCharSetAddChar(FcCharSet *fcs, FcChar32 ucs4);
110 FcCharSet *fcCharSetCreate(void);
111 void fcCharSetDestroy(FcCharSet *fcs);
112 FcBool fcCharSetHasChar(const FcCharSet *fcs, FcChar32 ucs4);
113 FcBool fcConfigAppFontAddDir(FcConfig *config, const FcChar8 *dir);
114 FcConfig *fcConfigGetCurrent();
115 FcBool fcConfigSetRescanInterval(FcConfig *config, int rescanInterval);
116 FcFontSet *fcFontList(FcConfig *config, FcPattern *p, FcObjectSet *os);
117 void fcFontSetDestroy(FcFontSet *s);
118 FcPattern *fcFreeTypeQueryFace(const FT_Face face, const FcChar8 *file, unsigned int id,
119                 FcBlanks *blanks);
120 FcBool fcInit(void);
121 FcBool fcLangSetAdd(FcLangSet *ls, const FcChar8 *lang);
122 FcLangSet *fcLangSetCreate(void);
123 void fcLangSetDestroy(FcLangSet *ls);
124 FcObjectSet *fcObjectSetBuild(const char *first, ...);
125 void fcObjectSetDestroy(FcObjectSet *os);
126 FcBool fcPatternAddBool(FcPattern *p, const char *object, FcBool b);
127 FcBool fcPatternAddCharSet(FcPattern *p, const char *object, const FcCharSet *c);
128 FcBool fcPatternAddDouble(FcPattern *p, const char *object, double d);
129 FcBool fcPatternAddInteger(FcPattern *p, const char *object, int i);
130 FcBool fcPatternAddLangSet(FcPattern *p, const char *object, const FcLangSet *ls);
131 FcResult fcPatternGetInteger(const FcPattern *p, const char *object, int n, int *i);
132 FcResult fcPatternGetDouble(const FcPattern *p, const char *object, int n, double *d);
133 FcResult fcPatternGetString(const FcPattern *p, const char *object, int n, FcChar8 **s);
134 FcPattern *fcPatternCreate(void);
135 FcBool fcPatternDel(FcPattern *p, const char *object);
136 void fcPatternDestroy(FcPattern *p);
137 FcPattern *fcPatternDuplicate(const FcPattern *p);
138 FcResult fcPatternGetCharSet(const FcPattern *p, const char *object, int n,
139                 FcCharSet **c);
140 #endif
141 #endif