Package com.badlogic.gdx.graphics.g2d.freetype.FreeType

Examples of com.badlogic.gdx.graphics.g2d.freetype.FreeType.Bitmap


    }

    GlyphSlot slot = face.getGlyph();

    // Try to render to bitmap
    Bitmap bitmap;
    if (bitmapped) {
      bitmap = slot.getBitmap();
    } else if (!FreeType.renderGlyph(slot, FreeType.FT_RENDER_MODE_LIGHT)) {
      bitmap = null;
    } else {
      bitmap = slot.getBitmap();
    }

    GlyphMetrics metrics = slot.getMetrics();

    Glyph glyph = new Glyph();
    if (bitmap != null) {
      glyph.width = bitmap.getWidth();
      glyph.height = bitmap.getRows();
    } else {
      glyph.width = 0;
      glyph.height = 0;
    }
    glyph.xoffset = slot.getBitmapLeft();
View Full Code Here


        Gdx.app.log("FreeTypeFontGenerator", "Couldn't render char '" + c + "'");
        continue;
      }
      GlyphSlot slot = face.getGlyph();
      GlyphMetrics metrics = slot.getMetrics();
      Bitmap bitmap = slot.getBitmap();
      Pixmap pixmap = bitmap.getPixmap(Format.RGBA8888);
      Glyph glyph = new Glyph();
      glyph.id = (int)c;
      glyph.width = pixmap.getWidth();
      glyph.height = pixmap.getHeight();
      glyph.xoffset = slot.getBitmapLeft();
      glyph.yoffset = parameter.flip ? -slot.getBitmapTop() + (int)baseLine : -(glyph.height - slot.getBitmapTop())
        - (int)baseLine;
      glyph.xadvance = FreeType.toInt(metrics.getHoriAdvance());

      if (bitmapped) {
        pixmap.setColor(Color.CLEAR);
        pixmap.fill();
        ByteBuffer buf = bitmap.getBuffer();
        for (int h = 0; h < glyph.height; h++) {
          int idx = h * bitmap.getPitch();
          for (int w = 0; w < (glyph.width + glyph.xoffset); w++) {
            int bit = (buf.get(idx + (w / 8)) >>> (7 - (w % 8))) & 1;
            pixmap.drawPixel(w, h, ((bit == 1) ? Color.WHITE.toIntBits() : Color.CLEAR.toIntBits()));
          }
        }
View Full Code Here

    }

    GlyphSlot slot = face.getGlyph();
   
    // Try to render to bitmap
    Bitmap bitmap;
    if(bitmapped) {
      bitmap = slot.getBitmap();
    } else if (!FreeType.renderGlyph(slot, FreeType.FT_RENDER_MODE_LIGHT)) {
      bitmap = null;
    } else {
      bitmap = slot.getBitmap();
    }

    GlyphMetrics metrics = slot.getMetrics();

    Glyph glyph = new Glyph();
    if (bitmap != null) {
      glyph.width = bitmap.getWidth();
      glyph.height = bitmap.getRows();
    } else {
      glyph.width = 0;
      glyph.height = 0;
    }
    glyph.xoffset = slot.getBitmapLeft();
