Solution to resize properly transparent bitmaps

Hello everyone,

Recently, I tried to use Bitmap.scaleInto () to resize the transparent bitmap images in my application. Although this feature is a nice addition to JDE 5, it tends to produce bad results on the transparent bitmaps such as PNG24 files. The Forum posts that I found on the web for this problem talk using Bitmap.createAlpha () which restores transparency, but still produces artifacts in the final bitmap as the white edges and colours of the wicked pixels.

To resolve this problem without the use of an external library, I created the following function. He always uses scaleInto(), but in a different way. I added some comments in the service and created a screenshot showing the results before and after (don't worry about the photos, they are a part of this project, I am working currently on). I write the result here in the hope that it will help others looking to achieve the same thing. The code has been tested in JDE 5 and 6 of JDE and the sample photos have been created using different combinations of types of filters and reports l / h.

package com.patchou.ui;import net.rim.device.api.system.Bitmap;import net.rim.device.api.ui.Color;import net.rim.device.api.ui.Graphics;/** * * @author    Patchou * @version   1.01 * */public class GPATools{    /**     * Resizes a bitmap with an alpha channel (transparency) without the artifacts introduced     *   by scaleInto().     *     * @param bmpSrc        Source Bitmap     * @param nWidth        New Width     * @param nHeight       New Height     * @param nFilterType   Filter quality to use. Can be Bitmap.FILTER_LANCZOS,     *                           Bitmap.FILTER_BILINEAR or     *                           Bitmap.FILTER_BOX.     * @param nAspectRatio  Specifies how the picture is resized. Can be     *                           Bitmap.SCALE_TO_FIT,     *                           Bitmap.SCALE_TO_FILL or     *                           Bitmap.SCALE_STRETCH.     * @return              The resized Bitmap in a new object.     */    public static Bitmap ResizeTransparentBitmap(Bitmap bmpSrc, int nWidth, int nHeight, int nFilterType, int nAspectRatio)    {        if(bmpsrc== null)            return null;

        //Get the original dimensions of the bitmap        int nOriginWidth = bmpSrc.getWidth();        int nOriginHeight = bmpSrc.getHeight();        if(nWidth == nOriginWidth && nHeight == nOriginHeight)            return bmpSrc;

        //Prepare a drawing bitmap and graphic object        Bitmap bmpOrigin = new Bitmap(nOriginWidth, nOriginHeight);        Graphics graph = Graphics.create(bmpOrigin);

        //Create a line of transparent pixels for later use        int[] aEmptyLine = new int[nWidth];        for(int x = 0; x < nWidth; x++)            aEmptyLine[x] = 0x00000000;        //Create two scaled bitmaps        Bitmap[] bmpScaled = new Bitmap[2];        for(int i = 0; i < 2; i++)        {            //Draw the bitmap on a white background first, then on a black background            graph.setColor((i == 0) ? Color.WHITE : Color.BLACK);            graph.fillRect(0, 0, nOriginWidth, nOriginHeight);            graph.drawBitmap(0, 0, nOriginWidth, nOriginHeight, bmpSrc, 0, 0);

            //Create a new bitmap with the desired size            bmpScaled[i] = new Bitmap(nWidth, nHeight);            if(nAspectRatio == Bitmap.SCALE_TO_FIT)            {                //Set the alpha channel of all pixels to 0 to ensure transparency is                //applied around the picture, if needed by the transformation                for(int y = 0; y < nHeight; y++)                    bmpScaled[i].setARGB(aEmptyLine, 0, nWidth, 0, y, nWidth, 1);            }

            //Scale the bitmap            bmpOrigin.scaleInto(bmpScaled[i], nFilterType, nAspectRatio);        }

        //Prepare objects for final iteration        Bitmap bmpFinal = bmpScaled[0];        int[][] aPixelLine = new int[2][nWidth];

        //Iterate every line of the two scaled bitmaps        for(int y = 0; y < nHeight; y++)        {            bmpScaled[0].getARGB(aPixelLine[0], 0, nWidth, 0, y, nWidth, 1);            bmpScaled[1].getARGB(aPixelLine[1], 0, nWidth, 0, y, nWidth, 1);

            //Check every pixel one by one            for(int x = 0; x < nWidth; x++)            {                //If the pixel was untouched (alpha channel still at 0), keep it transparent                if(((aPixelLine[0][x] >> 24) & 0xff) == 0)                    aPixelLine[0][x] = 0x00000000;                else                {                    //Compute the alpha value based on the difference of intensity                    //in the red channel                    int nAlpha = ((aPixelLine[1][x] >> 16) & 0xff) -                                    ((aPixelLine[0][x] >> 16) & 0xff) + 255;                    if(nAlpha == 0)                        aPixelLine[0][x] = 0x00000000; //Completely transparent                    else if(nAlpha >= 255)                        aPixelLine[0][x] |= 0xff000000; //Completely opaque                    else                    {                        //Compute the value of the each channel one by one                        int nRed = ((aPixelLine[0][x] >> 16 ) & 0xff);                        int nGreen = ((aPixelLine[0][x] >> 8 ) & 0xff);                        int nBlue = (aPixelLine[0][x] & 0xff);

                        nRed = (int)(255 + (255.0 * ((double)(nRed-255)/(double)nAlpha)));                        nGreen = (int)(255 + (255.0 * ((double)(nGreen-255)/(double)nAlpha)));                        nBlue = (int)(255 + (255.0 * ((double)(nBlue-255)/(double)nAlpha)));

                        if(nRed < 0) nRed = 0;                        if(nGreen < 0) nGreen = 0;                        if(nBlue < 0) nBlue = 0;                        aPixelLine[0][x] = nBlue | (nGreen<<8) | (nRed<<16) | (nAlpha<<24);                    }                }            }

            //Change the pixels of this line to their final value            bmpFinal.setARGB(aPixelLine[0], 0, nWidth, 0, y, nWidth, 1);        }        return bmpFinal;    }}


