freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: [Devel] bitmap rendering


From: Peter Sakhno
Subject: Re[2]: [Devel] bitmap rendering
Date: Tue, 20 Feb 2001 13:41:55 +0300

hi, Achim!

i had the same problem under Windows. the fact is that for Win
scanline in bitmaps should be aligned by WORD and in DIBs by DWORD.
after manually creating aligned in such way bitmaps the problem was
solved.

here is a piece of code i use to prepare bitmaps:
...
  FT_BitmapGlyph  glf_bmp=(FT_BitmapGlyph)image;
  FT_Bitmap*      bmp=&(glf_bmp->bitmap);
  // recalculate WORD aligned size of scan line in bytes
  int             pitch=(bmp->pitch+1)/2*2;
  // allocate and init memory
  unsigned char*  pBits=(unsigned char*)::malloc(pitch*bmp->rows);
  if(!pBits)
    return; // panic here
  ::memset(pBits,0,pitch*bmp->rows);
  // copy bitmap
  for(int r=0;r<bmp->rows;r++)
    ::memcpy((pBits)+(pitch*r),bmp->buffer+(bmp->pitch*r),bmp->pitch);
  // draw ...
...

______________________________________________________________
Best regards,
 Peter Sakhno                          mailto:address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]