Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900
Accepted Solution

Blending Image does not display in Torch simulator

Hi everybuddy,

 

I have make a program to blend two images and display the blend image. when i am trying to set this image into bitmap field, then just one image is displayed and i have lost my second image...

 

 

i am afraid that my blending function is not working... :smileysad: 

 

But after that i have doing one thing... and store that image into SD Card which should be display, and what i see!!!!

 

the image is blend and it looks as i want to display... but i cant find such image into my simulator..

 

I have made this things for all device and all OS... and its working fine..

 

the problem is just in Torch simulator!!!!

 

any buddy can help me to solve out this problem or is there any limitation of torch simulator??

 

regards,

Ankit Patel 

Developer
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Blending Image does not display in Torch simulator

Can you post your code so we can see if there is a problem with it somewhere?

Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900

Re: Blending Image does not display in Torch simulator

here is my code which is not working in Torch.

 

I Flip the image and blend that image with frame via this code.

 

Flip Horizontal code:-

 

 

frontScreen.LastModifiedbitmap = 

ImageManipulator.rotate(Const.ModifiedPhoto, 360);

int img[][] = frontScreen.getARGB1(Const.processFrame);

int img2[][] = frontScreen.getARGB2(frontScreen.LastModifiedbitmap);

Bitmap CropTemp = frontScreen.CropBlend(img2,frontScreen.LastModifiedbitmap, 0, 0);

int img4[][] = frontScreen.getARGB2(CropTemp);

Bitmap temp = frontScreen.newblend(img4, img, 
CropTemp,Const.processFrame, 0, 0);

EncodedImage en = PNGEncodedImage.encode(temp);

temp = frontScreen.setsizeImage(en, 300, 200);

// i have save this image into SD card then it is looking fine and                // blend as i want.
						_photoField.setBitmap(temp);

Const.portrait = false;
Const.landscap = true;

 

 

getARGB:-

 

 

public static int[][] getARGB1(Bitmap bitmap1){
		int width = bitmap1.getWidth();
		int height = bitmap1.getHeight();
		
		int[] rgbim1 = new int[width];
		AlphaVal1 = new int[height][width];
		int [][] rgbAllimgdata = new int[height][width];
//		bitmap1.getARGB(rgbim1, 0, width, 0, row, width, 1);
		
		for (int row = 0; row < height; row++) {
			bitmap1.getARGB(rgbim1, 0, width, 0, row, width, 1);
				for (int col = 0; col < width; col++) {
					int rgb1 = rgbim1[col];
					int a1 = (rgb1 >> 24) & 255;
					int r1 = (rgb1 >> 16) & 255;
					int g1 = (rgb1 >> 8) & 255;
					int b1 = rgb1 & 255;
				AlphaVal1[row][col] = a1;
				rgbAllimgdata[row][col] = (a1 << 24) | (r1 << 16) | (g1 << 8) | b1;
			}
		}
		return rgbAllimgdata;
	}

 

 

 

cropblend function:-

 

 

public static Bitmap CropBlend(int[][] rgbim1, Bitmap bi1,
			int setasrow,int setascol){
		
		int width = bi1.getWidth();
		int height = bi1.getHeight();
		
		int widthim2 ;
		int heightim2 ;
		
		if(width < 600){
			widthim2 = width;
		}else{
			widthim2 = 600;//Const.ScaledWidth;
		}
		
		
		heightim2 = 400;//Const.ScaledHeight;
	
		Bitmap bi3 = new Bitmap(widthim2, heightim2);
		int[] rgbdata = new int[widthim2];
		
		for (int row = 0; row < heightim2; row++) {// Frame Image
			
			for (int col = 0; col < widthim2; col++) {// frame Image
				rgbdata[col] = rgbim1[row][col];// BitMap RGB Data
			}
			bi3.setARGB(rgbdata, 0, widthim2, 0, row, widthim2, 1);
		}
		return bi3;
	}

 

 

 

NewBlend :-

 

 

public static Bitmap newblend(int[][] rgbim1, int[][] rgbim2, Bitmap bi1,
			Bitmap bi2, int setascol, int setasrow) {
		
		int width = bi1.getWidth();
		int	height = bi1.getHeight();
//		Dialog.inform("Width>"+width+", Height>"+height);
//		double diff = width - 400;
//		if(diff == 1){
//			width = 400;
//		}
		
		
		int widthim2 = bi2.getWidth();
		int heightim2 = bi2.getHeight();

		Bitmap bi3= null; //= new Bitmap(width, height);
		
		int[] rgbdata = null;
		if(width <= widthim2){
			bi3 = new Bitmap(widthim2, height);
			rgbdata = new int[widthim2];
		}else {
			bi3 = new Bitmap(width, height);
			rgbdata = new int[width];
		}
		int img2rowcount =0;
		boolean rowinc = false;
		
		for (int row = 0; row < heightim2; row++) {// Frame Image
			int img2colcount = 0;
			for (int col = 0; col < widthim2; col++) {// frame Image
				if(setasrow<0 && setascol<0){
					if (row > setasrow && row < height + setasrow
							&& col > setascol && col < width + setascol) {//
						 if(col<width+setascol){
							 if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
									rgbdata[col] = rgbim1[img2rowcount-setasrow][img2colcount-setascol];// BitMap RGB Data

								} else {
									rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
								} 
						 }else{
							 rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
						 }
						
						img2colcount++;
						rowinc = true;
					} else {
						rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
					}
				}else if(setasrow<0 && !(setascol<0)){
					if (row > setasrow && row < height + setasrow
							&& col > setascol && col < widthim2 + setascol) {//
						if(col<width+setascol){ 
							if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
								rgbdata[col] = rgbim1[img2rowcount-setasrow][img2colcount];// BitMap RGB Data
	
							} else {
								rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
							}
						}else{
							rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
						}
						img2colcount++;
						rowinc = true;
					} else {
						rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
					}

				}else if(!(setasrow<0) && setascol<0){
					if (row > setasrow && row < heightim2 + setasrow
								&& col > setascol && col < width + setascol) {//
							 if(col<width+setascol){
								if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
									rgbdata[col] = rgbim1[img2rowcount][img2colcount-setascol];// BitMap RGB Data
	
								} else {
									rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
								}
							 }else{
								 rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
							 }
							img2colcount++;
							rowinc = true;
						} else {
							rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
						}

				}else{
					if (row > setasrow && row < heightim2 + setasrow
							&& col > setascol && col < widthim2 + setascol) {//
						 if(col < width+setascol){
							if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
								
								rgbdata[col] = rgbim1[img2rowcount][img2colcount];// BitMap RGB Data
	
							} else {
								rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
							}
						 }else{
							 rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
						 }
						img2colcount++;
						rowinc = true;
					} else {
						rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
					}
				}
			}
			if (rowinc) {
				img2rowcount++;
			}
			if(width<=widthim2){
				bi3.setARGB(rgbdata, 0, widthim2, 0, row, widthim2, 1);
			}else {
				bi3.setARGB(rgbdata, 0, width, 0, row, width, 1);
			}
		}
		return bi3;
	}

 

 