Here's an example of how to call the function:

Bitmap bmp = Bitmap.getBitmapResource("picture.png");Bitmap bmpResized = GPATools.ResizeTransparentBitmap(bmp, 30, 60,    Bitmap.FILTER_LANCZOS, Bitmap.SCALE_TO_FIT);

Here is the result:

Let me know if you find this useful, all comments are appreciated .

Cyril

Thank you . I made a minor adjustment to the code (to check if the size of the original image is identical to the desired size). For some reason, I can't edit my original post that I posted the latest version on my blog. Links: http://www.patchou.com/2010/10/resizing-transparent-bitmaps-with-the-blackberry-jde/ .

Moderator note: I've updated the code in the original post to match the latest version.

Tags: BlackBerry Developers

Similar Questions

  • Transparent bitmap on canvas

    OK, so I'm working on a work around for this bug. Basically, I read my photo rings and generating of new canvases on which I put the pictures of the ring. Then I just put some fabric I want on top. Except that there is a problem with the transparency of the images that is lost in the process:

       int j, New, Bitmap, Left, Top, Width, Height, Pre[3]={1,3,2};   // Only some colors
        for (j=0; j
    

    I forget something on transparency?

    Yes. In fact, reading the documentation, I realized it's actually easier to use an image instead of a Canvas control. I forgot those. Detective Conan. But please could you answer my other thread on the major memory leak when using the rings of the photo, which is actually the reason why I use this work around? Thank you.

  • Transparent bitmaps have a discoloration during printing. InDesign

    It must be something simple, and I'm sorry if it is.  I have to be using the terms wrong when searching, I'm not a professional printing.  I thank in advance for any help, you may be able to provide.  I am at a loss.

    Whenever I have add a bitmap, or a png, tiff gif, which has a transparent background, I can't place it on other objects.  Whenever I do, the alpha channel prints as a slightly different color.  There is no indication on the screen, but if I print via InDesign or Acrobat after the converting to PDF a box appears.

    In the case this morning, I need to add a round stamp on a color fills the rectangle.  I tried the seal as a TIFF, png and the Native PSD.  There is only one layer, the round stamp.  I used "place" to place the object in InDesign and everything seems fine.  Here's what it looks like after export to PDF.  In Photoshop there is no color difference at all on the gray background when I took a screenshot.

    screen.png

    When I print the image, this is what I get. On some printers, the effect is not so bad, but still present.

    printed.jpg

    I worked around this problem forever, usually, I just change the design, so I need to ride anything, but is really limited.

    Any suggestions? I'm on a Windows 7 computer running InDesign and Photoshop 5.5.

    http://InDesignSecrets.com/eliminating-YDB-yucky-discolored-box-syndrome.Ph

    p

  • I can't do the hp solution center work properly. How can I fix it?

    When I click on the HP Solution Center a message error poster that says "no HP devices have been detected.  "Solution Center HP close now." The printer is HP Photosmart C4180 all-in-One.  Operating system is Windows Vista 32-bit.

    Hello

    Please follow the steps listed in the following document and reply back with the results.

    http://support.HP.com/us-en/document/c02468684

    Thank you

  • View resizes properly.

    I prefer a screen resolution of 1280 x 1024. A roommate prefers 1600 x 1200. Recently, when I lowered the resolution, the screen would not resize with the taskbar and start menu hidden 'below' to the screen. How can I get the display to resize correctly?

    Hello

    You did changes to the computer before the show?

    Method 1:
    You can update the display drivers on the manufacturer's Web site and check.
    http://Windows.Microsoft.com/en-us/Windows-Vista/update-a-driver-for-hardware-that-isn ' t-work correctly

    Method 2:
    Check out the links to find out how to change the screen resolution

    You can also run the troubleshooter for display problems and check.
    Troubleshoot monitor and video card
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-monitor-and-video-card-problems

    Method 3:
    If you are unable to change the resolution of the screen, then you can get into Safe Mode and then restore the resolution that can be displayed by the monitor.
    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    Method 4:
    If you are referring to the taskbar is hidden, you can see the article:
    Show or hide the taskbar

  • Resizing at runtime bitmap led to empty graph

    Hi all

    I'm having the darndest time to find how to create thumbnails dynamically during execution. Here is the code I have:

    <?xml version="1.0" encoding="utf-8"?>
    
    
    <mx:Module
    
     xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
    
    library://ns.adobe.com/flex/spark" xmlns:mx="
    
    library://ns.adobe.com/flex/mx"width="
    
    100%" height="
    
    100%"
    layout="
    vertical">
    
    <fx:Declarations>
    
    </fx:Declarations>
    
    <fx:Script>
    <![CDATA[
    
    import flash.sampler.NewObjectSample;
    
    
    import flashx.textLayout.events.SelectionEvent;
    
    
    import mx.collections.ArrayCollection;
    
    import mx.controls.Image;
    
    import mx.controls.ProgressBarMode;
    
    import mx.core.IUIComponent;
    
    import mx.events.DragEvent;
    
    import mx.events.ItemClickEvent;
    
    import mx.graphics.codec.PNGEncoder;
    
    import mx.managers.DragManager;
    
    import mx.modules.ModuleLoader;
    
    import mx.utils.Base64Decoder;
    
    import mx.utils.Base64Encoder;
    
    
    import spark.components.Window;
    
    import spark.events.IndexChangeEvent;
    
    import spark.primitives.Rect;
    
    
    
    private var _fileReference:FileReference;
    
    private var _fileTypeFilter:FileFilter;
    
    private var _fileLoader:Loader;
    
    
    
    
    protected function btn_files_clickHandler(event:MouseEvent):void{
    
    this._fileReference = new FileReference();
    
    this._fileTypeFilter = new FileFilter("Typical Genealogy Source Files", "*.pdf;*.doc;*.jpg;*.jpeg;*.png;*.gif");
    
    this._fileReference.addEventListener(Event.SELECT, fileSelectHandler);
    
    this._fileReference.addEventListener(ProgressEvent.PROGRESS, loadingHandler);
    
    this._fileReference.addEventListener(Event.COMPLETE, loadPictureHandler);
    
    this._fileReference.browse([this._fileTypeFilter]); }
    
    
    
    private function fileSelectHandler(event:Event):void{
    
    this._fileReference.load();}
    
    
    
    private function loadingHandler(event:ProgressEvent):void{
    
    this.prb_fileUplaods.setProgress(event.bytesLoaded / event.bytesTotal * 100, 100);
    
    trace((event.bytesLoaded / event.bytesTotal * 100).toString() + " precent loaded.");}
    
    
    
    private function loadPictureHandler(event:Event):void{
    
    this._fileLoader = new Loader();
    
    this._fileLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, pictureLoadedHandler) ;
    
    this._fileLoader.loadBytes(this._fileReference.data) ;}
    
    
    
    private function pictureLoadedHandler(event:Event):void{
    
    var original:BitmapData;
    
    var bmd:BitmapData = Bitmap(event.target.content).bitmapData;
    
    var originalWidth:Number = Bitmap(event.target.content).loaderInfo.width;
    
    var originalHeight:Number = Bitmap(event.target.content).loaderInfo.height;
    
    var m:Matrix = new Matrix();
    m.scale(100/originalWidth, originalHeight/100);
    original = 
    
    new BitmapData(100, 100); original.draw(bmd, m);
    
    
    this.img_test.source = bmd.getPixels(bmd.rect);
    }
    
    
    ]]>
    
    
    </fx:Script>
    
    
    <mx:ProgressBar id="prb_fileUplaods" labelPlacement="center" height="20" mode="{ProgressBarMode.MANUAL}" />
    
    <s:Button label="Choose File(s) ..." id="btn_files" height="20" click="btn_files_clickHandler(event)" />
    
    
    <mx:Image id="img_test" />
    </mx:Module>
    
    </mx:Modu<
    
    
    
    
    
    
    

    No idea what I am doing wrong?

    Thank you very much for all the help, I was challenging my brain with this wall of brick for the last two weeks!

    ~ Mike

    Hello

    the following works, note that if you upload an image, you must convert the bitmapdata to an image format (I did it for you) you just need to add the download to.

    David.

    http://ns.Adobe.com/MXML/2009"xmlns:s ="library://ns.adobe.com/flex/spark ".

    xmlns:MX = "library://ns.adobe.com/flex/mx" >

    Import mx.controls.ProgressBarMode;

    Import mx.graphics.codec.JPEGEncoder;

    private var fi: FileReference = new FileReference();

    private var ff: FileFilter = new FileFilter ("images", "*.jpg; *.gif; *.png");

    private var fl:Loader = new Loader();

    protected function btn_files_clickHandler(event:MouseEvent):void

    {

    fi.addEventListener (Event.SELECT, fileSelectHandler);

    fi.addEventListener (Event.COMPLETE, loadPictureHandler);

    fl.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete);

    fi. Browse ([FF]);

    }

    private void onComplete(event:Event):void

    {

    var originalWidth:Number = event.currentTarget.content.loaderInfo.width;

    var originalHeight:Number = event.currentTarget.content.loaderInfo.height;

    var m:Matrix new matrix());

    var scale: Number = originalWidth/100;

    m.Scale (scale, scale);

    var newBmD:BitmapData = new BitmapData(100,originalHeight*scale);

    newBmD.draw (event.currentTarget.content.bitmapData, m);

    var ba: ByteArray = new ByteArray();

    var Encoder: JPEGEncoder = new JPEGEncoder (100);

    BA = encode. Encode (newBmD);

    img_test1.source = ba;

    }

    private void fileSelectHandler(event:Event):void

    {

    fi. Load();

    }

    private void loadPictureHandler(event:Event):void

    {

    img_test4.source = fi.data;

    fl.loadBytes (fi.data);

    }

    ]]>

  • IllegalArgumentException loading Server Image

    I'm pretty much have the same problem with the user in this THIS thread. The only difference is that my file is not on the SD card, rather I put through the HttpConnection. Fix the other user was using () (FileConnection) conn.fileSize;

    How can I get the file size of the file on the server, so I can put the byte [] to be big enough? I have several pictures of different size on the server, and the smaller work very well. This is why I'm sure it's the same problem. Any help would be appreciated. Thank you.

    Here is my code:

    public static EncodedImage getImage(final String url){
            try {
                HttpConnection conn = (HttpConnection) Connector.open(url);
                conn.setRequestMethod(HttpConnection.GET);
                InputStream fileIn = conn.openInputStream();
                byte[] b = IOUtilities.streamToBytes(fileIn);
    
                return EncodedImage.createEncodedImage(b, 0, b.length);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                return null;
            }
        }
    

    Or is there a better way to downoading an image from a server? All these files are .jpg, if it's important.

    By the way: there is a draft of the article in the knowledge base entitled

    Resizing of transparent bitmaps

    If you can't get there by following the link above, click on 'Board options' at the top of the opinion of the House, next to the "New Message" button - the first point it is "Knowledge Base dashboard. Select it, and then switch to the 'Projects' tab and click on the title of the article. Even if she is still awaiting publication, it's a complete and mature code. Do not reinvent the wheel!

    Given that this article began as a post here, you can also just search for it in this forum.

    End side

    To implement what I said, look for the following two design patterns (google them and seek specific Java implementations - there must be some):

    (1) producer-consumer model

    (2) model Subscribe-publish (also known as the "Observer")

    You use the entries first for the download thread of media as the consumer (of media download) and your screen as the producer of such entries.

    In the second, your screen ('producer' in the previous sentence) subscribes to events published by the media ("consumer") - download thread these events can include download finished (yay!), failed to download, download progress (not necessary for you at the present time, but it could be useful in the future), etc..

    TimerTask - the Javadoc for that is really sufficient to get you started. Make sure you have BlackBerry API reference open in a tab in your browser at any time - you will need it often.

  • Resize the Bitmap and get changed background = /...

    Hi I have a simple code for mounira a bitmap, but, when I get the new resized Bitmap of it have a black background? and I don't want to. Here's the code.

    public class ImageUtils {
    
        public static Bitmap resizeImage(Bitmap originalImage, int newWidth, int newHeight) {
            Bitmap newImage = new Bitmap(newWidth, newHeight);
            originalImage.scaleInto(newImage, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);
            return newImage;
        }
    }
    

    Try this:

    http://supportforums.BlackBerry.com/T5/Java-development/resizing-transparent-bitmaps/Ta-p/703239

  • Try to resize a bitmap - FASTJPEG: progressive decoding is not supported

    Hi all

    I went through the forums and tried many examples to remedy this, but none of them have worked.

    I download a .jpg file from a URL of site Web, internal to our society, to get a photo of the employee.

    I then use the code to resize the image to 100 x 100, no matter what the image is the size I need to resize to 100 x 100.

    The last code I tried is as follows:

    EncodedImage image = EncodedImage.createEncodedImage(imageBytes, 0, imageBytes.length); 
    
            int currentWidthFixed32 = Fixed32.toFP(image.getWidth());
            int currentHeightFixed32 = Fixed32.toFP(image.getHeight());
    
            int width = 100;
            int height = 100;
    
            int requiredWidthFixed32 = Fixed32.toFP(width);
            int requiredHeightFixed32 = Fixed32.toFP(height);
    
            int scaleXFixed32 = Fixed32.div(currentWidthFixed32, requiredWidthFixed32);
            int scaleYFixed32 = Fixed32.div(currentHeightFixed32, requiredHeightFixed32);
    
            image = image.scaleImage32(scaleXFixed32, scaleYFixed32);
    
            return image.getBitmap();
    

    However, it is not hidden image and gives me the following error:

    FASTJPEG: Progressive decoding is not supported

    It does not for all images, only some of them.  I discovered that the images in this case on images jpeg at 300 dpi, while those who work well is 96 dpi.  Is this the reason why?  Is there a way that these images can be resized properly, even if they are 300 dpi?

    I have not control how these images are saved in our society, I just have to get them via Http and resize them to display nicely on the Blackberry screen.

    Thanks for any help you can give.  I will continue to try other things as much as possible.

    Kind regards

    David

    If you work with OS 5.0 +, you can try the native Bitmap scaling methods provided.

  • Resize a lot of BItmaps UI?

    Hello

    I need to add images in the app, but I need to do the photos are recommended for 3 types of phone screen (large, medium, small) and the zoom scale when it starts, but because the images are so many, and they use a lot of memory.

    Would be much appreciated if you could provide me some resolutions or indices. Thanks in advance.

    Here's what I did today:

    ...
    bgBitmap = Bitmap.getBitmapResource ("bg.png");
    bgBitmap = ImageUtility.getResizedBitmap (bgBitmap, newRatio);
    ...

    Here's what I recommend:

    -Use only the large of images.

    -Use this class by Patchou: http://supportforums.blackberry.com/t5/Java-Development/Resizing-Transparent-Bitmaps/ta-p/703239 it's simple and easy to use (it works for png with transparency bgs).

    -Detect the size of the screen of the user using Display.getWidth () and Display.getHeight (), use this information in a custom class to determine how (or if) you will scale of images. In general, you can create ranges using only the height, there are currently 7 different heights with BB devices: 240, 260, 320, 400, 480, 640, 800.

    -If you have many, many, many of the images, you can store these images on the scale in the user cache. This would improve performance in the future (so you would only scale images once).

  • How can I re size bitmap while keeping the original my png transparency?

    Greetings and regards other developers, a few quick details, I use the blackberry JDE 5.0 and Eclipse.  I am for programming multiple phones Storm2 and all models of the torch.  The display area is different between some of the phones of 480 x 360 to 800 x 480.

    I created a method of resizing of the images based on the ratio of aspect here.

    public static Bitmap AspectRatio(Bitmap bm)
          {
            int widthRatio = (int)(360 / bm.getWidth());
            int width = (int)(Utility.SCREEN_WIDTH / widthRatio);
            int heightRatio = (int)(480 / bm.getHeight());
            int height = (int)(Utility.SCREEN_HEIGHT / heightRatio);
            Bitmap temp = new Bitmap(width, height);
            bm.scaleInto(temp, Bitmap.FILTER_BILINEAR);
            return temp;
          }
    

    This method works very well until I have try with my transparent Bitmaps.

    The transparent part of the my bitmaps are black and im not sure how to keep transparent.

    Example below.

    Front

    After

    How to keep my opacity after stretching?

    Thanks in advance.

    Not your problem.  Try this code that works for me:

    http://supportforums.BlackBerry.com/T5/Java-development/resizing-transparent-bitmaps/Ta-p/703239

  • problem with the transparency of PNG images on evolution

    I'm trying to display a picture of *.png with transparency. If I create a bitmap of it field, it displays well with transparency.

    But if I resized the image and the screen then using BitmapField, the black of displays of transparent areas.

    Does anyone have any idea on this?

    I recommend that looking for before you post a question.  This question has been asked and answered a few times already.

    Here is the solution:

    http://supportforums.BlackBerry.com/T5/Java-development/resizing-transparent-bitmaps/Ta-p/703239

  • How to dynamically set the width of the bitmap as mobile size and adjust accordingly the photo.

    I have the bitmap image. Now, I want the bitmap to the screen but its size should be as mobile width and adjust the picture accordingly. For the former I enlarge it should look like small small mobile screen.

    My code but its not working.

    public static BitmapField getHeader() throws NullPointerException {}
    Bitmap b = Bitmap.getBitmapResource("img/logo.jpg");
    return (new BitmapField (b, Field.FIELD_HCENTER) {})
    Protected Sub layout (int width, int height) {}
    setExtent (365, 80);
    }
    });
    }

    You will need to put the image yourself to match the dimensions you need.

    Watch Bitmap.scaleInto)

    If you have transparent images, then watch this:

    http://supportforums.BlackBerry.com/T5/Java-development/resizing-transparent-bitmaps/Ta-p/703239

  • problem of writing bitmap

    I have a bitmap to write, this is the code I use:

            // array is my 0-1 indicator matrix
            int[] imgdata = new int[width*height];
            Bitmap bitmap  = new Bitmap(width, height);
            for (int y = 0; y < height; y++) {
                for (int x = 0; x< width; x++){
                    if (array[y][x] == 0)
                            imgdata[y * width + x] = 0x00FFFFFF;
                    else
                            imgdata[y * width + x] = 0x00000000;
                    }
            }
    
    bitmap.setARGB(imgdata, 0, width, 0, 0, width, height); //if visualize it is white~~~
    
    // resize to large bitmap
    
            Bitmap retmap = new Bitmap(5*width, 5*height);
            bitmap.scaleInto(retmap, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FIT);
            return retmap;
    

    But the image turn out to be like this:

    I want only the transparent matrix but it gives me a blurred image.

    Anyone know how to convert a 0-1 matrix to a bitmap and resize this blur without it?

    Sorry, I can't see your picture...

    and I think that the tour is intended to make white becomes black and black becomes white, is it?

    I think the blur effect, it is because you put across the 5 times larger and using Filter_bilinear...

    try to read in wiki article abou image resizing

    http://en.Wikipedia.org/wiki/Image_scaling

  • scaling of bitmap problems

    Hi, I'm doing my compatible application on all phones, and I came to a roadblock.

    -the sNormButton parameters are just an experiment to see if it works

    -the normal parameters of the image are 40 x 20 cm I think

    -everything works perfectly before putting in the code of scaling

    -at the moment is to find a null pointer exception when I trigger the image

    Here is my code on the screen:

    Bitmap SNormButton = new Bitmap (10.5);

    .......

    public mainUIScreen()
    {
    Super();
    ......

    If ((Display.GetWidth () == 320) & (Display.getHeight () == 240))
    {
    A.newGame.scaleInto (sNormButton, Bitmap.FILTER_BILINEAR);
    }

    .....

    newGameBut = new BitmapButtonField (A.newGame, A.newGameUp);
    newGameBut.setChangeListener (this);

    I'm new to the thing scaled so all words of advice are greatly appreciated, thank you!

    Is this for 5.0 and above?

    If so, use this class for scaling: http://supportforums.blackberry.com/t5/Java-Development/Resizing-Transparent-Bitmaps/ta-p/703239 it is clean and works with images that have transparent backgrounds (which the BB SDK does not work).

Maybe you are looking for

  • You can access time capsule iTunes library using the Airport express

    Hello I I have an Apple Airport express and listen to music from my iTunes library on my MacBook Pro. I have just bought a Time Capsule from Apple and saved my MacBook to this. I would like to listen to the music of my Time Capsule, as is always on.

  • Communication Serial Port without a VISA

    Is it possible to connect to the serial port without a VISA? The thing is that the VISA is required to be installed on the deployed machine. It is not for my client. Thanks for any help.

  • I can't activate my Windows XP pre-installed from Dell.

    INSTALLED AT THE FACTORY OF REGISTRY WINDOWS XP I bought my Dell Inspiron 2200 in 2003 online directly from Dell. It came pre-installed with everything and I didn't save anything.  However, now I have to activate it, and although the helpline is to a

  • reconnect the stall network of shared network variables

    I have a cRIO unit communicates with a laptop using shared network Variables, one of them being a table of 21 index which is buffered. The system connects and communicates very well, but sometimes the wireless laptop card is to lose the signal from t

  • BlackBerry Smartphones has been sent down for a while on 30-03-09?

    Hello I had many problems to receive email on my BB 8330 since I bought it. Sometimes it works, sometimes it doesn't. Ive had books sent me several times, deleted on the BB (for Verizon), from battery. I think I did all that. Now he sent me a 'refurb