20 #include FT_INTERNAL_DEBUG_H 24 #include FT_INTERNAL_OBJECTS_H 28 const FT_Bitmap null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 };
36 *abitmap = null_bitmap;
73 if ( target_pitch < 0 )
74 target_pitch = -target_pitch;
77 if ( target_size !=
size )
100 ft_bitmap_assure_buffer(
FT_Memory memory,
113 width = bitmap->
width;
114 height = bitmap->
rows;
115 pitch = bitmap->
pitch;
123 new_pitch = ( width + xpixels + 7 ) >> 3;
127 new_pitch = ( width + xpixels + 3 ) >> 2;
131 new_pitch = ( width + xpixels + 1 ) >> 1;
137 new_pitch = ( width + xpixels );
140 return FT_THROW( Invalid_Glyph_Format );
144 if ( ypixels == 0 && new_pitch <= pitch )
147 FT_Int bit_width = pitch * 8;
148 FT_Int bit_last = ( width + xpixels ) * bpp;
151 if ( bit_last < bit_width )
155 FT_Int shift = bit_last & 7;
160 for ( ; count > 0; count--, line += pitch, end += pitch )
167 write[0] = (
FT_Byte)( write[0] & mask );
181 if ( bitmap->
pitch > 0 )
186 for ( i = 0; i < bitmap->
rows; i++ )
195 for ( i = 0; i < bitmap->
rows; i++ )
197 bitmap->
buffer + pitch * i, len );
203 if ( bitmap->
pitch < 0 )
204 new_pitch = -new_pitch;
207 bitmap->
pitch = new_pitch;
228 return FT_THROW( Invalid_Library_Handle );
230 if ( !bitmap || !bitmap->
buffer )
231 return FT_THROW( Invalid_Argument );
235 return FT_THROW( Invalid_Argument );
240 if ( xstr == 0 && ystr == 0 )
242 else if ( xstr < 0 || ystr < 0 )
243 return FT_THROW( Invalid_Argument );
255 align = ( bitmap->
width + xstr + 3 ) / 4;
257 align = ( bitmap->
width + xstr + 1 ) / 2;
288 pitch = bitmap->
pitch;
290 p = bitmap->
buffer + pitch * ystr;
298 for (
y = 0;
y < bitmap->
rows ;
y++ )
306 for (
x = pitch - 1;
x >= 0;
x-- )
312 for (
i = 1;
i <= xstr;
i++ )
320 p[
x] |=
p[
x - 1] << ( 8 -
i );
338 p[
x] = (
unsigned char)(
p[
x] +
p[
x-
i]);
354 for (
x = 1;
x <= ystr;
x++ )
360 for (
i = 0;
i < pitch;
i++ )
367 bitmap->
width += xstr;
368 bitmap->
rows += ystr;
387 return FT_THROW( Invalid_Library_Handle );
391 switch (
source->pixel_mode )
406 old_size = -old_size;
415 pad =
source->width % alignment;
417 pad = alignment - pad;
424 return FT_THROW( Invalid_Argument );
437 switch (
source->pixel_mode )
448 for ( i =
source->rows; i > 0; i-- )
456 for ( j =
source->width >> 3; j > 0; j-- )
461 tt[0] = (
FT_Byte)( ( val & 0x80 ) >> 7 );
462 tt[1] = (
FT_Byte)( ( val & 0x40 ) >> 6 );
463 tt[2] = (
FT_Byte)( ( val & 0x20 ) >> 5 );
464 tt[3] = (
FT_Byte)( ( val & 0x10 ) >> 4 );
465 tt[4] = (
FT_Byte)( ( val & 0x08 ) >> 3 );
466 tt[5] = (
FT_Byte)( ( val & 0x04 ) >> 2 );
467 tt[6] = (
FT_Byte)( ( val & 0x02 ) >> 1 );
468 tt[7] = (
FT_Byte)( val & 0x01 );
483 tt[0] = (
FT_Byte)( ( val & 0x80 ) >> 7);
510 for ( i =
source->rows; i > 0; i-- )
530 for ( i =
source->rows; i > 0; i-- )
538 for ( j =
source->width >> 2; j > 0; j-- )
543 tt[0] = (
FT_Byte)( ( val & 0xC0 ) >> 6 );
544 tt[1] = (
FT_Byte)( ( val & 0x30 ) >> 4 );
545 tt[2] = (
FT_Byte)( ( val & 0x0C ) >> 2 );
546 tt[3] = (
FT_Byte)( ( val & 0x03 ) );
560 tt[0] = (
FT_Byte)( ( val & 0xC0 ) >> 6 );
582 for ( i =
source->rows; i > 0; i-- )
590 for ( j =
source->width >> 1; j > 0; j-- )
595 tt[0] = (
FT_Byte)( ( val & 0xF0 ) >> 4 );
596 tt[1] = (
FT_Byte)( ( val & 0x0F ) );
603 tt[0] = (
FT_Byte)( ( ss[0] & 0xF0 ) >> 4 );
625 if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
637 slot->bitmap = bitmap;
655 return FT_THROW( Invalid_Library_Handle );
658 return FT_THROW( Invalid_Argument );
663 *bitmap = null_bitmap;
GLint GLint GLsizei GLsizei height
FT_GlyphSlot_Own_Bitmap(FT_GlyphSlot slot)
FT_Bitmap_New(FT_Bitmap *abitmap)
FT_BEGIN_HEADER typedef signed long FT_Pos
int write(int fd, const char *buf, int nbytes)
#define FT_MEM_ZERO(dest, count)
GLint GLint GLint GLint GLint GLint y
#define FT_ARRAY_COPY(dest, source, count)
GLdouble GLdouble GLdouble GLdouble q
return FT_THROW(Missing_Property)
GLsizei GLsizei GLchar * source
GLint GLint GLsizei width
#define FT_QALLOC(ptr, size)
GLint GLint GLint GLint GLint x
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
#define FT_GLYPH_OWN_BITMAP
FT_Bitmap_Embolden(FT_Library library, FT_Bitmap *bitmap, FT_Pos xStrength, FT_Pos yStrength)
#define FT_QREALLOC(ptr, cursz, newsz)
#define FT_QALLOC_MULT(ptr, count, item_size)
FT_Bitmap_Copy(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target)
FT_Bitmap_Done(FT_Library library, FT_Bitmap *bitmap)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
GLuint GLuint GLsizei count
#define FT_MEM_COPY(dest, source, count)
FT_Bitmap_Convert(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target, FT_Int alignment)