Here is the code... if you Help me. im waiting for your reply....

 

 

 

 

Developer
Posts: 53
Registered: ‎10-29-2010
My Device: Not Specified

Re: Blending Image does not display in Torch simulator

The new OS is full of issues... I think you need to find a workaround.

 

Maybe for OS 6 you can display both images in different Fields.

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Blending Image does not display in Torch simulator

"The new OS is full of issues..."

 

Not in my experience.  I think it is advisable to 'prove' that there is a problem with the OS rather than just assuming there is.  There could be a problem with the code that is masked by something in the older OS and comes to light with the new OS.

 

That said, I would download and try a newer Simulator.  I have had issues with the first Torch Simulator. 

 

Assuming this does not resolve your problem, then I'd like to help with this, but my time is limited.  I don't have time to recreate a test bed for this code.  So perhaps you could do this?  Is there a possibility that you could put together a complete standalone package that works on one device and doesn't work on another,  Then you can give us that package (source code and resources) and we can try it ourselves. 

Developer
Posts: 53
Registered: ‎10-29-2010
My Device: Not Specified

Re: Blending Image does not display in Torch simulator

Sorry, you are right Peter, I should have specified OS6 is full of issues regarding the browserField, but some got fixed after version 6.0.0.141.

 

I had one issue with a customer. The app was just a screen with a browserfield and some buttons to select what page it would load but the browserfield was never displayed. He updated the pair of torchs he was using from 6.0.0.141 to 6.0.0.246 and everything worked fine.

Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900

Re: Blending Image does not display in Torch simulator

[ Edited ]

@peter

 

Thanks for your Reply.

Here i have Pasted source code of demo project, which contain all the thing which i want to do in my project. Please refer it and give me any solution for this problem.

 

i have recommend you to use this Image manipulation class cause i have modify this class for my requirement..

 

Image manipulation class:- 

 

 

package com;

import javax.microedition.lcdui.Image;

import net.rim.device.api.math.Fixed32;
import net.rim.device.api.math.VecMath;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.XYDimension;

/**
 * Class for Rotating, Mirroring, and Scaling Bitmaps
 * 
 * Supports:
 * <ul>
 * <li>Transformations by angle around 0,0 and mirroring in X and/or Y axis.</li>
 * <li>Transformation by arbitrary transformation matrix.</li>
 * <li>Scaling applied independently of any transformation.</li>
 * <li>Scaling separately in X and Y axis</li>
 * <li>Results can be painted to a new Bitmap, or directly on any Graphics
 * context</li>
 * </ul>
 * 
 * @version 1.6 (December 2009)
 */
public class ImageManipulator {

	/**
	 * This bitmap scaling option marks that scaling should proceed without
	 * preserving aspect ratio. The source bitmap is fit to the dimensions of
	 * the destination bitmap. Copied from 5.0 Bitmap API.
	 * 
	 * <pre>
	 * http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html
	 * </pre>
	 * 
	 * @since 1.1
	 */
	public static final int SCALE_STRETCH = 0;
	/**
	 * This bitmap scaling option marks that scaling is done with preserving the
	 * aspect ratio. The source bitmap fills the destination bitmap completely
	 * and outstanding parts of the source bitmap are not copied to the
	 * destination bitmap. Copied from 5.0 Bitmap API.
	 * 
	 * <pre>
	 * http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html
	 * </pre>
	 * 
	 * @since 1.1
	 */
	public static final int SCALE_TO_FILL = 1;
	/**
	 * This bitmap scaling option marks that scaling is done with preserving the
	 * aspect ratio. The source bitmap is fit to the dimensions of the
	 * destination bitmap and a part of destination bitmap remains unchanged.
	 * Copied from 5.0 Bitmap API.
	 * 
	 * <pre>
	 * http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html
	 * </pre>
	 * 
	 * @since 1.1
	 */
	public static final int SCALE_TO_FIT = 2;
	/**
	 * Used for compatibility with 5.0. Has no effect, but the values are
	 * checked.
	 * 
	 * @since 1.1
	 */
	public static final int FILTER_LANCZOS = 0;
	/**
	 * Used for compatibility with 5.0. Has no effect, but the values are
	 * checked.
	 * 
	 * @since 1.1
	 */
	public static final int FILTER_BOX = 1;
	/**
	 * Used for compatibility with 5.0. Has no effect, but the values are
	 * checked.
	 * 
	 * @since 1.1
	 */
	public static final int FILTER_BILINEAR = 2;

	// The image to alter
	private Bitmap bitmap;

	// The graphics context to use
	// if one is not provided, a bitmap will be

	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int UX = 0;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int UY = 3;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int UZ = 6;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int VX = 1;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int VY = 4;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int VZ = 7;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int WX = 2;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int WY = 5;
	/**
	 * Constants for Matrix locations within a single dimensional array
	 * 
	 * <pre>
	 * | UX  UY  UZ |
	 * | VX  VY  VZ |
	 * | WX  WY  WZ |
	 * </pre>
	 * 
	 * @since 1.3
	 */
	public static final int WZ = 8;

