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
New Developer
New Developer
dev
Posts: 22
Registered: ‎08-17-2009
My Device: Not Specified
Accepted Solution

Overlap two images, works in plain java, not in BlackBerry JDE 5

[ Edited ]

 

I have a simple java swing app that takes two images and overlaps each other. While trying to port this into JDE5, I released there is no BufferedImage class in BB api but a similar Bitmap class. Problem is that the blend function ported to BB can't produce a overlapping image. It shows a blank white screen.

 

Here is the plain java function

 

public BufferedImage blend( BufferedImage bi1, BufferedImage bi2,
double weight )
{
if (bi1 == null)
throw new NullPointerException("bi1 is null");

if (bi2 == null)
throw new NullPointerException("bi2 is null");

int width = bi1.getWidth();
if (width != bi2.getWidth())
throw new IllegalArgumentException("widths not equal");

int height = bi1.getHeight();
if (height != bi2.getHeight())

throw new IllegalArgumentException("heights not equal");



BufferedImage bi3 = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
int[] rgbim1 = new int[width];
int[] rgbim2 = new int[width];
int[] rgbim3 = new int[width];

for (int row = 0; row < height; row++)
{
bi1.getRGB(0, row, width, 1, rgbim1, 0, width);
bi2.getRGB(0, row, width, 1, rgbim2, 0, width);

for (int col = 0; col < width; col++)
{
int rgb1 = rgbim1[col];
int r1 = (rgb1 >> 16) & 255;
int g1 = (rgb1 >> 8) & 255;
int b1 = rgb1 & 255;

int rgb2 = rgbim2[col];
int r2 = (rgb2 >> 16) & 255;
int g2 = (rgb2 >> 8) & 255;
int b2 = rgb2 & 255;

int r3 = (int) (r1 * weight + r2 * (1.0 - weight));
int g3 = (int) (g1 * weight + g2 * (1.0 - weight));
int b3 = (int) (b1 * weight + b2 * (1.0 - weight));
rgbim3[col] = (r3 << 16) | (g3 << 8) | b3;
}

bi3.setRGB(0, row, width, 1, rgbim3, 0, width);
}

return bi3;
}

 

 

Here is the BB java function

  public Bitmap blend( Bitmap bi1, Bitmap  bi2,
double weight )
{

if (bi1 == null)
throw new NullPointerException("bi1 is null");

if (bi2 == null)
throw new NullPointerException("bi2 is null");

int width = bi1.getWidth();
if (width != bi2.getWidth())
throw new IllegalArgumentException("widths not equal");

int height = bi1.getHeight();
if (height != bi2.getHeight())

throw new IllegalArgumentException("heights not equal");



Bitmap bi3 = new Bitmap(width, height);
int[] rgbim1 = new int[width];
int[] rgbim2 = new int[width];
int[] rgbim3 = new int[width];

for (int row = 0; row < height; row++)
{


bi1.getARGB(rgbim1,0,width,0,row, width,1);
bi2.getARGB(rgbim2,0,width,0,row, width,1);



for (int col = 0; col < width; col++)
{
int rgb1 = rgbim1[col];
int r1 = (rgb1 >> 16) & 255;
int g1 = (rgb1 >> 8) & 255;
int b1 = rgb1 & 255;

int rgb2 = rgbim2[col];
int r2 = (rgb2 >> 16) & 255;
int g2 = (rgb2 >> 8) & 255;
int b2 = rgb2 & 255;

int r3 = (int) (r1 * weight + r2 * (1.0 - weight));
int g3 = (int) (g1 * weight + g2 * (1.0 - weight));
int b3 = (int) (b1 * weight + b2 * (1.0 - weight));
rgbim3[col] = (r3 << 16) | (g3 << 8) | b3;
}

bi3.setARGB(rgbim3, 0, width, 0, row,width, 1);

}

return bi3;
}

The arg weight is a value 1 to 100.

 

 

For reference, Full plain java source

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package imagetest;

/**
*
* @author COMPUTER
*/
// Blender1.java

import java.awt.*;
import java.awt.image.*;

import javax.swing.*;
import javax.swing.event.*;

/**
* This class describes and contains the entry point to an application that
* demonstrates the blending transition.
*/

