当前位置: 首页>>代码示例>>Java>>正文


Java Bitmaps类代码示例

本文整理汇总了Java中org.telegram.messenger.Bitmaps的典型用法代码示例。如果您正苦于以下问题:Java Bitmaps类的具体用法?Java Bitmaps怎么用?Java Bitmaps使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Bitmaps类属于org.telegram.messenger包,在下文中一共展示了Bitmaps类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateTextureImageView

import org.telegram.messenger.Bitmaps; //导入依赖的package包/类
public void updateTextureImageView() {
    if (textureImageView == null) {
        return;
    }
    try {
        currentBitmap = Bitmaps.createBitmap(textureView.getWidth(), textureView.getHeight(), Bitmap.Config.ARGB_8888);
        changedTextureView.getBitmap(currentBitmap);
    } catch (Throwable e) {
        if (currentBitmap != null) {
            currentBitmap.recycle();
            currentBitmap = null;
        }
        FileLog.e(e);
    }
    if (currentBitmap != null) {
        textureImageView.setVisibility(VISIBLE);
        textureImageView.setImageBitmap(currentBitmap);
    } else {
        textureImageView.setImageDrawable(null);
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:22,代码来源:WebPlayerView.java

示例2: getBitmap

import org.telegram.messenger.Bitmaps; //导入依赖的package包/类
public Bitmap getBitmap() {
    float percX = (rectX - bitmapX) / bitmapWidth;
    float percY = (rectY - bitmapY) / bitmapHeight;
    float percSizeX = rectSizeX / bitmapWidth;
    float percSizeY = rectSizeY / bitmapWidth;
    int x = (int)(percX * imageToCrop.getWidth());
    int y = (int)(percY * imageToCrop.getHeight());
    int sizeX = (int)(percSizeX * imageToCrop.getWidth());
    int sizeY = (int)(percSizeY * imageToCrop.getWidth());
    if (x < 0) {
        x = 0;
    }
    if (y < 0) {
        y = 0;
    }
    if (x + sizeX > imageToCrop.getWidth()) {
        sizeX = imageToCrop.getWidth() - x;
    }
    if (y + sizeY > imageToCrop.getHeight()) {
        sizeY = imageToCrop.getHeight() - y;
    }
    try {
        return Bitmaps.createBitmap(imageToCrop, x, y, sizeX, sizeY);
    } catch (Throwable e) {
        FileLog.e("tmessags", e);
        System.gc();
        try {
            return Bitmaps.createBitmap(imageToCrop, x, y, sizeX, sizeY);
        } catch (Throwable e2) {
            FileLog.e("tmessages", e2);
        }
    }
    return null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:35,代码来源:PhotoCropActivity.java

示例3: getBitmap

import org.telegram.messenger.Bitmaps; //导入依赖的package包/类
public Bitmap getBitmap() {
    Bitmap bitmap = renderView.getResultBitmap();
    if (bitmap != null && entitiesView.entitiesCount() > 0) {
        Canvas canvas = new Canvas(bitmap);

        for (int i = 0; i < entitiesView.getChildCount(); i++) {
            View v = entitiesView.getChildAt(i);
            canvas.save();
            if (v instanceof EntityView) {
                EntityView entity = (EntityView) v;

                canvas.translate(entity.getPosition().x, entity.getPosition().y);
                canvas.scale(v.getScaleX(), v.getScaleY());
                canvas.rotate(v.getRotation());
                canvas.translate(-entity.getWidth() / 2, -entity.getHeight() / 2);

                if (v instanceof TextPaintView) {
                    Bitmap b = Bitmaps.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
                    Canvas c = new Canvas(b);
                    v.draw(c);
                    canvas.drawBitmap(b, null, new Rect(0, 0, b.getWidth(), b.getHeight()), null);
                    try {
                        c.setBitmap(null);
                    } catch (Exception e) {
                        FileLog.e("tmessages", e);
                    }
                    b.recycle();
                } else {
                    v.draw(canvas);
                }
            }
            canvas.restore();
        }
    }
    return bitmap;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:37,代码来源:PhotoPaintView.java

示例4: getBitmap

import org.telegram.messenger.Bitmaps; //导入依赖的package包/类
public Bitmap getBitmap() {
    float percX = (rectX - bitmapX) / bitmapWidth;
    float percY = (rectY - bitmapY) / bitmapHeight;
    float percSizeX = rectSizeX / bitmapWidth;
    float percSizeY = rectSizeY / bitmapWidth;
    int x = (int)(percX * imageToCrop.getWidth());
    int y = (int)(percY * imageToCrop.getHeight());
    int sizeX = (int)(percSizeX * imageToCrop.getWidth());
    int sizeY = (int)(percSizeY * imageToCrop.getWidth());
    if (x < 0) {
        x = 0;
    }
    if (y < 0) {
        y = 0;
    }
    if (x + sizeX > imageToCrop.getWidth()) {
        sizeX = imageToCrop.getWidth() - x;
    }
    if (y + sizeY > imageToCrop.getHeight()) {
        sizeY = imageToCrop.getHeight() - y;
    }
    try {
        return Bitmaps.createBitmap(imageToCrop, x, y, sizeX, sizeY);
    } catch (Throwable e) {
        FileLog.e("tmessags", e);
        System.gc();
        try {
            return Bitmaps.createBitmap(imageToCrop, x, y, sizeX, sizeY);
        } catch (Throwable e2) {
            FileLog.e(e2);
        }
    }
    return null;
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:35,代码来源:PhotoCropActivity.java

示例5: getBitmap

import org.telegram.messenger.Bitmaps; //导入依赖的package包/类
public Bitmap getBitmap() {
    Bitmap bitmap = renderView.getResultBitmap();
    if (bitmap != null && entitiesView.entitiesCount() > 0) {
        android.graphics.Canvas canvas = new android.graphics.Canvas(bitmap);

        for (int i = 0; i < entitiesView.getChildCount(); i++) {
            View v = entitiesView.getChildAt(i);
            canvas.save();
            if (v instanceof EntityView) {
                EntityView entity = (EntityView) v;

                canvas.translate(entity.getPosition().x, entity.getPosition().y);
                canvas.scale(v.getScaleX(), v.getScaleY());
                canvas.rotate(v.getRotation());
                canvas.translate(-entity.getWidth() / 2, -entity.getHeight() / 2);

                if (v instanceof TextPaintView) {
                    Bitmap b = Bitmaps.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
                    Canvas c = new Canvas(b);
                    v.draw(c);
                    canvas.drawBitmap(b, null, new Rect(0, 0, b.getWidth(), b.getHeight()), null);
                    try {
                        c.setBitmap(null);
                    } catch (Exception e) {
                        FileLog.e(e);
                    }
                    b.recycle();
                } else {
                    v.draw(canvas);
                }
            }
            canvas.restore();
        }
    }
    return bitmap;
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:37,代码来源:PhotoPaintView.java

示例6: run

import org.telegram.messenger.Bitmaps; //导入依赖的package包/类
@Override
public void run() {
    switchingInlineMode = false;
    if (currentBitmap != null) {
        currentBitmap.recycle();
        currentBitmap = null;
    }

    changingTextureView = true;
    if (textureImageView != null) {
        try {
            currentBitmap = Bitmaps.createBitmap(textureView.getWidth(), textureView.getHeight(), Bitmap.Config.ARGB_8888);
            textureView.getBitmap(currentBitmap);
        } catch (Throwable e) {
            if (currentBitmap != null) {
                currentBitmap.recycle();
                currentBitmap = null;
            }
            FileLog.e(e);
        }

        if (currentBitmap != null) {
            textureImageView.setVisibility(VISIBLE);
            textureImageView.setImageBitmap(currentBitmap);
        } else {
            textureImageView.setImageDrawable(null);
        }
    }

    isInline = true;
    updatePlayButton();
    updateShareButton();
    updateFullscreenButton();
    updateInlineButton();

    ViewGroup viewGroup = (ViewGroup) controlsView.getParent();
    if (viewGroup != null) {
        viewGroup.removeView(controlsView);
    }
    changedTextureView = delegate.onSwitchInlineMode(controlsView, isInline, aspectRatioFrameLayout.getAspectRatio(), aspectRatioFrameLayout.getVideoRotation(), allowInlineAnimation);
    changedTextureView.setVisibility(INVISIBLE);
    ViewGroup parent = (ViewGroup) textureView.getParent();
    if (parent != null) {
        parent.removeView(textureView);
    }
    controlsView.show(false, false);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:48,代码来源:WebPlayerView.java


注:本文中的org.telegram.messenger.Bitmaps类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。