	/*
	 * the transform matrix, initialized to identity
	 */
	private int[] transformMatrix = VecMath.IDENTITY_3X3;
	// set scale in X axis
	private int scaleX = Fixed32.ONE;
	// set scale in Y axis
	private int scaleY = Fixed32.ONE;

	// track separate texture origin for non-orthogonal rotations
	private int textureX;
	private int textureY;

	// track whether the rotation a multiple of 90 degrees
	private boolean orthogonal;

	// actual scale factor when applied to pixels
	private int resultantScaleX = Fixed32.ONE;
	private int resultantScaleY = Fixed32.ONE;

	// Initialize the X and Y point arrays
	// These define the resultant image points
	private int[] bitmapXPts = { 0, 0, 0, 0 };
	private int[] bitmapYPts = { 0, 0, 0, 0 };

	// Store the resulting dimensions of the transformation
	private XYDimension transformedRegion = new XYDimension();

	// Flag whether the transformation has been applied
	private boolean transformationApplied;

	// Constant for drawing in "15.16 fixed point format"
	private static final int SHIFT16 = 1 << 16;

	// Set the background color default white
	private int backgroundColor = Color.WHITE;

	// Set default alpha to transparent
	private int backgroundAlpha = 0;

	// static object for use in the static methods
	private static ImageManipulator imageManipulator;

	/**
	 * Scale the provided bitmap
	 * 
	 * @param bitmap
	 *            the bitmap to scale
	 * @param scale
	 *            the new scale factor in Fixed32
	 * @return the scaled bitmap
	 * @since 1.1
	 */
	public static Bitmap scale(Bitmap bitmap, int scale) {
		if (imageManipulator == null) {
			imageManipulator = new ImageManipulator(bitmap);
		} else {
			imageManipulator.setBitmap(bitmap);
		}
		imageManipulator.resetTransform();
		imageManipulator.setScale(scale);
		return imageManipulator.transformAndPaintBitmap();
	}

	/**
	 * Rotate the provided Bitmap
	 * 
	 * @param bitmap
	 *            the bitmap to rotate
	 * @param angle
	 *            the angle in degrees to rotate, counterclockwise around the
	 *            top left corner.
	 * @return the rotated bitmap
	 * @since 1.1
	 */
	public static Bitmap rotate(Bitmap bitmap, int angle) {
		if (imageManipulator == null) {
			imageManipulator = new ImageManipulator(bitmap);
		} else {
			imageManipulator.setBitmap(bitmap);
		}
		imageManipulator.resetTransform();
		imageManipulator.transformByAngle(angle, false, false);
		return imageManipulator.transformAndPaintBitmap();
	}

	public ImageManipulator(Bitmap image) {
		bitmap = image;
	}

	/**
	 * Reset the transformation to the identity: No rotation and Scale is 1.0
	 * 
	 * @since 1.1
	 */
	public void resetTransform() {
		transformByMatrix(Fixed32.ONE, 0, 0, Fixed32.ONE);
		orthogonal = true;
		setScale(Fixed32.ONE);
		transformationApplied = false;
	}

	/**
	 * Setup the given transformation matrix, given the cosine and sine values,
	 * and mirroring options
	 * 
	 * @param matrix
	 *            the transform matrix, must be of size 4
	 * @param cos
	 *            cosine of the angle in radians
	 * @param sin
	 *            sine of the angle in radians
	 * @param mirrorX
	 *            to mirror in the X axis
	 *            
	 * @param mirrorY
	 *            to mirror in the Y axis
	 */
	private void setTransform(int[] matrix, int cos, int sin, boolean mirrorX, boolean mirrorY) {
		// default, non mirrored transformation
		matrix[UX] = cos;
		matrix[UY] = -sin;
		matrix[VX] = sin;
		matrix[VY] = cos;
		if (mirrorY) {
			matrix[UX] = -cos;
			matrix[UY] = sin;
		}
		if (mirrorX) {
			matrix[VX] = -sin;
			matrix[VY] = -cos;
		}
	}

	/**
	 * Rotate the image about an angle and/or mirror about an axis
	 * 
	 * @param angle
	 *            the angle in degrees, postive rotates counterclockwise
	 * @param mirrorX
	 *            true to mirror in the X axis
	 * @param mirrorY
	 *            true to mirror in the Y axis
	 */
	public void transformByAngle(int angle, boolean mirrorX, boolean mirrorY) {
		if (angle % 90 == 0) {
			orthogonal = true;
		} else {
			orthogonal = false;
		}
		angle = Fixed32.toFP(angle);
		int cos = Fixed32.cosd(angle);
		int sin = Fixed32.sind(angle);
		setTransform(transformMatrix, cos, sin, mirrorX, mirrorY);
		transformationApplied = false;
	}

	/**
	 * Rotate the image using a custom transformation matrix. The matrix takes
	 * the form:
	 * 
	 * <pre>
	 * | ux  uy 0 |
	 * | vx  vy 0 |
	 * | 0   0  1 |
	 * </pre>
	 * 
	 * Where, the identity (matrix that does no rotation) is:
	 * 
	 * <pre>
	 * | 1  0  0 |
	 * | 0  1  0 |
	 * | 0  0  1 |
	 * </pre>
	 * 
	 * @param ux
	 *            in Fixed32 format (15.16)
	 * @param uy
	 *            in Fixed32 format (15.16)
	 * @param vx
	 *            in Fixed32 format (15.16)
	 * @param vy
	 *            in Fixed32 format (15.16)
	 */
	public void transformByMatrix(int ux, int uy, int vx, int vy) {
		transformMatrix[UX] = ux;
		transformMatrix[UY] = uy;
		transformMatrix[VX] = vx;
		transformMatrix[VY] = vy;
		orthogonal = false; // not completely accurate
		transformationApplied = false;
	}

