code:android-code:image-convert
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| code:android-code:image-convert [2010/06/04 16:41] – percy | code:android-code:image-convert [2016/05/05 13:07] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Android上图像处理-倒影, | ====== Android上图像处理-倒影, | ||
| + | |||
| Android对图片处理的函数应该是很多的, | Android对图片处理的函数应该是很多的, | ||
| + | |||
| + | |||
| 这次要用到的图像效果比较多, | 这次要用到的图像效果比较多, | ||
| + | |||
| + | |||
| 1.在android中2D中实现对图片的倒影: | 1.在android中2D中实现对图片的倒影: | ||
| + | |||
| + | |||
| http:// | http:// | ||
| + | |||
| + | |||
| 2.Android 中实现倒影效果 | 2.Android 中实现倒影效果 | ||
| + | |||
| + | |||
| http:// | http:// | ||
| + | |||
| + | |||
| 3.使用 2D 方法实现倒影特效 | 3.使用 2D 方法实现倒影特效 | ||
| + | |||
| + | |||
| http:// | http:// | ||
| + | |||
| + | |||
| 4.Android 图片透明度处理代码 | 4.Android 图片透明度处理代码 | ||
| + | |||
| + | |||
| http:// | http:// | ||
| + | |||
| + | |||
| + | 5.android图片处理方法 | ||
| + | |||
| + | http:// | ||
| 我将上面这些代码进行了整理, | 我将上面这些代码进行了整理, | ||
| + | |||
| + | |||
| 附目前效果图: | 附目前效果图: | ||
| + | |||
| + | |||
| {{: | {{: | ||
| + | |||
| + | |||
| + | |||
| <code java> | <code java> | ||
| + | |||
| public static Bitmap createReflectionImageWithOrigin(Bitmap originalImage) { | public static Bitmap createReflectionImageWithOrigin(Bitmap originalImage) { | ||
| + | |||
| // The gap we want between the reflection and the original image | // The gap we want between the reflection and the original image | ||
| + | |||
| final int reflectionGap = 4; | final int reflectionGap = 4; | ||
| + | |||
| + | |||
| // Get you bit map from drawable folder | // Get you bit map from drawable folder | ||
| + | |||
| // Bitmap originalImage = BitmapFactory.decodeResource(getResources(), | // Bitmap originalImage = BitmapFactory.decodeResource(getResources(), | ||
| + | |||
| // R.drawable.twitter_icon); | // R.drawable.twitter_icon); | ||
| + | |||
| + | |||
| int width = originalImage.getWidth(); | int width = originalImage.getWidth(); | ||
| + | |||
| int height = originalImage.getHeight(); | int height = originalImage.getHeight(); | ||
| + | |||
| + | |||
| // This will not scale but will flip on the Y axis | // This will not scale but will flip on the Y axis | ||
| + | |||
| Matrix matrix = new Matrix(); | Matrix matrix = new Matrix(); | ||
| + | |||
| matrix.preScale(1, | matrix.preScale(1, | ||
| + | |||
| + | |||
| // Create a Bitmap with the flip matix applied to it. | // Create a Bitmap with the flip matix applied to it. | ||
| + | |||
| // We only want the bottom half of the image | // We only want the bottom half of the image | ||
| + | |||
| Bitmap reflectionImage = Bitmap.createBitmap(originalImage, | Bitmap reflectionImage = Bitmap.createBitmap(originalImage, | ||
| + | |||
| height / 2, width, height / 2, matrix, false); | height / 2, width, height / 2, matrix, false); | ||
| + | |||
| + | |||
| // Create a new bitmap with same width but taller to fit reflection | // Create a new bitmap with same width but taller to fit reflection | ||
| + | |||
| Bitmap bitmapWithReflection = Bitmap.createBitmap(width, | Bitmap bitmapWithReflection = Bitmap.createBitmap(width, | ||
| + | |||
| (height + height / 2), Config.ARGB_8888); | (height + height / 2), Config.ARGB_8888); | ||
| + | |||
| + | |||
| // Create a new Canvas with the bitmap that's big enough for | // Create a new Canvas with the bitmap that's big enough for | ||
| + | |||
| // the image plus gap plus reflection | // the image plus gap plus reflection | ||
| + | |||
| Canvas canvas = new Canvas(bitmapWithReflection); | Canvas canvas = new Canvas(bitmapWithReflection); | ||
| + | |||
| // Draw in the original image | // Draw in the original image | ||
| + | |||
| canvas.drawBitmap(originalImage, | canvas.drawBitmap(originalImage, | ||
| + | |||
| // Draw in the gap | // Draw in the gap | ||
| + | |||
| Paint deafaultPaint = new Paint(); | Paint deafaultPaint = new Paint(); | ||
| + | |||
| canvas | canvas | ||
| + | |||
| .drawRect(0, | .drawRect(0, | ||
| + | |||
| deafaultPaint); | deafaultPaint); | ||
| + | |||
| // Draw in the reflection | // Draw in the reflection | ||
| + | |||
| canvas.drawBitmap(reflectionImage, | canvas.drawBitmap(reflectionImage, | ||
| + | |||
| + | |||
| // Create a shader that is a linear gradient that covers the reflection | // Create a shader that is a linear gradient that covers the reflection | ||
| + | |||
| Paint paint = new Paint(); | Paint paint = new Paint(); | ||
| + | |||
| LinearGradient shader = new LinearGradient(0, | LinearGradient shader = new LinearGradient(0, | ||
| + | |||
| originalImage.getHeight(), | originalImage.getHeight(), | ||
| + | |||
| + reflectionGap, | + reflectionGap, | ||
| + | |||
| // Set the paint to use this shader (linear gradient) | // Set the paint to use this shader (linear gradient) | ||
| + | |||
| paint.setShader(shader); | paint.setShader(shader); | ||
| + | |||
| // Set the Transfer mode to be porter duff and destination in | // Set the Transfer mode to be porter duff and destination in | ||
| + | |||
| paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); | paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); | ||
| + | |||
| // Draw a rectangle using the paint with our linear gradient | // Draw a rectangle using the paint with our linear gradient | ||
| + | |||
| canvas.drawRect(0, | canvas.drawRect(0, | ||
| + | |||
| + reflectionGap, | + reflectionGap, | ||
| + | |||
| + | |||
| return bitmapWithReflection; | return bitmapWithReflection; | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| public static Bitmap createReflectionImageWithNoOrigin(Bitmap originalImage) { | public static Bitmap createReflectionImageWithNoOrigin(Bitmap originalImage) { | ||
| + | |||
| // The gap we want between the reflection and the original image | // The gap we want between the reflection and the original image | ||
| + | |||
| final int reflectionGap = 4; | final int reflectionGap = 4; | ||
| + | |||
| + | |||
| // Get you bit map from drawable folder | // Get you bit map from drawable folder | ||
| + | |||
| // Bitmap originalImage = BitmapFactory.decodeResource(getResources(), | // Bitmap originalImage = BitmapFactory.decodeResource(getResources(), | ||
| + | |||
| // R.drawable.twitter_icon); | // R.drawable.twitter_icon); | ||
| + | |||
| + | |||
| int width = originalImage.getWidth(); | int width = originalImage.getWidth(); | ||
| + | |||
| int height = originalImage.getHeight(); | int height = originalImage.getHeight(); | ||
| + | |||
| + | |||
| // This will not scale but will flip on the Y axis | // This will not scale but will flip on the Y axis | ||
| + | |||
| Matrix matrix = new Matrix(); | Matrix matrix = new Matrix(); | ||
| + | |||
| matrix.preScale(1, | matrix.preScale(1, | ||
| + | |||
| + | |||
| // Create a Bitmap with the flip matix applied to it. | // Create a Bitmap with the flip matix applied to it. | ||
| + | |||
| // We only want the bottom half of the image | // We only want the bottom half of the image | ||
| + | |||
| int divider = 8; | int divider = 8; | ||
| + | |||
| + | |||
| Bitmap reflectionImage = Bitmap.createBitmap(originalImage, | Bitmap reflectionImage = Bitmap.createBitmap(originalImage, | ||
| + | |||
| / divider * (divider - 1), width, height / divider, matrix, | / divider * (divider - 1), width, height / divider, matrix, | ||
| + | |||
| false); | false); | ||
| + | |||
| + | |||
| // Create a new bitmap with same width but taller to fit reflection | // Create a new bitmap with same width but taller to fit reflection | ||
| + | |||
| Bitmap bitmapWithReflection2 = Bitmap.createBitmap(width, | Bitmap bitmapWithReflection2 = Bitmap.createBitmap(width, | ||
| + | |||
| Config.ARGB_8888); | Config.ARGB_8888); | ||
| + | |||
| + | |||
| // Create a new Canvas with the bitmap that's big enough for | // Create a new Canvas with the bitmap that's big enough for | ||
| + | |||
| // the image plus gap plus reflection | // the image plus gap plus reflection | ||
| + | |||
| Canvas canvas = new Canvas(reflectionImage); | Canvas canvas = new Canvas(reflectionImage); | ||
| + | |||
| // Draw in the reflection | // Draw in the reflection | ||
| + | |||
| canvas.drawBitmap(reflectionImage, | canvas.drawBitmap(reflectionImage, | ||
| + | |||
| + | |||
| // Create a shader that is a linear gradient that covers the reflection | // Create a shader that is a linear gradient that covers the reflection | ||
| + | |||
| Paint paint = new Paint(); | Paint paint = new Paint(); | ||
| + | |||
| LinearGradient shader = new LinearGradient(0, | LinearGradient shader = new LinearGradient(0, | ||
| + | |||
| originalImage.getHeight(), | originalImage.getHeight(), | ||
| + | |||
| 0x70ffffff, | 0x70ffffff, | ||
| + | |||
| // Set the paint to use this shader (linear gradient) | // Set the paint to use this shader (linear gradient) | ||
| + | |||
| paint.setShader(shader); | paint.setShader(shader); | ||
| + | |||
| // Set the Transfer mode to be porter duff and destination in | // Set the Transfer mode to be porter duff and destination in | ||
| + | |||
| paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); | paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); | ||
| + | |||
| // Draw a rectangle using the paint with our linear gradient | // Draw a rectangle using the paint with our linear gradient | ||
| + | |||
| canvas.drawRect(0, | canvas.drawRect(0, | ||
| + | |||
| + | |||
| return reflectionImage; | return reflectionImage; | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| public static Bitmap setAlpha(Bitmap sourceImg, int number) { | public static Bitmap setAlpha(Bitmap sourceImg, int number) { | ||
| + | |||
| int[] argb = new int[sourceImg.getWidth() * sourceImg.getHeight()]; | int[] argb = new int[sourceImg.getWidth() * sourceImg.getHeight()]; | ||
| + | |||
| sourceImg.getPixels(argb, | sourceImg.getPixels(argb, | ||
| + | |||
| .getWidth(), | .getWidth(), | ||
| + | |||
| number = number * 255 / 100; | number = number * 255 / 100; | ||
| + | |||
| for (int i = 0; i < argb.length; | for (int i = 0; i < argb.length; | ||
| + | |||
| //argb = (number << 24) | (argb & 0x00ffffff);// | //argb = (number << 24) | (argb & 0x00ffffff);// | ||
| + | |||
| } | } | ||
| + | |||
| sourceImg = Bitmap.createBitmap(argb, | sourceImg = Bitmap.createBitmap(argb, | ||
| + | |||
| .getHeight(), | .getHeight(), | ||
| + | |||
| + | |||
| return sourceImg; | return sourceImg; | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| /** | /** | ||
| + | |||
| * get reflection bitmap of the original bitmap. | * get reflection bitmap of the original bitmap. | ||
| + | |||
| * | * | ||
| + | |||
| * @param srcBitmap | * @param srcBitmap | ||
| + | |||
| * @return | * @return | ||
| + | |||
| */ | */ | ||
| + | |||
| public static Bitmap makeReflectionBitmap(Bitmap originalImage) { | public static Bitmap makeReflectionBitmap(Bitmap originalImage) { | ||
| + | |||
| + | |||
| int width = originalImage.getWidth(); | int width = originalImage.getWidth(); | ||
| + | |||
| int height = originalImage.getHeight(); | int height = originalImage.getHeight(); | ||
| + | |||
| + | |||
| // This will not scale but will flip on the Y axis | // This will not scale but will flip on the Y axis | ||
| + | |||
| Matrix matrix = new Matrix(); | Matrix matrix = new Matrix(); | ||
| + | |||
| matrix.preScale(1, | matrix.preScale(1, | ||
| + | |||
| + | |||
| // Create a Bitmap with the flip matix applied to it. | // Create a Bitmap with the flip matix applied to it. | ||
| + | |||
| // We only want the bottom half of the image | // We only want the bottom half of the image | ||
| + | |||
| int divider = 8; | int divider = 8; | ||
| + | |||
| + | |||
| Bitmap srcBitmap = Bitmap.createBitmap(originalImage, | Bitmap srcBitmap = Bitmap.createBitmap(originalImage, | ||
| + | |||
| / divider * (divider - 1), width, height / divider, matrix, | / divider * (divider - 1), width, height / divider, matrix, | ||
| + | |||
| false); | false); | ||
| + | |||
| + | |||
| // | // | ||
| + | |||
| int bmpWidth = srcBitmap.getWidth(); | int bmpWidth = srcBitmap.getWidth(); | ||
| + | |||
| int bmpHeight = srcBitmap.getHeight(); | int bmpHeight = srcBitmap.getHeight(); | ||
| + | |||
| int[] pixels = new int[bmpWidth * bmpHeight * 4]; | int[] pixels = new int[bmpWidth * bmpHeight * 4]; | ||
| + | |||
| srcBitmap.getPixels(pixels, | srcBitmap.getPixels(pixels, | ||
| + | |||
| + | |||
| // get reversed bitmap | // get reversed bitmap | ||
| + | |||
| Bitmap reverseBitmap = Bitmap.createBitmap(bmpWidth, | Bitmap reverseBitmap = Bitmap.createBitmap(bmpWidth, | ||
| + | |||
| Bitmap.Config.ARGB_8888); | Bitmap.Config.ARGB_8888); | ||
| + | |||
| for (int y = 0; y < bmpHeight; y++) { | for (int y = 0; y < bmpHeight; y++) { | ||
| + | |||
| reverseBitmap.setPixels(pixels, | reverseBitmap.setPixels(pixels, | ||
| + | |||
| bmpHeight - y - 1, bmpWidth, 1); | bmpHeight - y - 1, bmpWidth, 1); | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| // get reflection bitmap based on the reversed one | // get reflection bitmap based on the reversed one | ||
| + | |||
| reverseBitmap.getPixels(pixels, | reverseBitmap.getPixels(pixels, | ||
| + | |||
| Bitmap reflectionBitmap = Bitmap.createBitmap(bmpWidth, | Bitmap reflectionBitmap = Bitmap.createBitmap(bmpWidth, | ||
| + | |||
| Bitmap.Config.ARGB_8888); | Bitmap.Config.ARGB_8888); | ||
| + | |||
| int alpha = 0x00000000; | int alpha = 0x00000000; | ||
| + | |||
| for (int y = 0; y < bmpHeight; y++) { | for (int y = 0; y < bmpHeight; y++) { | ||
| + | |||
| for (int x = 0; x < bmpWidth; x++) { | for (int x = 0; x < bmpWidth; x++) { | ||
| + | |||
| int index = y * bmpWidth + x; | int index = y * bmpWidth + x; | ||
| + | |||
| int r = (pixels[index] >> 16) & 0xff; | int r = (pixels[index] >> 16) & 0xff; | ||
| + | |||
| int g = (pixels[index] >> 8) & 0xff; | int g = (pixels[index] >> 8) & 0xff; | ||
| + | |||
| int b = pixels[index] & 0xff; | int b = pixels[index] & 0xff; | ||
| + | |||
| + | |||
| pixels[index] = alpha | (r << 16) | (g << 8) | b; | pixels[index] = alpha | (r << 16) | (g << 8) | b; | ||
| + | |||
| + | |||
| reflectionBitmap.setPixel(x, | reflectionBitmap.setPixel(x, | ||
| + | |||
| } | } | ||
| + | |||
| alpha = alpha + 0x01000000; | alpha = alpha + 0x01000000; | ||
| + | |||
| } | } | ||
| + | |||
| return reflectionBitmap; | return reflectionBitmap; | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| + | |||
| /** | /** | ||
| + | |||
| * Set the Bitmap alpha | * Set the Bitmap alpha | ||
| + | |||
| * @param srcBitmap | * @param srcBitmap | ||
| + | |||
| * @return | * @return | ||
| + | |||
| */ | */ | ||
| + | |||
| public static Bitmap setAlpha(Bitmap srcBitmap){ | public static Bitmap setAlpha(Bitmap srcBitmap){ | ||
| + | |||
| int bmpWidth = srcBitmap.getWidth(); | int bmpWidth = srcBitmap.getWidth(); | ||
| + | |||
| int bmpHeight = srcBitmap.getHeight(); | int bmpHeight = srcBitmap.getHeight(); | ||
| + | |||
| int[] pixels = new int[bmpWidth * bmpHeight * 4]; | int[] pixels = new int[bmpWidth * bmpHeight * 4]; | ||
| + | |||
| srcBitmap.getPixels(pixels, | srcBitmap.getPixels(pixels, | ||
| + | |||
| // get reflection bitmap based on the reversed one | // get reflection bitmap based on the reversed one | ||
| + | |||
| // Bitmap reverseBitmap = Bitmap.createBitmap(bmpWidth, | // Bitmap reverseBitmap = Bitmap.createBitmap(bmpWidth, | ||
| + | |||
| // Bitmap.Config.ARGB_8888); | // Bitmap.Config.ARGB_8888); | ||
| + | |||
| // srcBitmap.getPixels(pixels, | // srcBitmap.getPixels(pixels, | ||
| + | |||
| Bitmap reflectionBitmap = Bitmap.createBitmap(bmpWidth, | Bitmap reflectionBitmap = Bitmap.createBitmap(bmpWidth, | ||
| + | |||
| Bitmap.Config.ARGB_8888); | Bitmap.Config.ARGB_8888); | ||
| + | |||
| //int alpha = 0x88ffffff/ | //int alpha = 0x88ffffff/ | ||
| + | |||
| int alpha = 0x01000000*100; | int alpha = 0x01000000*100; | ||
| + | |||
| Utils.log(" | Utils.log(" | ||
| + | |||
| for (int y = 0; y < bmpHeight; y++) { | for (int y = 0; y < bmpHeight; y++) { | ||
| + | |||
| Utils.log(" | Utils.log(" | ||
| + | |||
| for (int x = 0; x < bmpWidth; x++) { | for (int x = 0; x < bmpWidth; x++) { | ||
| + | |||
| int index = y * bmpWidth + x; | int index = y * bmpWidth + x; | ||
| + | |||
| int r = (pixels[index] >> 16) & 0xff; | int r = (pixels[index] >> 16) & 0xff; | ||
| + | |||
| int g = (pixels[index] >> 8) & 0xff; | int g = (pixels[index] >> 8) & 0xff; | ||
| + | |||
| int b = pixels[index] & 0xff; | int b = pixels[index] & 0xff; | ||
| + | |||
| + | |||
| pixels[index] = alpha | (r << 16) | (g << 8) | b; | pixels[index] = alpha | (r << 16) | (g << 8) | b; | ||
| + | |||
| + | |||
| reflectionBitmap.setPixel(x, | reflectionBitmap.setPixel(x, | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| alpha = alpha - 0x01000000*10; | alpha = alpha - 0x01000000*10; | ||
| + | |||
| + | |||
| } | } | ||
| + | |||
| return reflectionBitmap; | return reflectionBitmap; | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| + | |||
| public static Bitmap getRoundedCornerBitmap(Bitmap bitmap) { | public static Bitmap getRoundedCornerBitmap(Bitmap bitmap) { | ||
| + | |||
| Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), | Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), | ||
| + | |||
| .getHeight(), | .getHeight(), | ||
| + | |||
| Canvas canvas = new Canvas(output); | Canvas canvas = new Canvas(output); | ||
| + | |||
| + | |||
| final int color = 0xff424242; | final int color = 0xff424242; | ||
| + | |||
| final Paint paint = new Paint(); | final Paint paint = new Paint(); | ||
| + | |||
| final Rect rect = new Rect(0, 0, bitmap.getWidth(), | final Rect rect = new Rect(0, 0, bitmap.getWidth(), | ||
| + | |||
| final RectF rectF = new RectF(rect); | final RectF rectF = new RectF(rect); | ||
| + | |||
| final float roundPx = 5; | final float roundPx = 5; | ||
| + | |||
| + | |||
| paint.setAntiAlias(true); | paint.setAntiAlias(true); | ||
| + | |||
| canvas.drawARGB(0, | canvas.drawARGB(0, | ||
| + | |||
| paint.setColor(color); | paint.setColor(color); | ||
| + | |||
| canvas.drawRoundRect(rectF, | canvas.drawRoundRect(rectF, | ||
| + | |||
| + | |||
| paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); | paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); | ||
| + | |||
| canvas.drawBitmap(bitmap, | canvas.drawBitmap(bitmap, | ||
| + | |||
| + | |||
| return output; | return output; | ||
| + | |||
| } | } | ||
| + | |||
| + | |||
| </ | </ | ||
| + | |||
| + | ====== 图像等比例伸缩 ====== | ||
| + | <code java> | ||
| + | public static Bitmap createFixedBitmapWithImageView(ImageView imageView, Bitmap bitmap) { | ||
| + | float bitmapHeight = bitmap.getHeight(); | ||
| + | float bitmapWidth = bitmap.getWidth(); | ||
| + | |||
| + | float imageViewWidth = imageView.getWidth(); | ||
| + | float imageViewHeight = imageView.getHeight(); | ||
| + | |||
| + | float imageViewRate = (float) imageViewWidth / (float) imageViewHeight; | ||
| + | float bitmapRate = (float) bitmapWidth / (float) bitmapHeight; | ||
| + | float newWidth = 0; | ||
| + | float newHeight = 0; | ||
| + | if (bitmapHeight > imageViewHeight && bitmapWidth > imageViewWidth) { | ||
| + | if (bitmapRate > imageViewRate) { | ||
| + | newWidth = imageViewWidth; | ||
| + | newHeight = (imageViewWidth / bitmapWidth) * imageViewHeight; | ||
| + | } else { | ||
| + | newHeight = imageViewHeight; | ||
| + | newWidth = (imageViewHeight / bitmapHeight) * bitmapWidth; | ||
| + | } | ||
| + | } else if (bitmapHeight >= imageViewHeight && bitmapWidth <= imageViewWidth) { | ||
| + | if (bitmapRate > imageViewRate) { | ||
| + | newWidth = imageViewWidth; | ||
| + | newHeight = (imageViewWidth / bitmapWidth) * imageViewHeight; | ||
| + | } else { | ||
| + | newHeight = imageViewHeight; | ||
| + | newWidth = imageViewHeight / bitmapHeight * bitmapWidth; | ||
| + | } | ||
| + | } else if (bitmapHeight < imageViewHeight && bitmapWidth > imageViewWidth) { | ||
| + | if (bitmapRate > imageViewRate) { | ||
| + | newWidth = imageViewWidth; | ||
| + | newHeight = (imageViewWidth / bitmapWidth) * imageViewHeight; | ||
| + | } else { | ||
| + | newHeight = imageViewHeight; | ||
| + | newWidth = (imageViewHeight / bitmapHeight) * bitmapWidth; | ||
| + | } | ||
| + | } else { | ||
| + | if (bitmapRate > imageViewRate) { | ||
| + | newWidth = imageViewWidth; | ||
| + | newHeight = (imageViewWidth) / bitmapWidth * imageViewHeight; | ||
| + | } else { | ||
| + | newHeight = imageViewHeight; | ||
| + | newWidth = (imageViewHeight / bitmapHeight) * bitmapWidth; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | Bitmap resizedBitmap = resizeImage(bitmap, | ||
| + | |||
| + | return resizedBitmap; | ||
| + | } | ||
| + | </ | ||
| + | |||
/var/www/dokuwiki/wiki/data/attic/code/android-code/image-convert.1275640889.txt.gz · Last modified: 2016/05/05 13:06 (external edit)