public class Blender1 extends JFrame
{
/**
*
*/
private static final long serialVersionUID = 1L;

/**
* Construct Blender1 GUI.
*/

public Blender1()
{
super("Blender #1");
setDefaultCloseOperation(EXIT_ON_CLOSE);

// Load first image from JAR file and draw image into a buffered image.

ImageIcon ii1 = new ImageIcon(getClass().getResource("x.png"));
final BufferedImage bi1;
bi1 = new BufferedImage(ii1.getIconWidth(), ii1.getIconHeight(),
BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = bi1.createGraphics();
int h = ii1.getImage().getHeight(null);
System.out.println("Blender1.Blender1()--------> height :" + h);
g2d.drawImage(ii1.getImage(), 0, 0, null);
g2d.dispose();

// Load second image from JAR file and draw image into a buffered image.

ImageIcon ii2 = new ImageIcon(getClass().getResource("y.png"));
final BufferedImage bi2;
bi2 = new BufferedImage(ii2.getIconWidth(), ii2.getIconHeight(),
BufferedImage.TYPE_INT_RGB);
g2d = bi2.createGraphics();
int h2 = ii2.getImage().getHeight(null);
System.out.println("Blender1.Blender1()--------> height :" + h2);
g2d.drawImage(ii2.getImage(), 0, 0, null);
g2d.dispose();

// Create an image panel capable of displaying entire image. The widths
// of both images and the heights of both images must be identical.

final ImagePanel ip = new ImagePanel();
ip.setPreferredSize(new Dimension(ii1.getIconWidth(), ii1
.getIconHeight()));
getContentPane().add(ip, BorderLayout.NORTH);

// Create a slider for selecting the blending percentage: 100% means
// show all of first image; 0% means show all of second image.

final JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 100);
slider.setMinorTickSpacing(5);
slider.setMajorTickSpacing(10);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
slider.setLabelTable(slider.createStandardLabels(10));
slider.setInverted(true);
ChangeListener cl;
cl = new ChangeListener()
{
public void stateChanged( ChangeEvent e )
{
// Each time the user adjusts the slider, obtain the new
// blend percentage value and use it to blend the images.

int value = slider.getValue();
ip.setImage(blend(bi1, bi2, value / 100.0));
}
};
slider.addChangeListener(cl);
getContentPane().add(slider, BorderLayout.SOUTH);

// Display the first image, which corresponds to a 100% blend
// percentage.

ip.setImage(bi1);

pack();
setVisible(true);
}

/**
* Blend the contents of two BufferedImages according to a specified weight.
*
* @param bi1
* first BufferedImage
* @param bi2
* second BufferedImage
* @param weight
* the fractional percentage of the first image to keep
*
* @return new BufferedImage containing blended contents of BufferedImage
* arguments
*/

public BufferedImage blend( BufferedImage bi1, BufferedImage bi2,
double weight )
{
if (bi1 == null)
throw new NullPointerException("bi1 is null");

if (bi2 == null)
throw new NullPointerException("bi2 is null");

int width = bi1.getWidth();
if (width != bi2.getWidth())
throw new IllegalArgumentException("widths not equal");

int height = bi1.getHeight();
if (height != bi2.getHeight())

throw new IllegalArgumentException("heights not equal");



BufferedImage bi3 = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
int[] rgbim1 = new int[width];
int[] rgbim2 = new int[width];
int[] rgbim3 = new int[width];

for (int row = 0; row < height; row++)
{
bi1.getRGB(0, row, width, 1, rgbim1, 0, width);
bi2.getRGB(0, row, width, 1, rgbim2, 0, width);

for (int col = 0; col < width; col++)
{
int rgb1 = rgbim1[col];
int r1 = (rgb1 >> 16) & 255;
int g1 = (rgb1 >> 8) & 255;
int b1 = rgb1 & 255;

int rgb2 = rgbim2[col];
int r2 = (rgb2 >> 16) & 255;
int g2 = (rgb2 >> 8) & 255;
int b2 = rgb2 & 255;

int r3 = (int) (r1 * weight + r2 * (1.0 - weight));
int g3 = (int) (g1 * weight + g2 * (1.0 - weight));
int b3 = (int) (b1 * weight + b2 * (1.0 - weight));
rgbim3[col] = (r3 << 16) | (g3 << 8) | b3;
}

bi3.setRGB(0, row, width, 1, rgbim3, 0, width);
}

return bi3;
}

/**
* Application entry point.
*
* @param args
* array of command-line arguments
*/

public static void main( String[] args )
{
Runnable r = new Runnable()
{
public void run()
{
// Create Blender1's GUI on the event-dispatching
// thread.

new Blender1();
}
};
EventQueue.invokeLater(r);
}
}