	/**
	 * Applies the transformation matrix and scaling to the region defined by
	 * the bitmap. Uses the parameters given in the setter methods and applies
	 * to the internal region.
	 * 
	 * Called by the transformAndPaintBitmap methods before painting.
	 */
	public void applyTransformation() {

		// Check if this is necessary
		if (transformationApplied) {
			return;
		}

		int bitmapRight = Fixed32.toFP(bitmap.getWidth());
		int bitmapBottom = Fixed32.toFP(bitmap.getHeight());

		// scale the image size as requested
		bitmapRight = Fixed32.mul(bitmapRight, scaleX);
		bitmapBottom = Fixed32.mul(bitmapBottom, scaleY);

		// init matrix
		bitmapXPts[0] = 0;
		bitmapYPts[0] = 0;

		bitmapXPts[1] = 0;
		bitmapYPts[1] = bitmapBottom;

		bitmapXPts[2] = bitmapRight;
		bitmapYPts[2] = bitmapBottom;

		bitmapXPts[3] = bitmapRight;
		bitmapYPts[3] = 0;

		long rotation;
		for (int i = 0; i < 4; i++) {
			rotation = VecMath.multiplyPoint(transformMatrix, 0, bitmapXPts[i], bitmapYPts[i]);
			bitmapXPts[i] = (int) rotation;
			bitmapYPts[i] = (int) (rotation >>> 32);
		}

		// calculate the new boundaries (as rotation can require a
		// larger bitmap to hold the image)
		int minX = 0;
		int minY = 0;
		int maxX = 0;
		int maxY = 0;

		for (int i = 1; i < 4; i++) {
			if (bitmapXPts[i] < minX) {
				minX = bitmapXPts[i];
			} else if (bitmapXPts[i] > maxX) {
				maxX = bitmapXPts[i];
			}

			if (bitmapYPts[i] < minY) {
				minY = bitmapYPts[i];
			} else if (bitmapYPts[i] > maxY) {
				maxY = bitmapYPts[i];
			}
		}

		// shift the new boundaries to be anchored in the top left at
		// 0,0 and restore to int coordinates.
		for (int i = 0; i < 4; i++) {
			bitmapXPts[i] = Fixed32.toInt(bitmapXPts[i] - minX);
			bitmapYPts[i] = Fixed32.toInt(bitmapYPts[i] - minY);
		}

		/**
		 * When creating a non-orthogonal rotation, the resultant path may not
		 * be properly rectangular after rotation. This avoids misalignment of
		 * the texture and path by slightly spreading the texture over the
		 * space, making it a bit larger.
		 */
		if (!orthogonal) {
			// New texture origin outside the original region
			textureX = Fixed32.toFP(-2);
			textureY = Fixed32.toFP(-2);

			// rotate the texture origin just as the region was rotated
			rotation = VecMath.multiplyPoint(transformMatrix, 0, textureX, textureY);
			textureX = (int) rotation;
			textureY = (int) (rotation >>> 32);

			// adjust the texture origin to the same point space as the region
			textureX = Fixed32.toInt(textureX - minX);
			textureY = Fixed32.toInt(textureY - minY);

			// scale the texture so that it is 2 pixels larger than the region
			// on all sides
			resultantScaleX = Fixed32.div((bitmapRight + Fixed32.toFP(4)), Fixed32.toFP(bitmap.getWidth()));
			resultantScaleY = Fixed32.div((bitmapBottom + Fixed32.toFP(4)), Fixed32.toFP(bitmap.getHeight()));

		} else {
			// orthogonal roations can use exact coordinates since the region is
			// perfectly formed
			textureX = bitmapXPts[0];
			textureY = bitmapYPts[0];
			resultantScaleX = scaleX;
			resultantScaleY = scaleY;
		}
		// set the resulting dimensions of a bitmap containing this rotation
		transformedRegion.set(Fixed32.toRoundedInt(maxX - minX) + 1, Fixed32.toRoundedInt(maxY - minY) + 1);
		transformationApplied = true;
	}

	/**
	 * Get the background color.
	 * 
	 * @return integer in the format 0xAARRGGBB.
	 * @since 1.5
	 */
	public int getBackgroundColor() {
		return backgroundColor;
	}

	/**
	 * Set the background color. Takes an integer in the format 0xAARRGGBB,
	 * where AA is the alpha value.
	 * 
	 * @param backgroundColor
	 * @since 1.5
	 */
	public void setBackgroundColor(int backgroundColor) {
		this.backgroundColor = backgroundColor;
	}

	/**
	 * Set the background alpha value.
	 * 
	 * @param backgroundAlpha
	 *            0-255, 0 is transparent.
	 */
	public void setBackgroundAlpha(int backgroundAlpha) {
		this.backgroundAlpha = backgroundAlpha;
	}

	/**
	 * Get the background alpha
	 * 
	 * @return alpha setting of the background (0-255).
	 */
	public int getBackgroundAlpha() {
		return backgroundAlpha;
	}

	/**
	 * Paint the transformed Bitmap using the given Graphics context. Paints the
	 * area transparent before painting the bitmap.
	 * 
	 * @param g
	 *            the {@link Graphics} context to use - from a screen or bitmap,
	 *            etc.
	 */
	private void paintTransformedBitmap(Graphics g) {
		paintTransformedBitmap(g, textureX, textureY);
	}

	/**
	 * Paint the transformed Bitmap using the given Graphics context. Paints the
	 * area transparent before painting the bitmap.
	 * 
	 * @param g
	 *            the {@link Graphics} context to use - from a screen or bitmap,
	 *            etc.
	 * @param textureOriginX
	 *            x value in the original bitmap to start drawing from
	 * @param textureOriginY
	 *            y value in the original bitmap to start drawing from
	 * @since 1.1
	 */
	private void paintTransformedBitmap(Graphics g, int textureOriginX, int textureOriginY) {
		// Make the drawing space transparent first before painting
		g.setGlobalAlpha(getBackgroundAlpha());
		g.setBackgroundColor(getBackgroundColor());
		g.clear();
		g.setGlobalAlpha(255);//255
		/**
		 * Keep the precision of our transformation and Scale the drawing as
		 * well. Scale is applied as though a matrix of the form
		 * 
		 * <pre>
		 * | ScaleX  0     0|
		 * | 0    ScaleY   0|
		 * | 0       0     1|
		 * </pre>
		 * 
		 * is multiplied by the Transformation matrix
		 **/

		int dux = Fixed32.div(transformMatrix[UX], resultantScaleX);
		int dvx = Fixed32.div(transformMatrix[VX], resultantScaleY);
		int duy = Fixed32.div(transformMatrix[UY], resultantScaleX);
		int dvy = Fixed32.div(transformMatrix[VY], resultantScaleY);

		g.drawTexturedPath(bitmapXPts, bitmapYPts, null, null, textureOriginX, textureOriginY, dux, dvx, duy, dvy, bitmap);
	}