View Full Code Here

        Gdx.app.log("FreeTypeFontGenerator", "Couldn't render char '" + c + "'");
        continue;
      }
      GlyphSlot slot = face.getGlyph();
      GlyphMetrics metrics = slot.getMetrics();
      Bitmap bitmap = slot.getBitmap();
      Pixmap pixmap = bitmap.getPixmap(Format.RGBA8888);
      Glyph glyph = new Glyph();
      glyph.id = (int)c;
      glyph.width = pixmap.getWidth();
      glyph.height = pixmap.getHeight();
      glyph.xoffset = slot.getBitmapLeft();
      glyph.yoffset = flip ? -slot.getBitmapTop() + (int)baseLine : -(glyph.height - slot.getBitmapTop()) - (int)baseLine;
      glyph.xadvance = FreeType.toInt(metrics.getHoriAdvance());

      if(bitmapped)
      {
        pixmap.setColor(Color.CLEAR);
        pixmap.fill();
        ByteBuffer buf = bitmap.getBuffer();
        for(int h=0; h<glyph.height; h++)
        {
          int idx = h*bitmap.getPitch();
          for(int w=0; w<(glyph.width+glyph.xoffset); w++)
          {
            int bit = (buf.get(idx+(w/8)) >>> (7-(w%8))) & 1;
            pixmap.drawPixel(w, h, ((bit==1)? Color.WHITE.toIntBits() : Color.CLEAR.toIntBits()));
          }
View Full Code Here

    }

    GlyphSlot slot = face.getGlyph();

    // Try to render to bitmap
    Bitmap bitmap;
    if (bitmapped) {
      bitmap = slot.getBitmap();
    } else if (!FreeType.renderGlyph(slot, FreeType.FT_RENDER_MODE_LIGHT)) {
      bitmap = null;
    } else {
      bitmap = slot.getBitmap();
    }

    GlyphMetrics metrics = slot.getMetrics();

    Glyph glyph = new Glyph();
    if (bitmap != null) {
      glyph.width = bitmap.getWidth();
      glyph.height = bitmap.getRows();
    } else {
      glyph.width = 0;
      glyph.height = 0;
    }
    glyph.xoffset = slot.getBitmapLeft();
View Full Code Here

        Gdx.app.log("FreeTypeFontGenerator", "Couldn't render char '" + c + "'");
        continue;
      }
      GlyphSlot slot = face.getGlyph();
      GlyphMetrics metrics = slot.getMetrics();
      Bitmap bitmap = slot.getBitmap();
      Pixmap pixmap = bitmap.getPixmap(Format.RGBA8888);
      Glyph glyph = new Glyph();
      glyph.id = (int)c;
      glyph.width = pixmap.getWidth();
      glyph.height = pixmap.getHeight();
      glyph.xoffset = slot.getBitmapLeft();
      glyph.yoffset = parameter.flip ? -slot.getBitmapTop() + (int)baseLine : -(glyph.height - slot.getBitmapTop())
        - (int)baseLine;
      glyph.xadvance = FreeType.toInt(metrics.getHoriAdvance());

      if (bitmapped) {
        pixmap.setColor(Color.CLEAR);
        pixmap.fill();
        ByteBuffer buf = bitmap.getBuffer();
        for (int h = 0; h < glyph.height; h++) {
          int idx = h * bitmap.getPitch();
          for (int w = 0; w < (glyph.width + glyph.xoffset); w++) {
            int bit = (buf.get(idx + (w / 8)) >>> (7 - (w % 8))) & 1;
            pixmap.drawPixel(w, h, ((bit == 1) ? Color.WHITE.toIntBits() : Color.CLEAR.toIntBits()));
          }
        }
View Full Code Here

    }

    GlyphSlot slot = face.getGlyph();

    // Try to render to bitmap
    Bitmap bitmap;
    if (bitmapped) {
      bitmap = slot.getBitmap();
    } else if (!FreeType.renderGlyph(slot, FreeType.FT_RENDER_MODE_LIGHT)) {
      bitmap = null;
    } else {
      bitmap = slot.getBitmap();
    }

    GlyphMetrics metrics = slot.getMetrics();

    Glyph glyph = new Glyph();
    if (bitmap != null) {
      glyph.width = bitmap.getWidth();
      glyph.height = bitmap.getRows();
    } else {
      glyph.width = 0;
      glyph.height = 0;
    }
    glyph.xoffset = slot.getBitmapLeft();
View Full Code Here

        Gdx.app.log("FreeTypeFontGenerator", "Couldn't render char '" + c + "'");
        continue;
      }
      GlyphSlot slot = face.getGlyph();
      GlyphMetrics metrics = slot.getMetrics();
      Bitmap bitmap = slot.getBitmap();
      Pixmap pixmap = bitmap.getPixmap(Format.RGBA8888);
      Glyph glyph = new Glyph();
      glyph.id = (int)c;
      glyph.width = pixmap.getWidth();
      glyph.height = pixmap.getHeight();
      glyph.xoffset = slot.getBitmapLeft();
      glyph.yoffset = parameter.flip ? -slot.getBitmapTop() + (int)baseLine : -(glyph.height - slot.getBitmapTop())
        - (int)baseLine;
      glyph.xadvance = FreeType.toInt(metrics.getHoriAdvance());

      if (bitmapped) {
        pixmap.setColor(Color.CLEAR);
        pixmap.fill();
        ByteBuffer buf = bitmap.getBuffer();
        for (int h = 0; h < glyph.height; h++) {
          int idx = h * bitmap.getPitch();
          for (int w = 0; w < (glyph.width + glyph.xoffset); w++) {
            int bit = (buf.get(idx + (w / 8)) >>> (7 - (w % 8))) & 1;
            pixmap.drawPixel(w, h, ((bit == 1) ? Color.WHITE.toIntBits() : Color.CLEAR.toIntBits()));
          }
        }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.g2d.freetype.FreeType.Bitmap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.