Bitmap scaling problem

I have a simple yet unusual problem... I can't scale a bitmap despite the use of scaleinto class. BTW, I use the BB Torch Simulator.

My code is as follows:

Create background bitmap

Image bitmap bmpBkg = Bitmap.getBitmapResource ("sunlight2.png");

Bitmap scaling

Scaledbitmap bitmap =new Bitmap (Display.getWidth (),Display.getHeight ());

bmpBkg.scaleInto (scaledbitmap, Bitmap.FILTER_BILINEAR);

The problem is that even after the operation of scaleinto the height and width of the bmpBkg remain the same...?

Can someone help me with this please?

Thank you.

According to me, Miss me something here:

After:

bmpBkg.scaleInto (scaledbitmap, Bitmap.FILTER_BILINEAR);

isn't the Bitmap scaling in scaledbitmap rather than bmpBkg?

Tags: BlackBerry Developers

Similar Questions

  • Implement the bitmap scaling as a backdrop for MainScree

    Newbie here. Well, I know that there's much out there on what I just spent the largest part of this holiday weekend trying to achieve. Here's what I'm trying to do:

    1. I have a bitmap png file that is large enough to accommodate the larger size of the screen.

    2. I need the title bar on a screen.

    3 I need bitmap scaling down to adjust the device existing rest area non-defilement as a background.

    4 I am on OS 5.0 or higher (am NOT interested by implementations of 4.x)

    5. I would like to use the setBackground (BackgroundFactory things if possible.

    First thing, I've tried:

    1. I can't scale carried out with the help of a routine I found in positions that scales an image coded. It seems to work very well, but it takes as parameters Display.getWidth and Display.GetHeight and the height will be turned off because it includes the height of the title bar.

    2. I can pass the bitmap scaling the setBackground (... well BackgroundFactory of things.

    The problem is that the lower part of the image is cropped by what seems to be at the height of the title bar. So I went then on a safari in trying to find a way to determine the height of the title bar. Was able to get the height by substituting the method sublayout as one of the positions. That's nice, but the sublayout does not draw after the manufacturer of the screen which is where I would need to adjust the scale value. I also tried the override of the method of painting (both on-screen and in a clever separate VerticalFieldManager (thanks to BB_DUDE).

    I'm puzzled not to mention frustrated as you can guess. Surely this issue was properly resolved for 5.0 installation? I know I'm a newbie, but I am at a loss to continue. I've seen all the posts that just say 'the search will give you an answer. " I searched for two days! What I don't understand is why the background don't lie not in the title bar? (It's below everything else!). I understand the definition of a new value for money approach, but I still couldn't it either works. The implementation of the missions I've tried always have cropped down image. There must be something obvious that I'm on. It can't just be this hard! I am at the point to forget the title bar and build my own that will sit on top of the background

    Any help would be appreciated! (Yes, I saw the screen explained as well).

    Well, after dinner, drinks and meditation I have revisted the questions. Here's my situation:

    My first implementation was:

    this.getMainManager () .setBackground (BackgroundFactory.createBitmapBackgroundUtilities.GetBackgroundImage));

    where Utilities.GetBackgroundImage () is my method of support of:

    CImage EncodedImage = EncodedImage.getEncodedImageResource ("bottomlogobackground.png");

    EncodedImage sImage = Utilities.SizeImage (CImage,Display.getWidth (),Display.getHeight ());

    Return sImage.getBitmap ();

    I think that my mistakes to be:

    a. the encoded image and image logical size is extracted from some forum posts. I miss-interpreted that the scale must take place before the call to the method BitmapFactory.createdBitmapBackground ().

    (b) "control" me was not recognizing that the BackgroundFactory.createBitmapBackground () method has an overload to allow not only the alignments of XY, but the 3rd parameter to indicate the appropriate size! DOH!

    My successful implementation is:

    Bitmap Imagearriereplan = Bitmap.getBitmapResource ("bottomlogobackground.png");

    this.getMainManager () .setBackground (BackgroundFactory.createBitmapBackground (backgroundBitmap, Background.POSITION_X_LEFT, Background.POSITION_Y_TOP, Background.REPEAT_SCALE_TO_FIT));

    No need to do any scaling before the call so I can eliminate my routines of support for 'Utilities '. It seems to work very well. In addition, all this is done against the Manager of vertical not with default scrolling field, i.e. I don't have to create a subordinate value.

    If anyone knows the faults of the above, let me know. It seems to work correctly. I'll be making additional GUI development now (probably I will have others not of fake beginner!)

    Thanks for the ear...

  • Controls not destructive bitmap scaling in the FW

    Hi everyone, I was doing research if the new FireWorks CS3 handles transformations of scale - as does Indesign, non-destructive.

    The problem: when you place a bitmap in FW and resize it, pixel data are retired or interpolated (upwards or downwards), and increase of additional refinements of scaling the image degradation. (Photoshop is that there are much too). On the other hand, Indesign will scale only a preview or a proxy of the image and updates the display bitmap in the source file. Therefore, no data is lost when the design changes.

    The goal is to be able to prototype and create a presentation with maximum freedom. Thoughts?

    Alex, great suggestion - I had not thought of that. I've only experimented with it... beautiful! At first, I noticed the absence of the possibility to crop the symbol (edit--> selected bitmap harvest) directly in order to have multiple instances with different croppings... but then the workaround is just to create a mask for each instance.

    I think my problem is solved...

    Quote:
    Select the bitmap into a graphic symbol.

  • Custom bitmap focus problem with toolbar

    Hi all

    I'm new development of BB.

    I have screen with the title bar and after a toolbar customized

    The custom toolbar contains 3 bitmaps in the side chain and the left text right.

    Logo 'text'---> title bar

    Image1 image2, image3 "screenName"---> toolbar custom

    ListField

    Three images are created using the bitmap.

    I get the focus on the full range.

    But I want to focus on the first image, image1 when the application runs.

    If the user navigates the screen using the keyboard, change of focus to the next image, which is image2 and so on.

    How can I do that.

    I use the Blackberry API 4.2.1

    My current code for the toolbar is like that

    package com.pebbletalk.blackberry.ui;
    
    import com.pebbletalk.blackberry.defines.PTDefines;
    import com.pebbletalk.blackberry.utils.CustomFont;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.DrawStyle;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.component.BitmapField;
    
    public class ToolBar extends Field implements DrawStyle
    {
        private int fieldWidth;
        private int fieldHeight;
        private int backgroundColor;
        private String toolBarName = "";
    
        private Bitmap homeIcon = Bitmap.getBitmapResource("go-home-1_16x16.png");
        private Bitmap searchIcon = Bitmap.getBitmapResource("search-1_16x16.png");
        private Bitmap refreshIcon = Bitmap.getBitmapResource("reload-1_16x16.png");
    
        public ToolBar(String toolbarName)
        {
            super(Field.FOCUSABLE);
            fieldHeight = Display.getHeight()/10;
            fieldWidth = Display.getWidth();
    
            // Setting background color to white
            backgroundColor = Color.BLACK;
    
            toolBarName = toolbarName;
    
        }
    
        public Bitmap getHomeIcon() {
            return homeIcon;
        }
    
        public int getPreferredHeight()
        {
            return fieldHeight;
        }
    
        public int getPreferredWidth()
        {
            return fieldWidth;
        }
    
        protected void layout(int arg0, int arg1)
        {
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    
        protected void paint(Graphics graphics)
        {
            int height = this.getPreferredHeight();
            int width = this.getPreferredWidth();
    
            int left = this.getLeft();
            int top = this.getTop();
    
            graphics.setColor(backgroundColor);
            graphics.fillRect(0, 0, width, height);
    
            //graphics.drawBitmap(left, top, width, height, homeIcon, 0, 0);
            graphics.drawBitmap(left, 5, width, height, homeIcon, 0, 0);
            //int currentX = graphics.getTranslateX();
            //int currentY = graphics.getTranslateY();
            int homeIconWidth = homeIcon.getWidth() + 5;
            graphics.drawBitmap(homeIconWidth, 5, width, height, searchIcon, 0, 0);
            int searchIconWidth = homeIconWidth + searchIcon.getWidth() + 5;
            graphics.drawBitmap(searchIconWidth, 5, width, height, refreshIcon, 0, 0);
            int refreshIconWidth = searchIconWidth + refreshIcon.getWidth() + 5;
    
            CustomFont titleFont = new CustomFont(Defines.TOOLBAR_DASHBOARD_TITLE_FONT_FACE, Defines.TOOLBAR_DASHBOARD_TITLE_FONT_SIZE, Defines.TOOLBAR_DASHBOARD_TITLE_FONT_STYLE);
            graphics.setFont(titleFont.changeFont());
    
            Font currentFont = graphics.getFont();
            int textLength = currentFont.getAdvance(toolBarName, 0, toolBarName.length());
            textLength += 5;
            System.out.println("width : "+ width);
            System.out.println("refreshIconWidth : "+ refreshIconWidth);
            System.out.println("textLength : "+ textLength);
            int remainingWidth = width - refreshIconWidth;
            System.out.println("remainingWidth : "+ remainingWidth);
            int startPosition = remainingWidth - textLength;
            System.out.println("startPosition : "+ startPosition);
            int newX = refreshIconWidth + startPosition;
            System.out.println("newX : "+ newX);
            //int xPosition = width - refreshIconWidth;
            //System.out.println("tool x : "+ xPosition);
    
            graphics.setColor(PTDefines.TOOLBAR_DASHBOARD_TITLE_COLOR);
            graphics.drawText(toolBarName, newX, 5, (DrawStyle.RIGHT | DrawStyle.LEADING) );
        }
    }
    

    and my toolbarScreen code is

    MainScreen mainScreen = new MainScreen(Screen.NO_VERTICAL_SCROLL);
    
            //MainScreen mainScreen = new MainScreen();
    
            // add custom title bar
            mainScreen.add(titleBar);
    
            VerticalFieldManager verticalFieldManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)
            {
                public void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(Color.WHITE);
                    graphics.clear();
                    super.paint(graphics);
                }
                protected void sublayout(int maxWidth, int maxHeight)
                {
                    int displayWidth = Display.getWidth();
                    int displayHeight = Display.getHeight() - titleBarHeight;
                    super.sublayout(displayWidth, displayHeight);
                    setExtent(displayWidth, displayHeight);
    
                }
            };
    
            //now add everything in the verticalManager
    
            // add custom toolbar
            mainScreen.add(toolBar);
            mainScreen.add(new SeparatorField());
    

    Please help me to solve my problem.

    Remember that the BlackBerry smartphone focuses on a field, not a picture.  Your toolbar is only a field, so one thing to focus on which is the Blackberry's.

    You have two choices:

    (a) change your toolbar to be a Manager and have several fields that it contains.  You can make a HorizontalFieldManager and assuming that the other things are set correctly (in particular the width of the fields that you add) this will do what you want.

    (b) substitute events in development movement in your toolbar to make it appear focus is moved.

    I think the second option is more difficult, especially when you start to take the touch screen into consideration.  However, with the second option, you get a much easier control over the look of your toolbar.  But I'd go with the first one, as I think it is easier for new programmers.  Initially, I wouldn't get to hung up on the appearance of the toolbar, get it works the way you want and then try to get it looking right.

  • scaling problems with the DAQ hardware help

    I am a new user and I'm trying to do a simple scaling of my entries of tension using the DAQ help. For example: a channel entered around 8V on a 0 to 10V input selection. I'm trying to resize it (linear) to show me around 28V using y = mx + b formula. My value of m is 3.2 and b 0. What DAQ Assistant bed is close to 16V instead of 25V (3.2 * 8). I custom make several scales, basically multiplying the entry of 2, 3, 4, 5, & but none exits causes what I expected according to the formula, and even the 5 x the value decrease. If I go to "not to scale", I read 8V, which is what actually happens in the 6255 map. Any thoughts?

    Hello DB66.

    Remember that the scope of the input Signal must be defined scale post. How do you set as your input signal range, you're reading may be scaling themselves within the reach of the input signal. A value of coefficient of 3.2, the stove must be Max = 32 Min =-32, since your device probably has a +/-10V range.

    Hope that helps.

  • scaling problems with Windows 8.1 and 3200 x 1800?

    What is the scale of the problems with Photoshop and Illustrator CS6?  I have a hidpi 3200 x 1800 13 '' laptop with win 8.1 and may not use the software because of the text in lower case.

    Thank you

    PK

    Sent from my iPhone

    CS6 is released before HiDpi screens were frequent and there is no adjustment in this program.

    You can try to go to Preferences > Interface and changing the font size of the UI to wide.

    You can also try to lower your display resolution up is decently readable.

    Another step is joining Creative cloud. Photoshop CC 2014 has put 200% across the user interface.

    $50 / month for all applications or $10 / month for Photoshop/Lightroom.

    There are intro and pedagogical offers if you can get over them.

    Gene

  • Layout, scaling problem (Dreamweaver CS5)

    Hello

    Thanks in advance for any answers.

    So, I did a few tutorials and start getting the hang of Dreamweaver. My problem is that my divs are implemented nationally in different browsers/resolutions using a percentage value, with the exception of my head. For some reason, he is a graduate in pixels, so every time I use different browsers or zoom when testing my site, my title gets stretched on the page and misaligned. I already placed an image there as a source and cannot find a way to prevent this misalignment. Should I remove the div tag and reinserting everything?

    I use a MacBook Pro with OS X Snow Leopard 10.6.4 and CS5. I use the template HTML 3 liquid column with header and footer.

    Thank you

    Ryan

    Why not set up a style in the CSS style sheet to set the width of the image to 100% of the width of its container? Instead of using pixels, it's...

    As long as you place the image in a div with a class or an id, use it in your style:

    . Header img {width: 100%;}

    height: auto;

    }

    This image is placed in a

    Beth

  • Site Web scaling problem - please HELP!

    Hi all

    I apoligize, because I am sure that this is a common problem asked. But these forums to search I could not find anything posted thereon.

    So I'm not too familiar with Dreamweaver, I know the basics. I recently put a website together, not using tables or anything like that. I have a Macbook Pro and the resolution of my Web site to fit the screen on my laptop. But when friends go to my page that is either too big or small on their screens. I tried to Google for a solution, but these are mostly the people saying you shouldn't use a code to scale or to say that you need tables. I thought that maybe someone here might know of a way around this. As it seems it would be a common problem.

    Here is a link to my page, to give you an idea of the issue that I am facing. www.brendanhuza.com

    Thanks for your time.

    -Brendan

    So, if I had to reduce the size of the image of my site, it is still no HTML or all I could do to make the whole site adjusts to the size of the browser of the Viewer?

    N ° there is no miracle cure for it because you used all these APDivs to position the elements on your page.  Had used CSS positioning by default (i.e. no positioning) as well as the margins or on floats, it would be much easier to rebuild.

    BTW: you have a bunch of code validation errors on your page.  CSS selector names can't contain spaces.  Use these validation tools and fix the errors reported.

    HTML Validator - http://validator.w3.org 

    CSS Validator - http://jigsaw.w3.org/css-validator/ 

    Bibliography before rebuild you this page:

    Why the APDivs move?
    http://forums.Adobe.com/message/2181263#2181263

    Take a fireworks (or Photoshop) model of a basic CSS layout in DW
    http://www.Adobe.com/devnet/Fireworks/articles/web_standards_layouts_pt1.html

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    www.Alt-Web.com/
    www.Twitter.com/ALTWEB
    www.Alt-Web.blogspot.com

  • scrolling problem large bitmap image

    City previous forums:

    Comments: comments
    scrolling problem large bitmap image
    Posted: Sep 28, 2007 14:47
     
    I want to scroll through a large bitmap image.i have read previous threads.i have added a null field before bitmap field. But the big picture scrolls, but shows an arrow down.
    Please help me.
    Thanks in advance.

    wang0043

    Messages: 12
    Join date: September 2007

    Re: image to large bitmap scrolling problem
    Posted the: October 1, 2007 03:35
     
    I have the same problem. After testing different ways using the BitmapField, I just changed paint the bitmap on the screen instead. More write the paint method and use drawbitmap to draw the bitmap to the screen. Track action wheelball to paint the bitmap can achieve the effect of view.

    Comments
    Re: image to large bitmap scrolling problem
    Posted the: 3 October 2007 18:10
     
    Can you guys post the code on how it's done?
    Thank you

    Comments: vicky
    Re: image to large bitmap scrolling problem
    Posted the: July 19, 2008 02:33
     
    Hello

    I get the same scrolling image problem. Can you please suggest some way

    thanx

    What kind of manager added the BitmapField to?  The support of the Manager there vertical or horizontal scrolling style defined?

    Here is an example of code that I use to show how to scroll through a screen image:

    Scrolling Image recipe

    The image of "test.png" is in the same folder as the source of java if you want to download that as well.

  • Question about image scaling height

    Hi all

    I know that there are a ton of posts on this topic, but I have not really found one that is clear on the problem I encounter.

    Basically I have a PNG image that I want to change so that the width of the image corresponds to the width of the screen.  So, I want the height of the image to be adjusted automatically in order to preserve the proportions of the image.  Currently, I am doing this:

    Bitmap b = Bitmap.getBitmapResource(image);
    
    Bitmap scaled = new Bitmap(Display.getWidth(), ???);
    b.scaleInto(scaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FIT);
    
    BitmapField bf = new BitmapField(scaled);
    

    But with this method, I have to set the height of the sized image.  This is not good, as I don't know what should be the height after the image has been resized (and kept proportions).

    Anyone know how I can determine the correct height of the image?

    Thank you.

    If you can get the height and width of the image, then use the ratios.

    UX = initial width, OH is original height, NW is the new width, NH = new height.

    (NW * OH) / OW = NH

  • Select the Bitmap

    I know this is a vague question but could someone try to explain the steps involved in the creation of a selection on a bitmap? (similar to the in Photoshop selection tool). I'm not looking for any code I was wondering what is involved. Thank you.

    OK, it's much more complex.

    For the moment let's ignore touch screens.

    So, basically, you are going to have to display the Bitmap, and then, when the focus is on this bitmap, display a kind of cursor/pointer.  You need to replace the painting and this match draw in front of your Bitmap image.

    This slider will have to meet the navigationMovement.  The user must be able to "click" to select an area, or maybe to do the standard "drag" to select a rectangular area.  Once you have this area (you know where it is because you are viewing the cursor), you use getARGB on the Bitmap image, get rough ints, convert this back to a Bitmap, scaling it.

    Make sense?

  • Scaling of issues related to the HTML5 application tests the Ripple

    I'm doing my first application on WebWorks. I use ripple emulator to test. I'm just a simple doubt if I should scale is to say increase the size of the different HTML elements (such as buttons and text) or not, so that they are visible on the screen of a phone.

    I recommend using the BB10 Simulator (or ideally dev alpha) to test the scaling problems.

    Ripple frankly STINKS to test (not to mention than just general tests / making of course the app works at all). What looks good in waving may end up weird on a device real - or at least less than you expect.

  • 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.

  • Fixing poor clarity of line, other than vertical and horizantal

    Lines that are not horizontal or vertical have a stained look.  Is it possible to fix this problem or is it a screen pixel problem?

    Thank you

    Mike

    This looks like a bitmap scaling.  If this is the case, use the smoothing of anti-aliasing, bitmap.

  • build dynamically graphic

    Hi guys,.

    I'm a 3d graphics dynamically update, now its easy to plot the graph 3d when all values are known. In my case, check the vi, I have three wavelengths distance axis and power. The wavelength and distance are fixed I'll take the wavelength of 1596,35 - 1596,95 and distance of 33 572 649-34 085 735 who, in vi, are among the constants... power, I'm able to txt filed which I enclose. Now, I want to update the chart in the loop when the values are read from the txt file.

    I would like to know if anyone has an idea how to do this

    Hi Wishkebab,

    I think that nolsqun86 does not mean table, he wrote on the Board that develops because of the "insert into array.vi".

    I made this attempt to replace "insert array.vi" with "replace arry subset.vi":

    The "3d Meshdatatype.lvclass: field Helper.vi" seems to require at least a table with two rows filled to use for the matrix z entry in 2d.

    So I use 'initialize arry.vi' create a buffer with x rows and columns of 1999;

    the 'quotient & remainder.vi' produces a sequence because the dominator for example dominator = for example x = buffer size = 2--> 0-1-0-1-0...

    to replace rank 0 and 1 in the buffer zone with the new data in the table 'power '.

    I have no idea if the data are correctly drawn in 3d surface plot

    in what concerns the interpolation & scaling problems.

    Alex

Maybe you are looking for

  • Moto g4 lack of apps?

    Hey,. I just bought the g4 bike and there are very few apps on it, the basic things like file manager, Notepad, etc... to view files on the micro SD I go through the 'settings' takes forever, is there something that I miss or I just downloaded those

  • XP Home Activation

    The XP sticker is worn above the background of this laptop, so I checked the XP key with 3rd party software. I need to format this installation, now it won't accept the product key and install XP home SP3... What to do, I have an XP product key waste

  • Do not read CD but DVD read & write

    Hello In my ACER laptop, now I am facing problem CD format is not read but DVD can read & write also.Could be he you pls tell me what may be the problem?

  • Reference Dell backup & recovery file icon

    I use Dell backup and recovery for data files. The clock symbol icon was placed on all the folders and files that are saved with this tool. How can I delete the icon? It's a distracting nuisance.

  • Smartphones BBM blackBerry problem. Help, please.

    I can receive messages from bb, but I can not send. And if, by chance, they are going through it takes about twenty minutes! Can someone PLEASE HELP! IM using bold 9780.