	/**
	 * Apply the transformation and paint on the given Graphics context
	 * 
	 * @param g
	 *            the {@link Graphics} context to use - from a screen or bitmap,
	 *            etc.
	 */
	public void transformAndPaintBitmap(Graphics g) {
		applyTransformation();
		paintTransformedBitmap(g);
	}

	/**
	 * Apply the transformation, paint to a new {@link Bitmap} and return it
	 * 
	 * @return The transformed {@link Bitmap} of the required size to display
	 *         the entire transformed (rotated, scaled) image, with an alpha
	 *         channel so that the space around the bitmap is transparent.
	 */
	public Bitmap transformAndPaintBitmap() {

		applyTransformation();

		// create the new bitmap
		Bitmap transformedBitmap = new Bitmap(bitmap.getType(), transformedRegion.width, transformedRegion.height);
//		Bitmap transformedBitmap = new Bitmap(bitmap.getType(), bitmap.getWidth(), bitmap.getHeight());
		transformedBitmap.createAlpha(Bitmap.ALPHA_BITDEPTH_8BPP);
		Graphics graphics = new Graphics(transformedBitmap);
		paintTransformedBitmap(graphics);
		return transformedBitmap;
	}

	/**
	 * Scale the internal bitmap into the provided Bitmap. Alternate
	 * implementation of method from 5.0 Bitmap API.
	 * 
	 * <pre>
	 * {@link http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html}
	 * </pre>
	 * 
	 * @param dst
	 *            the {@link Bitmap} to paint on, scale comes from this.
	 * @param filterType
	 *            has no real effect, but must be one of:
	 *            <ul>
	 *            <li>{@link #FILTER_LANCZOS}</li>
	 *            <li>{@link #FILTER_BOX}</li>
	 *            <li>{@link #FILTER_BILINEAR}</li>
	 *            </ul>
	 * 
	 * @since 1.1
	 */
	public void scaleInto(Bitmap dst, int filterType) {
		scaleInto(0, 0, bitmap.getWidth(), bitmap.getHeight(), dst, 0, 0, dst.getWidth(), dst.getHeight(), filterType);
	}

	/**
	 * Scale the internal bitmap into the provided Bitmap, using the provided
	 * Aspect Ratio rules. Alternate implementation of method from 5.0 Bitmap
	 * API.
	 * 
	 * <pre>
	 * {@link http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html}
	 * </pre>
	 * 
	 * @param dst
	 *            the {@link Bitmap} to paint on, scale comes from this.
	 * @param filterType
	 *            has no real effect, but must be one of:
	 *            <ul>
	 *            <li>{@link #FILTER_LANCZOS}</li>
	 *            <li>{@link #FILTER_BOX}</li>
	 *            <li>{@link #FILTER_BILINEAR}</li>
	 *            </ul>
	 * @param iAspectRatioOption
	 *            one of:
	 *            <ul>
	 *            <li>{@link #SCALE_STRETCH}</li>
	 *            <li>{@link #SCALE_TO_FILL}</li>
	 *            <li>{@link #SCALE_TO_FIT}</li>
	 *            </ul>
	 * @since 1.1
	 */
	public void scaleInto(Bitmap dst, int filterType, int iAspectRatioOption) {

		// Maintain same interface as 5.0 API
		if (iAspectRatioOption < 0 || iAspectRatioOption > 2) {
			throw new IllegalArgumentException("Invalid aspect ratio parameter");
		}

		int dstWidth = Fixed32.toFP(dst.getWidth());
		int srcWidth = Fixed32.toFP(bitmap.getWidth());
		int dstHeight = Fixed32.toFP(dst.getHeight());
		int srcHeight = Fixed32.toFP(bitmap.getHeight());

		// Find the scale values in each axis to compare
		int scaleHoriz = Fixed32.div(dstWidth, srcWidth);
		int scaleVert = Fixed32.div(dstHeight, srcHeight);

		switch (iAspectRatioOption) {
		case SCALE_STRETCH:
			scaleInto(0, 0, bitmap.getWidth(), bitmap.getHeight(), dst, 0, 0, dst.getWidth(), dst.getHeight(), filterType);
			break;
		case SCALE_TO_FILL:
			/*
			 * Destination should be completely filled by source, with some
			 * source not being painted if necessary. Also centers the painting.
			 */
			int srcShiftX;
			int srcShiftY;

			if (scaleVert > scaleHoriz) {
				// source height fills the destination
				int srcRegionWidth = Fixed32.div(dstWidth, scaleVert);
				srcShiftX = Fixed32.toRoundedInt(Fixed32.mul((srcWidth - srcRegionWidth) >> 1, scaleVert));
				scaleInto(srcShiftX, 0, Fixed32.toRoundedInt(srcRegionWidth), bitmap.getHeight(), dst, 0, 0, dst.getWidth(), dst.getHeight(),
						filterType);
			} else if (scaleHoriz > scaleVert) {
				// source width fills destination
				int srcRegionHeight = Fixed32.div(dstHeight, scaleHoriz);
				srcShiftY = Fixed32.toRoundedInt(Fixed32.mul((srcHeight - srcRegionHeight) >> 1, scaleVert));
				scaleInto(0, srcShiftY, bitmap.getWidth(), Fixed32.toRoundedInt(srcRegionHeight), dst, 0, 0, dst.getWidth(), dst.getHeight(),
						filterType);
			} else {
				// Both bitmaps have the same aspect ratio
				scaleInto(0, 0, bitmap.getWidth(), bitmap.getHeight(), dst, 0, 0, dst.getWidth(), dst.getHeight(), filterType);
			}
			break;
		case SCALE_TO_FIT:
			/*
			 * Source should be completely contained by destination, with some
			 * destination not being painted if necessary. Also centers the
			 * painting.
			 */
			int dstShiftX;
			int dstShiftY;

			if (scaleVert < scaleHoriz) {
				// source is fitted vertically with blank sides
				int scaledWidth = Fixed32.mul(scaleVert, srcWidth);
				dstShiftX = Fixed32.toInt((dstWidth - scaledWidth) >> 1);
				scaleInto(0, 0, bitmap.getWidth(), bitmap.getHeight(), dst, dstShiftX, 0, Fixed32.toRoundedInt(scaledWidth), dst.getHeight(),
						filterType);
			} else if (scaleHoriz < scaleVert) {
				// source fits horizontally with blank top and bottom
				int scaledHeight = Fixed32.mul(scaleHoriz, srcHeight);
				dstShiftY = Fixed32.toInt((dstHeight - scaledHeight) >> 1);
				scaleInto(0, 0, bitmap.getWidth(), bitmap.getHeight(), dst, 0, dstShiftY, dst.getWidth(), Fixed32.toRoundedInt(scaledHeight),
						filterType);
			} else {
				// Both bitmaps have the same aspect ratio
				scaleInto(0, 0, bitmap.getWidth(), bitmap.getHeight(), dst, 0, 0, dst.getWidth(), dst.getHeight(), filterType);
			}
			break;

		}

	}

