在BlackBerry上调整位图大小
我正在使用BlackBerry Support Forum线程调整应用程序中位图的大小。但是,使用该线程中的代码,我可以将位图从右向左缩小,从宽度360缩小到0,如何从左向右调整它的大小。使用以下方法:在BlackBerry上调整位图大小,blackberry,Blackberry,我正在使用BlackBerry Support Forum线程调整应用程序中位图的大小。但是,使用该线程中的代码,我可以将位图从右向左缩小,从宽度360缩小到0,如何从左向右调整它的大小。使用以下方法: int oolddWidth; int oolddHeight; int ddispplayWidth; int ddispplayHeight; EncodedImage eih1 = EncodedImage.getEncodedImageResource("add2.png");
int oolddWidth;
int oolddHeight;
int ddispplayWidth;
int ddispplayHeight;
EncodedImage eih1 = EncodedImage.getEncodedImageResource("add2.png");
oolddWidth = eih1.getWidth();
oolddHeight = eih1.getHeight();
ddispplayWidth = Display.getWidth()-40;
ddispplayHeight = 80;
int nnumeerator = net.rim.device.api.math.Fixed32.toFP(oolddWidth);
int ddenoominator = net.rim.device.api.math.Fixed32.toFP(ddispplayWidth);
int wwidtthScale = net.rim.device.api.math.Fixed32.div(nnumeerator, ddenoominator);
nnumeerator = net.rim.device.api.math.Fixed32.toFP(oolddHeight);
ddenoominator = net.rim.device.api.math.Fixed32.toFP(ddispplayHeight);
int hheighhtScale = net.rim.device.api.math.Fixed32.div(nnumeerator, ddenoominator);
EncodedImage newEih1 = eih1.scaleImage32(wwidtthScale, hheighhtScale);
final Bitmap header1 = newEih1.getBitmap();
重缩放在某个方向上对图像进行操作,但结果将是缩放图像-结果中不考虑从左到右或从右到左。你遇到了什么问题?嗨,Micheal,当我在方法resizeBitmapBitmap image中给出宽度,int width,int height为320时,它从右端减少了40个像素。我想从左边开始缩小。我该怎么做。我想你的意思是“裁剪”而不是“调整大小”,调整大小意味着你在增加或减少使用的像素数的同时保留图片的所有部分“裁剪”意味着您正在删除图片的大部分。可能是重复的