相关疑难解决方法(0)

System :: Drawing :: Bitmap的unsigned char*buffer

我正在尝试创建一个工具/资产转换器,使用FreeType2引擎将字体光栅化为XNA游戏的纹理页面.

下面,第一个图像是FreeType2] 1引擎的直接输出.第二个图像是尝试将其转换为a后的结果System::Drawing::Bitmap.

目标http://www.freeimagehosting.net/uploads/fb102ee6da.jpg currentresult http://www.freeimagehosting.net/uploads/9ea77fa307.jpg

任何关于这里发生的事情的提示/提示/想法将不胜感激.链接到解释字节布局和像素格式的文章也会有所帮助.

  FT_Bitmap *bitmap = &face->glyph->bitmap;

  int width = (face->bitmap->metrics.width / 64);
  int height = (face->bitmap->metrics.height / 64);

  // must be aligned on a 32 bit boundary or 4 bytes
  int depth = 8;
  int stride = ((width * depth + 31) & ~31) >> 3;
  int bytes = (int)(stride * height);

  // as *.bmp
  array<Byte>^ values = gcnew array<Byte>(bytes);  
  Marshal::Copy((IntPtr)glyph->buffer, values, 0, bytes);

  Bitmap^ systemBitmap = gcnew Bitmap(width, height, …
Run Code Online (Sandbox Code Playgroud)

c++-cli freetype freetype2 visual-c++

4
推荐指数
1
解决办法
6219
查看次数

标签 统计

c++-cli ×1

freetype ×1

freetype2 ×1

visual-c++ ×1