20#include FT_INTERNAL_DEBUG_H
24#include FT_INTERNAL_OBJECTS_H
34#define FT_COMPONENT bitmap
74 FT_Int source_pitch_sign, target_pitch_sign;
78 return FT_THROW( Invalid_Library_Handle );
86 source_pitch_sign =
source->pitch < 0 ? -1 : 1;
87 target_pitch_sign =
target->pitch < 0 ? -1 : 1;
92 if ( source_pitch_sign != target_pitch_sign )
111 if ( target_pitch < 0 )
112 target_pitch = -target_pitch;
115 if ( target_size !=
size )
130 if ( source_pitch_sign == target_pitch_sign )
167 unsigned int new_pitch;
177 switch (
bitmap->pixel_mode )
181 new_pitch = (
width + xpixels + 7 ) >> 3;
185 new_pitch = (
width + xpixels + 3 ) >> 2;
189 new_pitch = (
width + xpixels + 1 ) >> 1;
195 new_pitch =
width + xpixels;
198 return FT_THROW( Invalid_Glyph_Format );
202 if ( ypixels == 0 && new_pitch <= pitch )
209 if ( bit_last < bit_width )
250 unsigned int delta = new_pitch -
len;
254 out += new_pitch * ypixels;
276 unsigned int delta = new_pitch -
len;
321 return FT_THROW( Invalid_Library_Handle );
324 return FT_THROW( Invalid_Argument );
328 return FT_THROW( Invalid_Argument );
333 if ( xstr == 0 && ystr == 0 )
335 else if ( xstr < 0 || ystr < 0 )
336 return FT_THROW( Invalid_Argument );
338 switch (
bitmap->pixel_mode )
383 p =
bitmap->buffer + pitch * ystr;
399 for (
x = pitch - 1;
x >= 0;
x-- )
405 for (
i = 1;
i <= xstr;
i++ )
413 p[
x] |=
p[
x - 1] << ( 8 -
i );
432 if (
p[
x] ==
bitmap->num_grays - 1 )
447 for (
x = 1;
x <= ystr;
x++ )
453 for (
i = 0;
i < pitch;
i++ )
492 l = ( 4732UL * bgra[0] * bgra[0] +
493 46871UL * bgra[1] * bgra[1] +
494 13933UL * bgra[2] * bgra[2] ) >> 16;
538 return FT_THROW( Invalid_Library_Handle );
541 return FT_THROW( Invalid_Argument );
545 switch (
source->pixel_mode )
555 FT_Int pad, old_target_pitch, target_pitch;
559 old_target_pitch =
target->pitch;
560 if ( old_target_pitch < 0 )
561 old_target_pitch = -old_target_pitch;
579 if ( target_pitch > 0 &&
581 return FT_THROW( Invalid_Argument );
587 target->pitch =
target->pitch < 0 ? -target_pitch : target_pitch;
604 switch (
source->pixel_mode )
621 for (
j =
source->width >> 3;
j > 0;
j-- )
628 tt[0] = (
FT_Byte)( (
val & 0x80 ) ? 0xff : 0);
629 tt[1] = (
FT_Byte)( (
val & 0x40 ) ? 0xff : 0);
630 tt[2] = (
FT_Byte)( (
val & 0x20 ) ? 0xff : 0);
631 tt[3] = (
FT_Byte)( (
val & 0x10 ) ? 0xff : 0);
632 tt[4] = (
FT_Byte)( (
val & 0x08 ) ? 0xff : 0);
633 tt[5] = (
FT_Byte)( (
val & 0x04 ) ? 0xff : 0);
634 tt[6] = (
FT_Byte)( (
val & 0x02 ) ? 0xff : 0);
635 tt[7] = (
FT_Byte)( (
val & 0x01 ) ? 0xff : 0);
667 tt[0] = (
FT_Byte)( (
val & 0x80 ) ? 0xff : 0);
719 for (
j =
source->width >> 2;
j > 0;
j-- )
769 for (
j =
source->width >> 1;
j > 0;
j-- )
782 tt[0] = (
FT_Byte)( (
ss[0] & 0xF0 ) >> 4 );
856 FT_Bool free_source_bitmap = 0;
857 FT_Bool free_target_bitmap_on_error = 0;
859 FT_Pos source_llx, source_lly, source_urx, source_ury;
860 FT_Pos target_llx, target_lly, target_urx, target_ury;
861 FT_Pos final_llx, final_lly, final_urx, final_ury;
863 unsigned int final_rows, final_width;
868 return FT_THROW( Invalid_Argument );
875 return FT_THROW( Invalid_Argument );
882 ( source_->pitch ^
target->pitch ) < 0 )
883 return FT_THROW( Invalid_Argument );
885 if ( !( source_->width && source_->rows ) )
895 source_llx = source_offset.
x;
899 "FT_Bitmap_Blend: y coordinate overflow in source bitmap\n" ));
900 return FT_THROW( Invalid_Argument );
902 source_lly = source_offset.
y - ( source_->rows << 6 );
907 "FT_Bitmap_Blend: x coordinate overflow in source bitmap\n" ));
908 return FT_THROW( Invalid_Argument );
910 source_urx = source_llx + ( source_->width << 6 );
911 source_ury = source_offset.
y;
916 target_llx = target_offset.
x;
920 "FT_Bitmap_Blend: y coordinate overflow in target bitmap\n" ));
921 return FT_THROW( Invalid_Argument );
923 target_lly = target_offset.
y - (
target->rows << 6 );
928 "FT_Bitmap_Blend: x coordinate overflow in target bitmap\n" ));
929 return FT_THROW( Invalid_Argument );
931 target_urx = target_llx + (
target->width << 6 );
932 target_ury = target_offset.
y;
943 final_llx =
FT_MIN( source_llx, target_llx );
944 final_lly =
FT_MIN( source_lly, target_lly );
945 final_urx =
FT_MAX( source_urx, target_urx );
946 final_ury =
FT_MAX( source_ury, target_ury );
948 final_width = ( final_urx - final_llx ) >> 6;
949 final_rows = ( final_ury - final_lly ) >> 6;
951#ifdef FT_DEBUG_LEVEL_TRACE
953 " source bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
954 source_llx / 64, source_lly / 64,
955 source_urx / 64, source_ury / 64,
956 source_->width, source_->rows ));
959 FT_TRACE5((
" target bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
960 target_llx / 64, target_lly / 64,
961 target_urx / 64, target_ury / 64,
964 FT_TRACE5((
" target bitmap: empty\n" ));
966 FT_TRACE5((
" final bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
967 final_llx / 64, final_lly / 64,
968 final_urx / 64, final_ury / 64,
969 final_width, final_rows ));
974 source_llx -= final_llx;
975 source_lly -= final_lly;
979 target_llx -= final_llx;
980 target_lly -= final_lly;
987 target->width = final_width;
988 target->rows = final_rows;
995 FT_TRACE5((
"FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
996 final_width, final_rows ));
997 return FT_THROW( Invalid_Argument );
1003 free_target_bitmap_on_error = 1;
1005 else if (
target->width != final_width ||
1006 target->rows != final_rows )
1009 int pitch, new_pitch;
1018 new_pitch = (
int)final_width * 4;
1022 FT_TRACE5((
"FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
1023 final_width, final_rows ));
1024 return FT_THROW( Invalid_Argument );
1033 x = target_llx >> 6;
1034 y = target_lly >> 6;
1048 ( final_rows -
y -
target->rows ) * new_pitch +
1050 unsigned char* limit_p =
1065 target->width = final_width;
1066 target->rows = final_rows;
1069 target->pitch = -new_pitch;
1071 target->pitch = new_pitch;
1085 free_source_bitmap = 1;
1092 x = source_llx >> 6;
1093 y = source_lly >> 6;
1109 unsigned char* limit_p =
1113 while (
p < limit_p )
1115 unsigned char*
r =
p;
1116 unsigned char*
s =
q;
1117 unsigned char* limit_r =
r +
source->width;
1120 while (
r < limit_r )
1123 int fa =
color.alpha * aa / 255;
1125 int fb =
color.blue *
fa / 255;
1126 int fg =
color.green *
fa / 255;
1127 int fr =
color.red *
fa / 255;
1137 *
s++ = (
unsigned char)( bb * ba2 / 255 + fb );
1138 *
s++ = (
unsigned char)( bg * ba2 / 255 + fg );
1139 *
s++ = (
unsigned char)( br * ba2 / 255 + fr );
1140 *
s++ = (
unsigned char)( ba * ba2 / 255 +
fa );
1148 atarget_offset->x = final_llx;
1149 atarget_offset->y = final_lly + ( final_rows << 6 );
1152 if (
error && free_target_bitmap_on_error )
1155 if ( free_source_bitmap )
1167 if (
slot &&
slot->format == FT_GLYPH_FORMAT_BITMAP &&
1197 return FT_THROW( Invalid_Library_Handle );
1200 return FT_THROW( Invalid_Argument );
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
FT_GlyphSlot_Own_Bitmap(FT_GlyphSlot slot)
FT_Bitmap_Convert(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target, FT_Int alignment)
FT_Bitmap_New(FT_Bitmap *abitmap)
FT_Bitmap_Done(FT_Library library, FT_Bitmap *bitmap)
static const FT_Bitmap null_bitmap
FT_Bitmap_Embolden(FT_Library library, FT_Bitmap *bitmap, FT_Pos xStrength, FT_Pos yStrength)
FT_Bitmap_Copy(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target)
FT_Bitmap_Blend(FT_Library library, const FT_Bitmap *source_, const FT_Vector source_offset_, FT_Bitmap *target, FT_Vector *atarget_offset, FT_Color color)
FT_Bitmap_Init(FT_Bitmap *abitmap)
static FT_Error ft_bitmap_assure_buffer(FT_Memory memory, FT_Bitmap *bitmap, FT_UInt xpixels, FT_UInt ypixels)
static FT_Byte ft_gray_for_premultiplied_srgb_bgra(const FT_Byte *bgra)
FT_BEGIN_HEADER struct FT_Color_ FT_Color
#define FT_TRACE5(varformat)
FT_BEGIN_HEADER typedef signed long FT_Pos
#define FT_QALLOC_MULT(ptr, count, item_size)
#define FT_QREALLOC(ptr, cursz, newsz)
#define FT_ALLOC(ptr, size)
#define FT_ARRAY_COPY(dest, source, count)
#define FT_QALLOC(ptr, size)
#define FT_MEM_COPY(dest, source, count)
#define FT_MEM_ZERO(dest, count)
#define FT_GLYPH_OWN_BITMAP
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLdouble GLdouble GLdouble GLdouble q
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static char memory[1024 *256]
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out