本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}