	/**
	 * Scale the internal bitmap into the provided Bitmap. Alternate
	 * implementation of method from 5.0 Bitmap API.
	 * 
	 * <pre>
	 * {@link http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html}
	 * </pre>
	 * 
	 * 
	 * @param srcLeft
	 *            X coordinate of the top left corner of the area to be copied
	 *            from the source bitmap.
	 * @param srcTop
	 *            Y coordinate of the top left corner of the area to be copied
	 *            from the source bitmap.
	 * @param srcWidth
	 *            Width of the area to be copied from the source bitmap.
	 * @param srcHeight
	 *            Height of the area to be copied from the source bitmap.
	 * @param dst
	 *            the {@link Bitmap} to paint on, scale comes from this.
	 * @param dstLeft
	 *            X coordinate of the top left corner of the area to be copied
	 *            to the destination bitmap.
	 * @param dstTop
	 *            Y coordinate of the top left corner of the area to be copied
	 *            to the destination bitmap.
	 * @param dstWidth
	 *            Width of the area to be copied from the source bitmap.
	 * @param dstHeight
	 *            Height of the area to be copied to the destination bitmap.
	 * @param filterType
	 *            has no real effect, but must be one of:
	 *            <ul>
	 *            <li>{@link #FILTER_LANCZOS}</li>
	 *            <li>{@link #FILTER_BOX}</li>
	 *            <li>{@link #FILTER_BILINEAR}</li>
	 *            </ul>
	 * @throws NullPointerException
	 *             Thrown if 'dst' is null.
	 * @throws IllegalArgumentException
	 *             Thrown if the destination bitmap is read-only.
	 * @throws IllegalArgumentException
	 *             Thrown if illegal filter type is specified.
	 * @since 1.1
	 */
	public void scaleInto(int srcLeft, int srcTop, int srcWidth, int srcHeight, Bitmap dst, int dstLeft, int dstTop, int dstWidth, int dstHeight,
			int filterType) {

		// Maintain same interface as 5.0 API
		if (dst == null) {
			throw new NullPointerException("Destination bitmap can not be set to NULL");
		}
		if (!dst.isWritable()) {
			throw new IllegalArgumentException("Destination bitmap should not be read-only");
		}
		if (filterType < 0 || filterType > 2) {
			throw new IllegalArgumentException("Invalid filter type");
		}

		// make sure we're starting with no rotation.
		resetTransform();

		// set the region to be drawn on
		bitmapXPts = new int[] { dstLeft, dstLeft, dstLeft + dstWidth, dstLeft + dstWidth };
		bitmapYPts = new int[] { dstTop, dstTop + dstHeight, dstTop + dstHeight, dstTop };

		// Calculate the new scale based on the region sizes
		resultantScaleX = Fixed32.div(Fixed32.toFP(dstWidth), Fixed32.toFP(srcWidth));
		resultantScaleY = Fixed32.div(Fixed32.toFP(dstHeight), Fixed32.toFP(srcHeight));

		Graphics graphics = new Graphics(dst);
		paintTransformedBitmap(graphics, dstLeft - srcLeft, dstTop - srcTop);
	}

	/**
	 * Round the value to the nearest int
	 * 
	 * @param value
	 * @return rounded value
	 * @since 1.1
	 */
	public static int round(double value) {
		if (value < 0) {
			int roundedDown = (int) value;
			if (value != (roundedDown - 0.5f)) {
				return (int) (value - 0.5f);
			} // Special case to match java.lang.Math round functionality. Same
			// rounding as positive float when value is negative exact half
			// (eg. -x.5)

		}
		return (int) (value + 0.5f);
	}

	/**
	 * Convert a double value to a Fixed32 integer
	 * 
	 * @param value
	 * @return the value as an integer in Fixed32 format (16.16);
	 * @since 1.3
	 */
	public static int toFP(double value) {
		return round(value * SHIFT16);
	}