/**
* This class describes a panel that displays a BufferedImage's contents.
*/

class ImagePanel extends JPanel
{
/**
*
*/
private static final long serialVersionUID = 4977990666209629996L;
private BufferedImage bi;

/**
* Specify and paint a new BufferedImage.
*
* @param bi
* BufferedImage whose contents are to be painted
*/

void setImage( BufferedImage bi )
{
this.bi = bi;
repaint();
}

/**
* Paint the image panel.
*
* @param g
* graphics context used to paint the contents of the current
* BufferedImage
*/

public void paintComponent( Graphics g )
{
if (bi != null)
{
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(bi, null, 0, 0);
}
}
}

 

Full BB java source

/*
* ImageScreen.java
*
* © ,
* Confidential and proprietary.
*/

package src;




/**
*
*/

import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.GaugeField;
/**
* The main screen to display an image taken from the camera demo.
*/
public final class ImageScreen extends MainScreen
{
/** The down-scaling ratio applied to the snapshot Bitmap */
private static final int IMAGE_SCALING = 7;

/** The base file name used to store pictures */
private static final String FILE_NAME = System.getProperty("fileconn.dir.photos") + "IMAGE";

/** The extension of the pictures to be saved */
private static final String EXTENSION = ".bmp";

/** A counter for the number of snapshots taken */
private static int _counter;
Bitmap image1,image2; BitmapField imageField;
/** A reference to the current screen for listeners */
private ImageScreen _imageScreen;

/**
* Constructor
* @param raw A byte array representing an image
*/
public ImageScreen( final byte[] raw1,final byte[] raw2 )
{
// A reference to this object, to be used in listeners
_imageScreen = this;

setTitle("Blend and Save");

// Convert the byte array to a Bitmap image
image1 = Bitmap.createBitmapFromBytes( raw1, 0, -1, 1 );
image2 = Bitmap.createBitmapFromBytes( raw2, 0, -1, 1 );
// Create two field managers to center the screen's contents
HorizontalFieldManager hfm1 = new HorizontalFieldManager( Field.FIELD_HCENTER );
HorizontalFieldManager hfm2 = new HorizontalFieldManager( Field.FIELD_HCENTER );
HorizontalFieldManager hfm3 = new HorizontalFieldManager( Field.FIELD_HCENTER );
// Create the field that contains the image//blend(image1, image2, 50/ 100.0)
imageField = new BitmapField(blend(image1, image2, 50/ 100.0) ){

public int getPreferredWidth(){ return 250;}
public int getPreferredHeight(){ return 150;}

};

hfm1.add( imageField );

GaugeField scroller = new GaugeField("Adjust (alt + < >)",0,100,50,Field.EDITABLE | Field.FOCUSABLE);
//scroller.setBackground( net.rim.device.api.ui.decor.BackgroundFactory.createSolidBackground(0x00000000));
scroller.setChangeListener( new GaugeFieldListener() );
hfm2.add(scroller);
// Create the SAVE button which returns the user to the main camera
// screen and saves the picture as a file.
ButtonField photoButton = new ButtonField( "Save" );
photoButton.setChangeListener( new SaveListener(raw1,raw2) );
hfm3.add(photoButton);


// Create the CANCEL button which returns the user to the main camera
// screen without saving the picture.
ButtonField cancelButton = new ButtonField( "Cancel" );
cancelButton.setChangeListener( new CancelListener() );
hfm3.add(cancelButton);

// Add the field managers to the screen
add( hfm1 );
add( hfm2 );
add( hfm3 );scroller.setFocus();//scroller.setValue(50);
}
public Bitmap blend( Bitmap bi1, Bitmap bi2,
double weight )
{

if (bi1 == null)
throw new NullPointerException("bi1 is null");

if (bi2 == null)
throw new NullPointerException("bi2 is null");

int width = bi1.getWidth();
if (width != bi2.getWidth())
throw new IllegalArgumentException("widths not equal");

int height = bi1.getHeight();
if (height != bi2.getHeight())

throw new IllegalArgumentException("heights not equal");



Bitmap bi3 = new Bitmap(width, height);
int[] rgbim1 = new int[width];
int[] rgbim2 = new int[width];
int[] rgbim3 = new int[width];

for (int row = 0; row < height; row++)
{
// bi -> int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)

// bit - > int[] argbData, int offset, int scanLength, int x, int y, int width, int height)

bi1.getARGB(rgbim1,0,width,0,row, width,1);// row, width, 1, , 0, width);
bi2.getARGB(rgbim2,0,width,0,row, width,1);

//bi1.getRGB(0, row, width, 1, rgbim1, 0, width);
//bi2.getRGB(0, row, width, 1, rgbim2, 0, width);

for (int col = 0; col < width; col++)
{
int rgb1 = rgbim1[col];
int r1 = (rgb1 >> 16) & 255;
int g1 = (rgb1 >> 8) & 255;
int b1 = rgb1 & 255;

int rgb2 = rgbim2[col];
int r2 = (rgb2 >> 16) & 255;
int g2 = (rgb2 >> 8) & 255;
int b2 = rgb2 & 255;

int r3 = (int) (r1 * weight + r2 * (1.0 - weight));
int g3 = (int) (g1 * weight + g2 * (1.0 - weight));
int b3 = (int) (b1 * weight + b2 * (1.0 - weight));
rgbim3[col] = (r3 << 16) | (g3 << 8) | b3;
}
//bi -> int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
//bit -> (int[] data, int offset, int scanLength, int left, int top, int width, int height)
bi3.setARGB(rgbim3, 0, width, 0, row,width, 1);

// bi3.setRGB(0, row, width, 1, rgbim3, 0, width);
}

return bi3;
}

/**
* Handles trackball click events
* @see net.rim.device.api.ui.Screen#invokeAction(int)
*/
protected boolean invokeAction(int action)
{
boolean handled = super.invokeAction(action);

if(!handled)
{
switch(action)
{
case ACTION_INVOKE: // Trackball click.
{
return true;
}
}
}
return handled;
}

/**
* A listener used for the "Save" button
*/
private class GaugeFieldListener implements FieldChangeListener
{
public void fieldChanged(Field field, int context)
{
int value = ((GaugeField)field).getValue(); if (value==0){return;}
imageField.setBitmap( blend(image1, image2, value/ 100.0) );
((GaugeField)field).setLabel("Adjust (alt + < >)"+value);
}
}
/**
* A listener used for the "Save" button
*/
private class SaveListener implements FieldChangeListener
{
/** A byte array representing an image */
private byte[] _raw1,_raw2;

/**
* Constructor.
* @param raw A byte array representing an image
*/
SaveListener(byte[] raw1,byte[] raw2)
{
_raw1 = raw1;
_raw2 = raw2;
}

/**
* Saves the image as a file in the BlackBerry filesystem
*/
public void fieldChanged(Field field, int context)
{
try
{
// Create the connection to a file that may or
// may not exist.
FileConnection file = (FileConnection)Connector.open( FILE_NAME + _counter + EXTENSION );

// If the file exists, increment the counter until we find
// one that hasn't been created yet.
while( file.exists() )
{
file.close();
++_counter;
file = (FileConnection)Connector.open( FILE_NAME + _counter + EXTENSION );
}

// We know the file doesn't exist yet, so create it
file.create();

// Write the image to the file
OutputStream out = file.openOutputStream();
out.write(_raw1);

// Close the connections
out.close();
file.close();
}
catch(Exception e)
{
Dialog.alert( "ERROR " + e.getClass() + ": " + e.getMessage() );
}

// Inform the user where the file has been saved
Dialog.inform( "Saved to " + FILE_NAME + _counter + EXTENSION );

// Increment the image counter
++_counter;

// Return to the main camera screen
UiApplication.getUiApplication().popScreen( _imageScreen );
}
}

/**
* A listener used for the "Cancel" button
*/
private class CancelListener implements FieldChangeListener
{
/**
* Return to the main camera screen
*/
public void fieldChanged(Field field, int context)
{
UiApplication.getUiApplication().popScreen( _imageScreen );
}
}
}

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

