VideoShotEditActivity.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:letv 作者:
private boolean saveFileAddedVoice(String path, String voice, String savePath) {
    LogInfo.log("fornia", "voice:" + voice);
    if (!new File(path).exists()) {
        return false;
    }
    Options options = new Options();
    options.inJustDecodeBounds = false;
    Bitmap bitmap0 = BitmapFactory.decodeFile(path, options);
    int width = options.outWidth;
    int height = options.outHeight;
    Bitmap bitmapPic = Bitmap.createBitmap(width, height, Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmapPic);
    canvas.drawBitmap(bitmap0, null, new Rect(0, 0, width, height), null);
    Rect targetBgRect = new Rect(0, height - getTextBgHeight(), width, height);
    if (!isOrigPicMode) {
        Paint voiceBgPaint = new Paint();
        voiceBgPaint.setColor(getResources().getColor(2131493164));
        voiceBgPaint.setStyle(Style.FILL);
        voiceBgPaint.setFlags(2);
        canvas.drawRect(targetBgRect, voiceBgPaint);
        voiceBgPaint.setColor(-1);
        voiceBgPaint.setTextSize((float) getTextSize());
        voiceBgPaint.setTextAlign(Align.CENTER);
        FontMetricsInt fontMetrics = voiceBgPaint.getFontMetricsInt();
        String str = voice;
        canvas.drawText(str, (float) targetBgRect.centerX(), (float) ((targetBgRect.top + ((((targetBgRect.bottom - targetBgRect.top) - fontMetrics.bottom) + fontMetrics.top) / 2)) - fontMetrics.top), voiceBgPaint);
    }
    return FileUtils.saveBitmapByUser(this.mContext, bitmapPic);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号