	/**
	 * Utility to convert a RIM API Bitmap into a J2ME LCDUI Image. This assists
	 * in using this library within a MIDP application, where the
	 * drawTexturedPath method is not available.
	 * 
	 * @param bitmap
	 *            the source Bitmap
	 * @return the Image object based on the Bitmap data
	 * @since 1.2
	 */
	public static Image convert(Bitmap bitmap) {
		int[] data = new int[bitmap.getWidth() * bitmap.getHeight()];
		bitmap.getARGB(data, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
		return Image.createRGBImage(data, bitmap.getWidth(), bitmap.getHeight(), true);
	}

	/**
	 * Return the unmodified bitmap
	 * 
	 * @return the original, unmodified bitmap provided in the constructor or
	 *         through setBitmap(Bitmap)
	 */
	public Bitmap getOriginalBitmap() {
		return bitmap;
	}

	/**
	 * Set a new bitmap to be transformed
	 * 
	 * @param bitmap
	 */
	public void setBitmap(Bitmap bitmap) {
		this.bitmap = bitmap;
		transformationApplied = false;
	}

	/**
	 * The Scale factor in the X dimension
	 * 
	 * @return the scale as a Fixed32 integer (16.16)
	 */
	public double getScaleX() {
		return scaleX;
	}

	/**
	 * Set the X dimension scale independently
	 * 
	 * @param scaleX
	 *            as a Fixed32 integer (16.16)
	 */
	public void setScaleX(int scaleX) {
		this.scaleX = scaleX;
		transformationApplied = false;
	}

	/**
	 * The Scale factor in the Y dimension
	 * 
	 * @return the scale as a Fixed32 integer (16.16)
	 */
	public int getScaleY() {
		return scaleY;
	}

	/**
	 * Set the Y dimension scale independently
	 * 
	 * @param scaleY
	 *            as a Fixed32 integer (16.16)
	 */
	public void setScaleY(int scaleY) {
		this.scaleY = scaleY;
		transformationApplied = false;
	}

	/**
	 * Set the X and Y scales together
	 * 
	 * @param scale
	 *            as a Fixed32 integer (16.16)
	 */
	public void setScale(int scale) {
		this.setScaleX(scale);
		this.setScaleY(scale);
	}
}

 

 

FirstScreen.java :-

 

 

package com;

import net.rim.device.api.math.Fixed32;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.EncodedImage;
import net.rim.device.api.system.PNGEncodedImage;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.container.FullScreen;

public class firstScreen extends FullScreen implements FieldChangeListener{
	
	public Bitmap photo,frame;
	public BitmapField photoField;
	public ButtonField Rright,Rleft;
	public Bitmap LastModifiedbitmap;
	public static int rotate;
	static int[][] AlphaVal1;
	static int[][] AlphaVal2;
	
	public firstScreen() {
		super(DEFAULT_CLOSE);
		photo = Bitmap.getBitmapResource("photo.png");
		frame = Bitmap.getBitmapResource("frame.png");
		
		Rright = new ButtonField("RR");
		Rright.setChangeListener(this);
		Rleft = new ButtonField("RL");
		Rleft.setChangeListener(this);
		int[][] rgbim1 = getARGB1(photo);
		int[][] rgbim2 = getARGB1(frame);
		
		Bitmap tempbit = newblend(rgbim1, rgbim2, photo, frame, 0, 0); 
		
		photoField = new BitmapField();
		photoField.setBitmap(tempbit);
		
		add(photoField);
		add(Rleft);
		add(Rright);
		
	}

	public void fieldChanged(Field field, int context) {
		if(context == 0){
			if(field.equals(Rright)){
				rotate = rotate + 10; 
				LastModifiedbitmap = ImageManipulator.rotate(photo,90);
				EncodedImage ep = PNGEncodedImage.encode(LastModifiedbitmap);
				
				int img[][] = getARGB1(frame);
				int img3[][] = getARGB2(LastModifiedbitmap);
//				Bitmap CropTemp =CropBlend(img3, LastModifiedbitmap, 0, 0);
//				int img2[][] = getARGB2(CropTemp);
				Bitmap temp = newblend(img3, img, LastModifiedbitmap, frame,0,0);
//				EncodedImage entemp = PNGEncodedImage.encode(temp);
				
//				temp =setsizeImage(entemp, 300, 200);
				photoField.setBitmap(temp);
			}else if(field.equals(Rleft)){
				rotate = rotate + 10; 
				LastModifiedbitmap =ImageManipulator.rotate(photo,180);
				EncodedImage ep = PNGEncodedImage.encode(LastModifiedbitmap);
				
				int img[][] = getARGB1(frame);
				int img3[][] = getARGB2(LastModifiedbitmap);
//				Bitmap CropTemp =CropBlend(img3, LastModifiedbitmap, 0, 0);
//				int img2[][] = getARGB2(CropTemp);
				Bitmap temp = newblend(img3, img, LastModifiedbitmap, frame,0,0);
//				EncodedImage entemp = PNGEncodedImage.encode(temp);
				
				photoField.setBitmap(temp);
			}
		}
	}
	
	public static Bitmap setsizeImage(EncodedImage image, int width, 
	  		  int height) {
	  		  EncodedImage result = null;

	  		  int currentWidthFixed32 = Fixed32.toFP(image.getWidth());
	  		  int currentHeightFixed32 = Fixed32.toFP(image.getHeight());

	  		  int requiredWidthFixed32 = Fixed32.toFP(width);
	  		  int requiredHeightFixed32 = Fixed32.toFP(height);

	  		  int scaleXFixed32 = Fixed32.div(currentWidthFixed32,
	  		    requiredWidthFixed32);
	  		  int scaleYFixed32 = Fixed32.div(currentHeightFixed32,
	  		    requiredHeightFixed32);

	  		  result = image.scaleImage32(scaleXFixed32, scaleYFixed32);
	  		  return result.getBitmap();
		 }
	