The code looks fine, can you confirm that if you displayed the Bitmaps, pre-blend, that they show up properly?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Developer
New Developer
dev
Posts: 22
Registered: ‎08-17-2009
My Device: Not Specified

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

Oh yes. Any of the two bitmaps show up nice without getting through the blend function.

 

Is there a way to attach privately.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

You don't need to post the images if you don't need to, I just wanted to make sure that the images that you are trying to blend display properly. I can't right now but I will try the code later, everything seems perfect.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

Good news, I figured it out. I think it might be a bug in the simulator because your images don't have alpha but take alpha into account in your blend function.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Developer
New Developer
dev
Posts: 22
Registered: ‎08-17-2009
My Device: Not Specified

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

[ Edited ]

Hi Thanks for trying.

 

I'm trying to understand your response..what do you mean not to take alpha into account.. there is no get/setRGB in BB like BufferedImage has. It's get/setARGB.

 

Although I am waiting on someone to give a feedback on how it behaves in a real device.

-----update---

 

Opps I read it wrongly.. you said to TAKE alpha into account.. umm....

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

Yea, your original code:

for (int col = 0; col < width; col++)
{
int rgb1 = rgbim1[col];
int r1 = (rgb1 >> 16) & 255;
int g1 = (rgb1 >> 8) & 255;
int b1 = rgb1 & 255;

int rgb2 = rgbim2[col];
int r2 = (rgb2 >> 16) & 255;
int g2 = (rgb2 >> 8) & 255;
int b2 = rgb2 & 255;

int r3 = (int) (r1 * weight + r2 * (1.0 - weight));
int g3 = (int) (g1 * weight + g2 * (1.0 - weight));
int b3 = (int) (b1 * weight + b2 * (1.0 - weight));
rgbim3[col] = (r3 << 16) | (g3 << 8) | b3;
}

 Working code:

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;

