/**
* @param formula
* the formula
* @param style
* the style
* @param size
* the size
* @param transparency
* , if true the background is transparent
* @return the generated image
*/
public Bitmap createBufferedImage(int style, float size, Integer fg,
Integer bg) throws ParseException {
TeXIcon icon = createTeXIcon(style, size);
icon.setInsets(new Insets(2, 2, 2, 2));
int w = icon.getIconWidth(), h = icon.getIconHeight();
Bitmap image = Bitmap.createBitmap(w, h, Config.ARGB_8888);
Canvas g2 = new Canvas(image);
if (bg != null) {
Paint st = new Paint();
st.setStyle(Style.FILL_AND_STROKE);
st.setColor(bg);
g2.drawRect(0, 0, w, h, st);
}
icon.setForeground(fg == null ? Color.BLACK : fg);
icon.paintIcon(g2, 0, 0);
return image;
}
TeXFormula.java 文件源码
java
阅读 46
收藏 0
点赞 0
评论 0
项目:FlexibleRichTextView
作者:
评论列表
文章目录