Java Code Examples for master.flame.danmaku.danmaku.util.DanmakuUtils#fillText()
The following examples show how to use
master.flame.danmaku.danmaku.util.DanmakuUtils#fillText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QSDanmakuParser.java From QSVideoPlayer with Apache License 2.0 | 5 votes |
public BaseDanmaku buildDanmaku(String text, int type, long time, float size, int color) { item = mContext.mDanmakuFactory.createDanmaku(type, mContext); item.setTime(time); item.setTimer(getTimer()); DanmakuUtils.fillText(item, text);//支持换行 item.textSize = size * density; item.textColor = color; item.textShadowColor = textShadowColor; item.flags = mContext.mGlobalFlagValues; item.index = index++; return item; }
Example 2
Source File: BiliDanmukuParser.java From letv with Apache License 2.0 | 4 votes |
public void characters(char[] ch, int start, int length) { if (this.item != null) { DanmakuUtils.fillText(this.item, decodeXmlString(new String(ch, start, length))); BaseDanmaku baseDanmaku = this.item; int i = this.index; this.index = i + 1; baseDanmaku.index = i; String text = String.valueOf(this.item.text).trim(); if (this.item.getType() == 7) { if (text.startsWith("[")) { if (text.endsWith("]")) { int i2; String[] textArr = null; try { JSONArray jSONArray = new JSONArray(text); textArr = new String[jSONArray.length()]; for (i2 = 0; i2 < textArr.length; i2++) { textArr[i2] = jSONArray.getString(i2); } } catch (JSONException e) { e.printStackTrace(); } if (textArr == null || textArr.length < 5) { this.item = null; return; } this.item.text = textArr[4]; float beginX = Float.parseFloat(textArr[0]); float beginY = Float.parseFloat(textArr[1]); float endX = beginX; float endY = beginY; String[] alphaArr = textArr[2].split(NetworkUtils.DELIMITER_LINE); int beginAlpha = (int) (((float) AlphaValue.MAX) * Float.parseFloat(alphaArr[0])); int endAlpha = beginAlpha; if (alphaArr.length > 1) { endAlpha = (int) (((float) AlphaValue.MAX) * Float.parseFloat(alphaArr[1])); } long alphaDuraion = (long) (Float.parseFloat(textArr[3]) * 1000.0f); long translationDuration = alphaDuraion; long translationStartDelay = 0; float rotateY = 0.0f; float rotateZ = 0.0f; if (textArr.length >= 7) { rotateZ = Float.parseFloat(textArr[5]); rotateY = Float.parseFloat(textArr[6]); } if (textArr.length >= 11) { endX = Float.parseFloat(textArr[7]); endY = Float.parseFloat(textArr[8]); if (!"".equals(textArr[9])) { translationDuration = (long) Integer.parseInt(textArr[9]); } if (!"".equals(textArr[10])) { translationStartDelay = (long) Float.parseFloat(textArr[10]); } } this.item.duration = new Duration(alphaDuraion); this.item.rotationZ = rotateZ; this.item.rotationY = rotateY; BiliDanmukuParser.this.mContext.mDanmakuFactory.fillTranslationData(this.item, beginX, beginY, endX, endY, translationDuration, translationStartDelay, BiliDanmukuParser.this.mDispScaleX, BiliDanmukuParser.this.mDispScaleY); BiliDanmukuParser.this.mContext.mDanmakuFactory.fillAlphaData(this.item, beginAlpha, endAlpha, alphaDuraion); if (textArr.length >= 12 && !TextUtils.isEmpty(textArr[11]) && "true".equals(textArr[11])) { this.item.textShadowColor = 0; } if (textArr.length >= 13) { } if (textArr.length >= 14) { } if (textArr.length >= 15 && !"".equals(textArr[14])) { String[] pointStrArray = textArr[14].substring(1).split("L"); if (pointStrArray != null && pointStrArray.length > 0) { float[][] points = (float[][]) Array.newInstance(Float.TYPE, new int[]{pointStrArray.length, 2}); for (i2 = 0; i2 < pointStrArray.length; i2++) { String[] pointArray = pointStrArray[i2].split(","); points[i2][0] = Float.parseFloat(pointArray[0]); points[i2][1] = Float.parseFloat(pointArray[1]); } DanmakuFactory.fillLinePathData(this.item, points, BiliDanmukuParser.this.mDispScaleX, BiliDanmukuParser.this.mDispScaleY); } } } } } } }
Example 3
Source File: Danmaku.java From letv with Apache License 2.0 | 4 votes |
public Danmaku(CharSequence text) { DanmakuUtils.fillText(this, text); }