int rgb2 = rgbim2[col];
int a2 = (rgb2 >> 24) & 255;
int r2 = (rgb2 >> 16) & 255;
int g2 = (rgb2 >> 8) & 255;
int b2 = rgb2 & 255;

int a3 = (int) (a1 * weight + a2 * (1.0 - weight));
int r3 = (int) (r1 * weight + r2 * (1.0 - weight));
int g3 = (int) (g1 * weight + g2 * (1.0 - weight));
int b3 = (int) (b1 * weight + b2 * (1.0 - weight));
rgbim3[col] = (a3 << 24) | (r3 << 16) | (g3 << 8) | b3;
}

 

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Developer
New Developer
dev
Posts: 22
Registered: ‎08-17-2009
My Device: Not Specified

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

Super! yup..I could see for the first time the images are blended.:smileyhappy:

 

Thanks for trying and much appreciated. I am going to hit the accept button.

 

By the way; How do you show a image FIT in a bitmap field, I know the scale parameter Bitmap class but that doesn't do.

 image1 = Bitmap.createBitmapFromBytes( raw1, 0, -1, Bitmap.SCALE_TO_FIT );
 image2 = Bitmap.createBitmapFromBytes( raw2, 0, -1, Bitmap.SCALE_TO_FIT );

 

The bitmap field only shows top part of the image.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

There are various forum posts about how to do manual scaling. As for the scaling argument in createBitmapFromBytes, it is a scale value not a constant. If you figure out the scale that the bitmap needs to be adjusted to then you can use the scale value.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
rajeshkparmar
Posts: 104
Registered: ‎08-03-2010
My Device: Blackberry Z10
My Carrier: Idea

Re: Overlap two images, works in plain java, not in BlackBerry JDE 5

Hi ,

How to Identify the Transparent value in Bitmap?

I want to blend only transparent part of the image in the two images

 

like Add frame in image..

so frame's color not affect and image will add only the portion of the transparent image...

 

Thanks

Rajesh Parmar

 


Please mark posts as solved if you found a solution.
Feel free to press the kudos button to thank the user that helped you
Please use plain text.