22 #include FT_INTERNAL_OBJECTS_H
47 FT_Int pitch = source->pitch;
51 if ( source == target )
54 if ( source->buffer ==
NULL )
63 size = (
FT_ULong)( pitch * source->rows );
67 FT_Int target_pitch = target->pitch;
71 if ( target_pitch < 0 )
72 target_pitch = -target_pitch;
73 target_size = (
FT_ULong)( target_pitch * target->rows );
75 if ( target_size != size )
90 FT_MEM_COPY( target->buffer, source->buffer, size );
111 width = bitmap->
width;
112 height = bitmap->
rows;
113 pitch = bitmap->
pitch;
121 new_pitch = ( width + xpixels + 7 ) >> 3;
125 new_pitch = ( width + xpixels + 3 ) >> 2;
129 new_pitch = ( width + xpixels + 1 ) >> 1;
135 new_pitch = ( width + xpixels );
138 return FT_Err_Invalid_Glyph_Format;
142 if ( ypixels == 0 && new_pitch <= pitch )
145 FT_Int bit_width = pitch * 8;
146 FT_Int bit_last = ( width + xpixels ) * bpp;
149 if ( bit_last < bit_width )
153 FT_Int shift = bit_last & 7;
158 for ( ; count > 0; count--, line += pitch, end += pitch )
165 write[0] = (
FT_Byte)( write[0] & mask );
179 if ( bitmap->
pitch > 0 )
184 for ( i = 0; i < bitmap->
rows; i++ )
193 for ( i = 0; i < bitmap->
rows; i++ )
195 bitmap->
buffer + pitch * i, len );
201 if ( bitmap->
pitch < 0 )
202 new_pitch = -new_pitch;
205 bitmap->
pitch = new_pitch;
226 return FT_Err_Invalid_Library_Handle;
228 if ( !bitmap || !bitmap->buffer )
238 if ( xstr == 0 && ystr == 0 )
240 else if ( xstr < 0 || ystr < 0 )
243 switch ( bitmap->pixel_mode )
253 align = ( bitmap->width + xstr + 3 ) / 4;
255 align = ( bitmap->width + xstr + 1 ) / 2;
286 pitch = bitmap->pitch;
288 p = bitmap->buffer + pitch * ystr;
292 p = bitmap->buffer + pitch * ( bitmap->rows - 1 );
296 for ( y = 0; y < bitmap->rows ; y++ )
304 for ( x = pitch - 1; x >= 0; x-- )
310 for ( i = 1; i <=
xstr; i++ )
318 p[
x] |= p[x - 1] << ( 8 -
i );
329 if ( p[x] + p[x - i] > bitmap->num_grays - 1 )
331 p[
x] = (
unsigned char)(bitmap->num_grays - 1);
336 p[
x] = (
unsigned char)(p[x] + p[x-i]);
337 if ( p[x] == bitmap->num_grays - 1 )
352 for ( x = 1; x <= ystr; x++ )
357 q = p - bitmap->pitch *
x;
358 for ( i = 0; i < pitch; i++ )
365 bitmap->width +=
xstr;
366 bitmap->rows += ystr;
385 return FT_Err_Invalid_Library_Handle;
387 memory = library->memory;
389 switch ( source->pixel_mode )
402 old_size = target->rows * target->pitch;
404 old_size = -old_size;
407 target->rows = source->rows;
408 target->width = source->width;
413 pad = source->width % alignment;
415 pad = alignment -
pad;
418 target->pitch = source->width +
pad;
420 if ( target->pitch > 0 &&
424 if ( target->rows * target->pitch > old_size &&
426 old_size, target->rows * target->pitch ) )
435 switch ( source->pixel_mode )
444 target->num_grays = 2;
446 for ( i = source->rows; i > 0; i-- )
454 for ( j = source->width >> 3; j > 0; j-- )
459 tt[0] = (
FT_Byte)( ( val & 0x80 ) >> 7 );
460 tt[1] = (
FT_Byte)( ( val & 0x40 ) >> 6 );
461 tt[2] = (
FT_Byte)( ( val & 0x20 ) >> 5 );
462 tt[3] = (
FT_Byte)( ( val & 0x10 ) >> 4 );
463 tt[4] = (
FT_Byte)( ( val & 0x08 ) >> 3 );
464 tt[5] = (
FT_Byte)( ( val & 0x04 ) >> 2 );
465 tt[6] = (
FT_Byte)( ( val & 0x02 ) >> 1 );
466 tt[7] = (
FT_Byte)( val & 0x01 );
473 j = source->width & 7;
481 tt[0] = (
FT_Byte)( ( val & 0x80 ) >> 7);
501 FT_Int s_pitch = source->pitch;
502 FT_Int t_pitch = target->pitch;
506 target->num_grays = 256;
508 for ( i = source->rows; i > 0; i-- )
526 target->num_grays = 4;
528 for ( i = source->rows; i > 0; i-- )
536 for ( j = source->width >> 2; j > 0; j-- )
541 tt[0] = (
FT_Byte)( ( val & 0xC0 ) >> 6 );
542 tt[1] = (
FT_Byte)( ( val & 0x30 ) >> 4 );
543 tt[2] = (
FT_Byte)( ( val & 0x0C ) >> 2 );
544 tt[3] = (
FT_Byte)( ( val & 0x03 ) );
550 j = source->width & 3;
558 tt[0] = (
FT_Byte)( ( val & 0xC0 ) >> 6 );
578 target->num_grays = 16;
580 for ( i = source->rows; i > 0; i-- )
588 for ( j = source->width >> 1; j > 0; j-- )
593 tt[0] = (
FT_Byte)( ( val & 0xF0 ) >> 4 );
594 tt[1] = (
FT_Byte)( ( val & 0x0F ) );
600 if ( source->width & 1 )
601 tt[0] = (
FT_Byte)( ( ss[0] & 0xF0 ) >> 4 );
623 if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
653 return FT_Err_Invalid_Library_Handle;
658 memory = library->memory;
static const FT_Bitmap null_bitmap
GLuint const GLfloat * val
FT_BEGIN_HEADER FT_Bitmap_New(FT_Bitmap *abitmap)
FT_BEGIN_HEADER typedef signed long FT_Pos
FT_Bitmap_Embolden(FT_Library library, FT_Bitmap *bitmap, FT_Pos xStrength, FT_Pos yStrength)
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
#define FT_MEM_ZERO(dest, count)
#define FT_ARRAY_COPY(dest, source, count)
return FT_Err_Invalid_Argument
#define FT_QALLOC(ptr, size)
EGLSurface EGLint EGLint EGLint EGLint height
FT_Bitmap_Done(FT_Library library, FT_Bitmap *bitmap)
#define FT_GLYPH_OWN_BITMAP
#define FT_QREALLOC(ptr, cursz, newsz)
EGLContext EGLenum target
FT_Bitmap_Convert(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target, FT_Int alignment)
FT_Bitmap_Copy(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target)
EGLContext EGLenum EGLClientBuffer buffer
FT_GlyphSlot_Own_Bitmap(FT_GlyphSlot slot)
#define FT_QALLOC_MULT(ptr, count, item_size)
static FT_Error ft_bitmap_assure_buffer(FT_Memory memory, FT_Bitmap *bitmap, FT_UInt xpixels, FT_UInt ypixels)
EGLSurface EGLint EGLint EGLint width
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
EGLSurface EGLint EGLint y
GLdouble GLdouble GLdouble GLdouble q
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
#define FT_MEM_COPY(dest, source, count)
GLsizei GLsizei GLchar * source