ReactOS 0.4.15-dev-7924-g5949c20
ftrend1.c File Reference
#include <ft2build.h>
#include "ftrend1.h"
#include "ftraster.h"
#include "rastpic.h"
#include "rasterrs.h"
Include dependency graph for ftrend1.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static FT_Error ft_raster1_init (FT_Renderer render)
 
static FT_Error ft_raster1_set_mode (FT_Renderer render, FT_ULong mode_tag, FT_Pointer data)
 
static FT_Error ft_raster1_transform (FT_Renderer render, FT_GlyphSlot slot, const FT_Matrix *matrix, const FT_Vector *delta)
 
static void ft_raster1_get_cbox (FT_Renderer render, FT_GlyphSlot slot, FT_BBox *cbox)
 
static FT_Error ft_raster1_render (FT_Renderer render, FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
 

Function Documentation

◆ ft_raster1_get_cbox()

static void ft_raster1_get_cbox ( FT_Renderer  render,
FT_GlyphSlot  slot,
FT_BBox cbox 
)
static

Definition at line 82 of file ftrend1.c.

85 {
86 FT_ZERO( cbox );
87
88 if ( slot->format == render->glyph_format )
89 FT_Outline_Get_CBox( &slot->outline, cbox );
90 }
#define FT_ZERO(p)
Definition: ftmemory.h:237
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
Definition: ftoutln.c:478
static void render(void)
Definition: ssstars.c:272
Definition: vfat.h:185

◆ ft_raster1_init()

static FT_Error ft_raster1_init ( FT_Renderer  render)
static

Definition at line 32 of file ftrend1.c.

33 {
34 render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
35
36 return FT_Err_Ok;
37 }
#define NULL
Definition: types.h:112
return FT_Err_Ok
Definition: ftbbox.c:511

◆ ft_raster1_render()

static FT_Error ft_raster1_render ( FT_Renderer  render,
FT_GlyphSlot  slot,
FT_Render_Mode  mode,
const FT_Vector origin 
)
static

Definition at line 95 of file ftrend1.c.

99 {
101 FT_Outline* outline = &slot->outline;
102 FT_Bitmap* bitmap = &slot->bitmap;
103 FT_Memory memory = render->root.memory;
104 FT_Pos x_shift = 0;
105 FT_Pos y_shift = 0;
106
108
109
110 /* check glyph image format */
111 if ( slot->format != render->glyph_format )
112 {
113 error = FT_THROW( Invalid_Argument );
114 goto Exit;
115 }
116
117 /* check rendering mode */
118 if ( mode != FT_RENDER_MODE_MONO )
119 {
120 /* raster1 is only capable of producing monochrome bitmaps */
121 return FT_THROW( Cannot_Render_Glyph );
122 }
123
124 /* release old bitmap buffer */
125 if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
126 {
127 FT_FREE( bitmap->buffer );
128 slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
129 }
130
132
133 /* allocate new one */
134 if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
135 goto Exit;
136
137 slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
138
139 x_shift = -slot->bitmap_left * 64;
140 y_shift = ( (FT_Int)bitmap->rows - slot->bitmap_top ) * 64;
141
142 if ( origin )
143 {
144 x_shift += origin->x;
145 y_shift += origin->y;
146 }
147
148 /* translate outline to render it into the bitmap */
149 if ( x_shift || y_shift )
150 FT_Outline_Translate( outline, x_shift, y_shift );
151
152 /* set up parameters */
153 params.target = bitmap;
154 params.source = outline;
156
157 /* render outline into the bitmap */
158 error = render->raster_render( render->raster, &params );
159
160 Exit:
161 if ( !error )
162 /* everything is fine; the glyph is now officially a bitmap */
163 slot->format = FT_GLYPH_FORMAT_BITMAP;
164 else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
165 {
166 FT_FREE( bitmap->buffer );
167 slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
168 }
169
170 if ( x_shift || y_shift )
171 FT_Outline_Translate( outline, -x_shift, -y_shift );
172
173 return error;
174 }
@ FT_RENDER_MODE_MONO
Definition: freetype.h:3236
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_RASTER_FLAG_DEFAULT
Definition: ftimage.h:940
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
#define FT_ALLOC_MULT(ptr, count, item_size)
Definition: ftmemory.h:309
#define FT_FREE(ptr)
Definition: ftmemory.h:329
ft_glyphslot_preset_bitmap(FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
Definition: ftobjs.c:334
#define FT_GLYPH_OWN_BITMAP
Definition: ftobjs.h:463
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
int FT_Error
Definition: fttypes.h:300
signed int FT_Int
Definition: fttypes.h:220
GLenum mode
Definition: glext.h:6217
GLenum const GLfloat * params
Definition: glext.h:5645
voidpf uLong int origin
Definition: ioapi.h:144
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static void Exit(void)
Definition: sock.c:1330
Definition: uimain.c:89
Definition: mesh.c:5330

◆ ft_raster1_set_mode()

static FT_Error ft_raster1_set_mode ( FT_Renderer  render,
FT_ULong  mode_tag,
FT_Pointer  data 
)
static

Definition at line 42 of file ftrend1.c.

45 {
46 /* we simply pass it to the raster */
47 return render->clazz->raster_class->raster_set_mode( render->raster,
48 mode_tag,
49 data );
50 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ ft_raster1_transform()

static FT_Error ft_raster1_transform ( FT_Renderer  render,
FT_GlyphSlot  slot,
const FT_Matrix matrix,
const FT_Vector delta 
)
static

Definition at line 55 of file ftrend1.c.

59 {
61
62
63 if ( slot->format != render->glyph_format )
64 {
65 error = FT_THROW( Invalid_Argument );
66 goto Exit;
67 }
68
69 if ( matrix )
70 FT_Outline_Transform( &slot->outline, matrix );
71
72 if ( delta )
73 FT_Outline_Translate( &slot->outline, delta->x, delta->y );
74
75 Exit:
76 return error;
77 }
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
GLuint GLenum matrix
Definition: glext.h:9407
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77