tornavis/source/blender/blenfont/intern/blf_internal_types.h

252 lines
5.2 KiB
C
Raw Normal View History

/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
2010-02-12 14:34:04 +01:00
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation.
*
* ***** END GPL LICENSE BLOCK *****
*/
2011-02-27 21:42:42 +01:00
/** \file blender/blenfont/intern/blf_internal_types.h
* \ingroup blf
*/
#ifndef __BLF_INTERNAL_TYPES_H__
#define __BLF_INTERNAL_TYPES_H__
typedef struct GlyphCacheBLF {
struct GlyphCacheBLF *next;
struct GlyphCacheBLF *prev;
/* font size. */
unsigned int size;
/* and dpi. */
unsigned int dpi;
/* and the glyphs. */
ListBase bucket[257];
/* fast ascii lookup */
struct GlyphBLF *glyph_ascii_table[256];
/* texture array, to draw the glyphs. */
unsigned int *textures;
/* size of the array. */
unsigned int ntex;
/* and the last texture, aka. the current texture. */
unsigned int cur_tex;
/* like bftgl, we draw every glyph in a big texture, so this is the
* current position inside the texture.
*/
int x_offs;
int y_offs;
/* and the space from one to other. */
int pad;
/* and the bigger glyph in the font. */
int max_glyph_width;
int max_glyph_height;
/* next two integer power of two, to build the texture. */
int p2_width;
int p2_height;
/* number of glyphs in the font. */
int num_glyphs;
/* number of glyphs that we load here. */
int rem_glyphs;
/* ascender and descender value. */
float ascender;
float descender;
} GlyphCacheBLF;
typedef struct GlyphBLF {
struct GlyphBLF *next;
struct GlyphBLF *prev;
/* and the character, as UTF8 */
unsigned int c;
/* freetype2 index, to speed-up the search. */
FT_UInt idx;
/* glyph box. */
rctf box;
/* advance size. */
float advance;
/* avoid conversion to int while drawing */
int advance_i;
/* texture id where this glyph is store. */
unsigned int tex;
/* position inside the texture where this glyph is store. */
int xoff;
int yoff;
/* Bitmap data, from freetype. Take care that this
* can be NULL.
*/
unsigned char *bitmap;
/* glyph width and height. */
int width;
int height;
int pitch;
/* uv coords. */
float uv[2][2];
/* X and Y bearing of the glyph.
* The X bearing is from the origin to the glyph left bbox edge.
* The Y bearing is from the baseline to the top of the glyph edge.
*/
float pos_x;
float pos_y;
/* with value of zero mean that we need build the texture. */
short build_tex;
} GlyphBLF;
typedef struct FontBufInfoBLF {
/* for draw to buffer, always set this to NULL after finish! */
float *fbuf;
/* the same but unsigned char */
unsigned char *cbuf;
/* buffer size, keep signed so comparisons with negative values work */
int w;
int h;
/* number of channels. */
int ch;
Color Management, Stage 2: Switch color pipeline to use OpenColorIO Replace old color pipeline which was supporting linear/sRGB color spaces only with OpenColorIO-based pipeline. This introduces two configurable color spaces: - Input color space for images and movie clips. This space is used to convert images/movies from color space in which file is saved to Blender's linear space (for float images, byte images are not internally converted, only input space is stored for such images and used later). This setting could be found in image/clip data block settings. - Display color space which defines space in which particular display is working. This settings could be found in scene's Color Management panel. When render result is being displayed on the screen, apart from converting image to display space, some additional conversions could happen. This conversions are: - View, which defines tone curve applying before display transformation. These are different ways to view the image on the same display device. For example it could be used to emulate film view on sRGB display. - Exposure affects on image exposure before tone map is applied. - Gamma is post-display gamma correction, could be used to match particular display gamma. - RGB curves are user-defined curves which are applying before display transformation, could be used for different purposes. All this settings by default are only applying on render result and does not affect on other images. If some particular image needs to be affected by this transformation, "View as Render" setting of image data block should be set to truth. Movie clips are always affected by all display transformations. This commit also introduces configurable color space in which sequencer is working. This setting could be found in scene's Color Management panel and it should be used if such stuff as grading needs to be done in color space different from sRGB (i.e. when Film view on sRGB display is use, using VD16 space as sequencer's internal space would make grading working in space which is close to the space using for display). Some technical notes: - Image buffer's float buffer is now always in linear space, even if it was created from 16bit byte images. - Space of byte buffer is stored in image buffer's rect_colorspace property. - Profile of image buffer was removed since it's not longer meaningful. - OpenGL and GLSL is supposed to always work in sRGB space. It is possible to support other spaces, but it's quite large project which isn't so much important. - Legacy Color Management option disabled is emulated by using None display. It could have some regressions, but there's no clear way to avoid them. - If OpenColorIO is disabled on build time, it should make blender behaving in the same way as previous release with color management enabled. More details could be found at this page (more details would be added soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management -- Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO integration and to Brecht van Lommel for some further development and code/ usecase review!
2012-09-15 12:05:07 +02:00
/* display device used for color management */
struct ColorManagedDisplay *display;
/* and the color, the alphas is get from the glyph!
* color is srgb space */
float col_init[4];
/* cached conversion from 'col_init' */
unsigned char col_char[4];
float col_float[4];
} FontBufInfoBLF;
typedef struct FontBLF {
2009-02-12 06:02:42 +01:00
/* font name. */
char *name;
2009-02-12 06:02:42 +01:00
/* filename or NULL. */
char *filename;
/* aspect ratio or scale. */
float aspect[3];
/* initial position for draw the text. */
float pos[3];
2013-02-21 18:15:19 +01:00
/* angle in radians. */
float angle;
#if BLF_BLUR_ENABLE
/* blur: 3 or 5 large kernel */
int blur;
#endif
/* shadow level. */
int shadow;
/* and shadow offset. */
int shadow_x;
int shadow_y;
/* shadow color. */
unsigned char shadow_color[4];
/* main text color. */
unsigned char color[4];
/* Multiplied this matrix with the current one before
* draw the text! see blf_draw__start.
*/
float m[16];
/* clipping rectangle. */
rctf clip_rec;
/* the width to wrap the text, see BLF_WORD_WRAP */
int wrap_width;
/* font dpi (default 72). */
unsigned int dpi;
/* font size. */
unsigned int size;
/* max texture size. */
int max_tex_size;
/* cache current OpenGL texture to save calls into the API */
unsigned int tex_bind_state;
/* font options. */
int flags;
/* list of glyph cache for this font. */
ListBase cache;
/* current glyph cache, size and dpi. */
GlyphCacheBLF *glyph_cache;
/* freetype2 lib handle. */
FT_Library ft_lib;
/* Mutex lock for library */
SpinLock *ft_lib_mutex;
/* freetype2 face. */
FT_Face face;
/* data for buffer usage (drawing into a texture buffer) */
FontBufInfoBLF buf_info;
} FontBLF;
typedef struct DirBLF {
struct DirBLF *next;
struct DirBLF *prev;
/* full path where search fonts. */
char *path;
} DirBLF;
#define BLF_CURTEX_UNSET ((unsigned int)-1)
#endif /* __BLF_INTERNAL_TYPES_H__ */