Pixmap mainPixmap = mainBitmap.getPixmap(Format.RGBA8888, parameter.color, parameter.gamma); if (mainBitmap.getWidth() != 0 && mainBitmap.getRows() != 0) { int offsetX = 0, offsetY = 0; if (parameter.borderWidth > 0) { Pixmap borderPixmap = borderBitmap.getPixmap(Format.RGBA8888, parameter.borderColor, parameter.borderGamma); mainPixmap.setColor(Color.CLEAR); mainPixmap.fill(); ByteBuffer buf = mainBitmap.getBuffer(); int whiteIntBits = Color.WHITE.toIntBits(); int clearIntBits = Color.CLEAR.toIntBits(); for (int h = 0; h < glyph.height; h++) { int idx = h * mainBitmap.getPitch(); for (int w = 0; w < (glyph.width + glyph.xoffset); w++) { int bit = (buf.get(idx + (w / 8)) >>> (7 - (w % 8))) & 1;
public Pixmap getPixmap (Format format, Color color, float gamma) { int width = getWidth(), rows = getRows(); ByteBuffer src = getBuffer(); Pixmap pixmap; int pixelMode = getPixelMode(); int rowBytes = Math.abs(getPitch()); // We currently ignore negative pitch. if (color == Color.WHITE && pixelMode == FT_PIXEL_MODE_GRAY && rowBytes == width && gamma == 1) { pixmap = new Pixmap(width, rows, Format.Alpha);
Pixmap mainPixmap = mainBitmap.getPixmap(Format.RGBA8888, parameter.color, parameter.gamma); if (mainBitmap.getWidth() != 0 && mainBitmap.getRows() != 0) { int offsetX = 0, offsetY = 0; if (parameter.borderWidth > 0) { Pixmap borderPixmap = borderBitmap.getPixmap(Format.RGBA8888, parameter.borderColor, parameter.borderGamma); mainPixmap.setColor(Color.CLEAR); mainPixmap.fill(); ByteBuffer buf = mainBitmap.getBuffer(); int whiteIntBits = Color.WHITE.toIntBits(); int clearIntBits = Color.CLEAR.toIntBits(); for (int h = 0; h < glyph.height; h++) { int idx = h * mainBitmap.getPitch(); for (int w = 0; w < (glyph.width + glyph.xoffset); w++) { int bit = (buf.get(idx + (w / 8)) >>> (7 - (w % 8))) & 1;
public Pixmap getPixmap (Format format, Color color, float gamma) { int width = getWidth(), rows = getRows(); ByteBuffer src = getBuffer(); Pixmap pixmap; int pixelMode = getPixelMode(); int rowBytes = Math.abs(getPitch()); // We currently ignore negative pitch. if (color == Color.WHITE && pixelMode == FT_PIXEL_MODE_GRAY && rowBytes == width && gamma == 1) { pixmap = new Pixmap(width, rows, Format.Alpha);
protected Glyph generateGlyph(char ch) { GlyphAndBitmap gab = generator.generateGlyphAndBitmap(ch, fontSize, false); if (gab == null || gab.bitmap == null) return null; //modified by STH99 on 2017-6-10 Pixmap map = gab.bitmap.getPixmap(Format.RGBA8888, Color.WHITE, 1.0f); TextureRegion rg = null; if(Game.setting.newTextRender){ if(lazyBitmapFontTexture == null) lazyBitmapFontTexture = new LazyBitmapFontTexture(); rg = lazyBitmapFontTexture.draw(map); if(rg == null) rg = (lazyBitmapFontTexture = new LazyBitmapFontTexture()).draw(map); map.dispose(); font.getRegions().add(rg); }else{ rg = new TextureRegion(new Texture(map)); rg.getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); map.dispose(); font.getRegions().add(rg); } gab.glyph.page = page++; super.setGlyph(ch, gab.glyph); setGlyphRegion(gab.glyph, rg); return gab.glyph; }
private static native int getRows(long bitmap); /* return ((FT_Bitmap*)bitmap)->rows;
private static native int getPixelMode(long bitmap); /* return ((FT_Bitmap*)bitmap)->pixel_mode;
private static native int getPitch(long bitmap); /* return ((FT_Bitmap*)bitmap)->pitch;
private static native long getBitmap(long glyph); /* FT_BitmapGlyph glyph_bitmap = ((FT_BitmapGlyph)glyph);
private static native int getWidth(long bitmap); /* return ((FT_Bitmap*)bitmap)->width;
private static native int getNumGray(long bitmap); /* return ((FT_Bitmap*)bitmap)->num_grays;
private static native long getBitmap(long slot); /* FT_GlyphSlot glyph = ((FT_GlyphSlot)slot);
public ByteBuffer getBuffer() { if (getRows() == 0) // Issue #768 - CheckJNI frowns upon env->NewDirectByteBuffer with NULL buffer or capacity 0 // "JNI WARNING: invalid values for address (0x0) or capacity (0)" // FreeType sets FT_Bitmap::buffer to NULL when the bitmap is empty (e.g. for ' ') // JNICheck is on by default on emulators and might have a point anyway... // So let's avoid this and just return a dummy non-null non-zero buffer return BufferUtils.newByteBuffer(1); return getBuffer(address); }
Pixmap mainPixmap = mainBitmap.getPixmap(Format.RGBA8888, parameter.color, parameter.gamma); if (mainBitmap.getWidth() != 0 && mainBitmap.getRows() != 0) { int offsetX = 0, offsetY = 0; if (parameter.borderWidth > 0) { Pixmap borderPixmap = borderBitmap.getPixmap(Format.RGBA8888, parameter.borderColor, parameter.borderGamma); mainPixmap.setColor(Color.CLEAR); mainPixmap.fill(); ByteBuffer buf = mainBitmap.getBuffer(); int whiteIntBits = Color.WHITE.toIntBits(); int clearIntBits = Color.CLEAR.toIntBits(); for (int h = 0; h < glyph.height; h++) { int idx = h * mainBitmap.getPitch(); for (int w = 0; w < (glyph.width + glyph.xoffset); w++) { int bit = (buf.get(idx + (w / 8)) >>> (7 - (w % 8))) & 1;
public Pixmap getPixmap (Format format, Color color, float gamma) { int width = getWidth(), rows = getRows(); ByteBuffer src = getBuffer(); Pixmap pixmap; int pixelMode = getPixelMode(); int rowBytes = Math.abs(getPitch()); // We currently ignore negative pitch. if (color == Color.WHITE && pixelMode == FT_PIXEL_MODE_GRAY && rowBytes == width && gamma == 1) { pixmap = new Pixmap(width, rows, Format.Alpha);
private static native int getRows(long bitmap); /* return ((FT_Bitmap*)bitmap)->rows;
private static native int getRows(long bitmap); /* return ((FT_Bitmap*)bitmap)->rows;