How to resize the Bitmap

I have a bitmap with lets say the size 200 x 100 and I want to create a bitmap with size 200 x 200 and the first bitmap to be drawn in the news and have offset of 50px from the top and bottom of the new bitmap?

How can I do this and be compatible with OS > = 4.6. I see in the OS 5.0, we have a method scaleInto in the class Bitmap - http://www.blackberry.com/developers/docs/5.0.0api/

Yes, in this way, the obstacle is buffer of the Blackberry chart which is available only twice the size of the screen.

Another option is to obtain Bitmap of RGB and that put the RGB right in the right place int this new Bitmap.

Tags: BlackBerry Developers

Similar Questions

  • How to resize the Bitmap when running?

    Hello

    I created a Bitmap that reads directly from a file. The actual size of the image (test.png) is 360 x 50. I displayed this bitmap image in a BitmapField.  Now, I want to display this image in my application so that it should take the width of the screen and adjust (expand or compress) so based on the TILT of the device (in the case of BB storm). My code is as below:

    {
       Bitmap image = Bitmap.getBitmapResource("mainmenu_green.png");
        BitmapField bmpMainMenu = new BitmapField(image);
    
        MenuScreenVFM verticalManager = new MenuScreenVFM();
        verticalManager.add(bmpMainMenu);
        add(verticalManager );
    }
    
    //MenuScreenVFM  Class..
     static class MenuScreenVFM extends VerticalFieldManager
     {
            // Constructor
            private MenuScreenVFM()
            {
                super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | VerticalFieldManager.FIELD_HCENTER);
            }
    
           net.rim.device.api.ui.container.VerticalFieldManager#sublayout(int,int)
             */
            protected void sublayout(int width, int height)
            {
                int nTop = 65;
                Field field = getField(0);
                layoutChild(field, Display.getWidth(), 40);
                setPositionChild(field, 0, nTop);
                setExtent( Display.getWidth(), Display.getHeight());
            }
    }
    

    The image must stretch/compress based on the width of the screen. Any info/code would be really appreciated.

    Thank you

    -DK

    I created a CustomBitmapField extends the field and for the scaling of the image, I used the following code:

       public static EncodedImage scaleImageToWidth(EncodedImage encoded, int newWidth) {
                 return scaleToFactor(encoded, encoded.getWidth(), newWidth);
       }
    
        public static EncodedImage scaleImageToHeight(EncodedImage encoded, int newHeight) {
               return scaleToFactor(encoded, encoded.getHeight(), newHeight);
        }
    
        public static EncodedImage scaleToFactor(EncodedImage encoded, int curSize, int newSize) {
             int numerator = Fixed32.toFP(curSize);
             int denominator = Fixed32.toFP(newSize);
             int scale = Fixed32.div(numerator, denominator);
    
             return encoded.scaleImage32(scale, scale);
        }
    
      protected void paint(Graphics graphics) {
            graphics.setColor(backgroundColour);
            graphics.drawImage(0, 0, Display.getWidth(), fieldHeight,   this.scaleImageToWidth(bmpBG, Display.getWidth()), 0, 0, 0);
               }
    

    I would like to know if it works... If works please set Bravo... that will encourage those who post the solution

    Kind regards

    -DK

  • How to resize the image to ImageSnapshot?

    Hey guys... so im taking a picture of a movie clip using ImageSnapshot.captureBitmapData (myClip);

    I need to resize the bitmap data that I'll be back, the size must be 720 X 486

    the code I have is...

    var myClip:MovieClip = event.target as MovieClip;
    
    var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myClip);
    var pngEncode:PNGEncoder = new PNGEncoder();
    var ba:ByteArray = pngEncode.encode(imageBitmapData);
    

    any ideas? I tried to use the matrix.scale, but I guess I did not understand how to use wisely...

    any help is greatly appretiated!

    Thank you

    Hello

    so why sleep going

    This function will just take your display object and return to what you want to spend the final width you need and it works the scaling for you, you could do more complex comparing say the width and the final height to calculate the "best fit" but well...

    David.

    private function scale (content: DisplayObject, width: int): BitmapData

    {

    var scale:Number = width/content.width;

    var BD: BitmapData = new BitmapData(content.width*scale,content.height*scale);

    var mt:Matrix new matrix());

    Mt.Scale (Scale, Scale);

    EDI Draw(Content,MT);

    Return to comics;

    }

  • How to resize the print size of an item within my PDF to multiple pages? For example a receipt or another image that can scan in bigger or smaller than my 8.5 x 11 Bill?

    How to resize the print size of an item within my PDF to multiple pages? For example a receipt or another image that can scan in bigger or smaller than my 8.5 x 11 Bill?

    Hello

    In the print dialog box, you would get options to resize your document.

    Try them and see if that helps.

    Once you choose the print option, it would give options to change the size of the page you need.

    Please check and see if it suits you or not.

    Concerning

    Sukrit diallo

  • additional horizontal space in code view no matter how I resize the window

    on dreamweaver OSX10.10.2 CC 2014.11 I can still scroll horizontally on two characters in code view, no matter how I resize the window

    Hello Greg,.

    The screenshots, has explained the issue!

    It is present in previous versions of DW as well & only happens for PHP files. Nevertheless, I logged a bug for this.

    As a solution for the moment, you can simply activate and deactivate the option of film word in horizontal mode Code to get rid of the scroll bar.

    Thank you

    Delphine

  • How to resize the width of the region

    Hi all

    I use apex 4.2.2 database oracle 11g R2, IE 9.

    I created a region on the HOME tab to the navigation menu.
    but its width is covering the width of the entire page.
    How could resize the width of the navigation region?

    Thank you very much.

    Hi Maahjoor,

    Change the region and

    In the Region attributes set style = ' width: 300px; " instead of 300, you can put all desired widths.

    hope this helps you.

    Kind regards
    Jitendra

  • How to resize the window elements 11 photoshop on mac? no green +.

    How to resize the window elements 11 photoshop on mac? No button green + out of the screen.  cannot resize monitor - no option on macpro

    Go to System Preferences > displays and your descent of resolution. Let the OS X to open with the new resolution. Place it back up to the highest available resolution and the window should position themselves correctly.

  • How to resize the dialog box that runs everything in baGetFolder order.

    Dear friends

    I'm very new Director and in collaboration for the project which is already developed by some other providers. in this project, I have to implement the mentioned below requirment so someone can pls help me on this will be greatfull.

    How to resize the dialog box that appears while baGetfolder command triggers. Actualluy problem that I face is that the title of the dialog box extends its width so the title turns out to be incomplete with «...» ", how can I solve this problem? It's very urgent requirment and eagely waiting for your response.

    Thanks in advance

    So how about:

    gBackPath = baGetFolder("/", "Veuillez sélectionner un répertoire de
    sauvegarde pour les fichiers de votre base de données: ", 1, "", 100, 50)
    

    (Note that the parameter 'options' has been changed to 1)

  • How to resize the name of add-on Firefox

    The names of some add-on are too big on the toolbar (top) 31 FF. How can I change my name or resize the icons?

    You must use the DOM Inspector to find the ID of each button and set the text of the label max width (this will add an ellipsis) or provide a new text for the label.
    You can do this with the code in the userChrome.css file.

    Add code to the file userChrome.css below default @namespace.

    Here is an example for extension changer TFS:

    @namespace url("https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #themefontsizechanger-toolbarbutton .toolbarbutton-text {
     visibility:collapse!important;
    }
    #themefontsizechanger-toolbarbutton:after {
     content:"ThemeFS";
     display:-moz-box;
     font-size:12px;
    }
    

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the folder of chrome in the Firefox profile folder.

  • How to resize the awesome bar in 10.0

    I have Firefox 10.0 on my new computer. I tried to resize the awesome bar as I did on my other computer by the chrome of the user in the containing folder, but there is no chrome user in this folder that contains. is there another way to resize the awesome bar?

    Place the mouse pointer between the address bar and the search bar, and it will become an icon of resizing that you can drag to the right or left to adjust the relative size of the two bars.

    If you have a few buttons between the address bar and the search bar, you can place the button on left side of the address bar or on the right of the search bar.

    Check and tell if its working.

  • How to resize the to-do bar?

    Original title: help!

    Something happened to the blue taskbar down at the bottom.  It is now twice its size and I can't go back.  Of course - I don't know how I changed it.  Also - I know have 2 icons in Outlook and cannot get rid of the one.  I played with the settings and can not solve a problem.  The only 'close' solution is to completely remove the bar downstairs.  Any ideas?

    Hi SG_2011,
     
    First uncheck the option "lock the taskbar" because when the taskbar is locked, the resize handles are not visible.
     
    a. right click on the taskbar, uncheck the 'lock the taskbar' option in the menu that appears.
     
    To change the size of the taskbar, follow these steps:
     
    a. move the mouse pointer to the thin bar that appears on the upper of the taskbar until the pointer turns into an arrow with two heads.
     
    b. hold down the left button of the mouse and drag the upper part upwards or downwards until the taskbar is the desired width, then release the mouse button.
     
    Note: If the taskbar appears to be "stuck" between double height and no height, drag a dotted vertical resizing doesn't handle to the row above it. Then drag the top edge of the taskbar a notch.
     
    Once you resize the taskbar, lock the taskbar to prevent resizing the taskbar.
    Refer to this article to do the same thing:
     
    For the issue of Outlook, just right click on the Outlook icon icon and select Delete. You should now be able to remove the icon.
  • 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

  • How to change the bitmap image in blackberry

    Hello

    1. work on the version of BB storm (9500/9530 Simulator) is v4.7.0.75
    2 opportunity BB JDE 4.7
    3. the request is:

    I display a bitmap image by using the drawBitmap method. now I want to select a portion of the bitmap, and then I need to cut & paste the part somewhere in the screen (MSPaint we have option 'Select').

    is there any method that will make the similar operation (or) any idea to accomplish this in blackberry.

    Thank you

    Sendhil Kumar V

    Take a look at this thread and refers to the J2ME code:

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=24929

    The 'trick' is getARGB() and setARGB().  As long as you check out relevant Bitmap Moose ARGB values, you should be able to create a new Bitmap.  That said, I never did.  Let us know how you go.

  • How to put the bitmap in dialogue instead of exclamation mark alert?

    Hi guys,.

    How do I replace the bitmap in place and place the exclamation on the alert dialog box.

    Thanks in advance.

    Narendra

    See this article:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

  • How to resize the size of the monitor back to normal screen

    Windows 7 Home Premium. Everything works fine except, Wednesday l found the problem on the taskbar.
    My problem is that: I'm not able to get the clock and some of the notification in the taskbar icons.
    All these are staggered on the screen and do not appear in the taskbar.
    How do l resize the length of the taskbar? or retrieve the notifications mentioned above.

    Hello Alfred.

    Thank you for the information.

    Screenshot, it seems that the screen size is correct by Windows.

    If you still have questions try resetting the default monitor settinngs. You can see the monitor manual to reset the default monitor settings.

    Thank you

Maybe you are looking for