	public static Bitmap newblend(int[][] rgbim1, int[][] rgbim2, Bitmap bi1,
			Bitmap bi2, int setascol, int setasrow) {
		
		int width = bi1.getWidth();
		int	height = bi1.getHeight();
		
		int widthim2 = bi2.getWidth();
		int heightim2 = bi2.getHeight();

		Bitmap bi3= null; //= new Bitmap(width, height);
		
		int[] rgbdata = null;
		if(width <= widthim2){
			bi3 = new Bitmap(widthim2, height);
			rgbdata = new int[widthim2];
		}else {
			bi3 = new Bitmap(width, height);
			rgbdata = new int[width];
		}
		int img2rowcount =0;
		boolean rowinc = false;
		
		for (int row = 0; row < heightim2; row++) {// Frame Image
			int img2colcount = 0;
			for (int col = 0; col < widthim2; col++) {// frame Image
				if(setasrow<0 && setascol<0){
					if (row > setasrow && row < height + setasrow
							&& col > setascol && col < width + setascol) {//
						 if(col<width+setascol){
							 if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
									rgbdata[col] = rgbim1[img2rowcount-setasrow][img2colcount-setascol];// BitMap RGB Data

								} else {
									rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
								} 
						 }else{
							 rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
						 }
						
						img2colcount++;
						rowinc = true;
					} else {
						rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
					}
				}else if(setasrow<0 && !(setascol<0)){
					if (row > setasrow && row < height + setasrow
							&& col > setascol && col < widthim2 + setascol) {//
						if(col<width+setascol){ 
							if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
								rgbdata[col] = rgbim1[img2rowcount-setasrow][img2colcount];// BitMap RGB Data
	
							} else {
								rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
							}
						}else{
							rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
						}
						img2colcount++;
						rowinc = true;
					} else {
						rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
					}

				}else if(!(setasrow<0) && setascol<0){
					if (row > setasrow && row < heightim2 + setasrow
								&& col > setascol && col < width + setascol) {//
							 if(col<width+setascol){
								if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
									rgbdata[col] = rgbim1[img2rowcount][img2colcount-setascol];// BitMap RGB Data
	
								} else {
									rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
								}
							 }else{
								 rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
							 }
							img2colcount++;
							rowinc = true;
						} else {
							rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
						}

				}else{
					if (row > setasrow && row < heightim2 + setasrow
							&& col > setascol && col < widthim2 + setascol) {//
						 if(col < width+setascol){
							if (AlphaVal1[row][col] == 0) {// AlphaVal1=Frame
								
								rgbdata[col] = rgbim1[img2rowcount][img2colcount];// BitMap RGB Data
	
							} else {
								rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
							}
						 }else{
							 rgbdata[col] = rgbim2[row][col];// Frame RGB DATA
						 }
						img2colcount++;
						rowinc = true;
					} else {
						rgbdata[col] = rgbim2[row][col]; // Frame RGB DATA
					}
				}
			}
			if (rowinc) {
				img2rowcount++;
			}
			if(width<=widthim2){
				bi3.setARGB(rgbdata, 0, widthim2, 0, row, widthim2, 1);
			}else {
				bi3.setARGB(rgbdata, 0, width, 0, row, width, 1);
			}
		}
		return bi3;
	}
	
	public static Bitmap CropBlend(int[][] rgbim1, Bitmap bi1,
			int setasrow,int setascol){
		
		int width = bi1.getWidth();
		int height = bi1.getHeight();
		
		int widthim2 = 300;
		int heightim2 = 200;
		
		
		Bitmap bi3 = new Bitmap(widthim2, heightim2);
		int[] rgbdata = new int[widthim2];
		
		for (int row = 0; row < heightim2; row++) {// Frame Image
			
			for (int col = 0; col < widthim2; col++) {// frame Image
				rgbdata[col] = rgbim1[row][col];// BitMap RGB Data
			}
			bi3.setARGB(rgbdata, 0, widthim2, 0, row, widthim2, 1);
		}
		return bi3;
	}
	
	public static int[][] getARGB1(Bitmap bitmap1){
		int width = bitmap1.getWidth();
		int height = bitmap1.getHeight();
		
		int[] rgbim1 = new int[width];
		AlphaVal1 = new int[height][width];
		int [][] rgbAllimgdata = new int[height][width];
		
		for (int row = 0; row < height; row++) {
			bitmap1.getARGB(rgbim1, 0, width, 0, row, width, 1);
				for (int col = 0; col < width; col++) {
					int rgb1 = rgbim1[col];
					int a1 = (rgb1 >> 24) & 255;
					int r1 = (rgb1 >> 16) & 255;
					int g1 = (rgb1 >> 8) & 255;
					int b1 = rgb1 & 255;
				AlphaVal1[row][col] = a1;
				rgbAllimgdata[row][col] = (a1 << 24) | (r1 << 16) | (g1 << 8) | b1;
			}
		}
		return rgbAllimgdata;
	}
	
	public static int[][] getARGB2(Bitmap bitmap1){
		int width = bitmap1.getWidth();
		int height = bitmap1.getHeight();
		
		int[] rgbim1 = new int[width];
		AlphaVal2 = new int[height][width];
		int [][] rgbAllimgdata = new int[height][width];
		
		for (int row = 0; row < height; row++) {
			bitmap1.getARGB(rgbim1, 0, width, 0, row, width, 1);
				for (int col = 0; col < width; col++) {
					int rgb1 = rgbim1[col];
					int a1 = (rgb1 >> 24) & 255;
					int r1 = (rgb1 >> 16) & 255;
					int g1 = (rgb1 >> 8) & 255;
					int b1 = rgb1 & 255;
				AlphaVal2[row][col] = a1;
				rgbAllimgdata[row][col] = (a1 << 24) | (r1 << 16) | (g1 << 8) | b1;
			}
		}
		return rgbAllimgdata;
	}
}

 Here is the code. you can use photo and transperant frame in png format and resolution 300 x 200.

 

Regards,

Albert Anks

 

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Blending Image does not display in Torch simulator

This has not been forgotten, just time is short... Cheers

Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900

Re: Blending Image does not display in Torch simulator

Yeap!!!  peter,

 

I know that you are very accurate in your work and doing your job pretty good.

 

But try to solve out this problem ASAP, cause i am in middle of my project.

 

And one more thing, check out this code in simulator 8900 5.0 OS, this is working perfectly.
and after that check out in 6.0 OS torch simulator for getting problem..

 

Eagerly waiting for your reply....

 

Regards,
Albert Anks

 

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Blending Image does not display in Torch simulator

Tested this on 8900 and a couple of Torch Simulators and got the same results on all - and they were the results I expected.

 

I have a simple picture with a frame that is just basically a single couple border.

 

Perhaps you need to us the photo and frame you are are using and screen shots of the 8900 working and the 9800 not?