picture shifted with DrawImage () or drawbBitmap() gets cut

Hi, this is probably an easy question, but I can't understand this. (I'm faily new tricks of painting).

I'm going to pull 2 images one over the other. Update icon is slightly larger then the icon image (is not really important for what is right). I want the focus to show under the icon, so I want to move the icon slightly.

So I use the following code:

            g.drawImage(0, 0, focus.getWidth(), focus.getHeight(), focus, 0, 0, 0);
            g.drawImage(5, 5, icon.getWidth() + 5, icon.getHeight()+5, icon, 0, 0, 0);

However, the problem is that the image is cut off (it seems that he does not accept the good width and height)... I tried to play with the setting of width and height but also top and left. I don't know what's left and the best settings.

Any help is appreciated.

Figured it out... SetExtent to accommodate extra space.

Tags: BlackBerry Developers

Similar Questions

  • Type of clean Flash with glow gets cut

    Type I created in Flash and given such a glow gets cut!  Not only is the cut right, glow effect but the real type itself gets chopped... last character on the right...

    Anyone know what is happening with this and what is the solution?

    Thank you!

    fkat

    If you have added space for the text, which isn't going to not do the wider TextField.  The value is AutoSize textfield?

  • Photo gets cut even after using the 'right answer' to a similar question, attached photos

    Hello

    A picture has been inserted as fill with "fill level". "» When it is presented as a preview, the bottom gets cut.

    I followed the instructions in a previous post to adjust the size of the larger image, then use "horizontal mosaic."

    Photo that was cut was 765 x 1160

    I changed the picture of 991 x 1500 and is still making tiles AND cut.

    I spent so much time on it - please help.

    Here are 4 screenshots with descriptions. Thank you!

    It's my opinion of original design with scale to fill 765 image size x 1160

    Screen Shot 2015-10-05 at 16.05.15.png

    This is preview with "Scale to fill" with the size of the image x 765 1160

    Screen Shot 2015-10-05 at 16.05.43.png

    It is 'Horizontal mosaic' with the same size image used above, 765 x 1160

    Screen Shot 2015-10-05 at 16.08.18.png

    So I increased the size of the image to 991 x 1500 with "horizontal mosaic." The sides are smaller, but it is always cut.

    I did not need to increase the width of others to complete tiled parts because it is cut anyway. I also tried to uncheck Sticky Footer without any result.

    Screen Shot 2015-10-05 at 16.06.12.png

    Hello L,

    Please check the size of the container and also positioning:

    Kind regards

    Akshay

  • Where are the location of metadata stored in pictures taken with an iOS device?

    I just follow me back from a trip with a lot of pictures taken with a couple of the iPhone as a digital camera.  Pictures taken with the iOS for most devices have locations associated with them, as evidenced by the dialog box 'Get Info' in Photos for Mac. They show well on a card and are correctly associated with keywords of the location (for example, "Sierra National Forest, northeast of Fresno County, United States of America"). But I can't know where the coordinates are stored. There is nowhere to search Photos for Mac that will give me the real coordinates. Also open images in preview does not display a GPS tab in the 'Détails' box how will be my camera equipped with GPS. And finally the search all metadata in Photoshop or Adobe Bridge also will not show all the details or any other type of geographic information.  I just checked my old version of iPhoto (9.6.1) and she won't show also all location information.

    Photos for Mac will display basic information, but I can't find where this happens. Any ideas?

    If you don't see any GPS information in the Inspector of Preview window, you are probably stripping while dragging or by exporting to office. Try dragging the image from Photos while pressing the Option key.

  • When I try to send a picture through Windows Live Mail I get an error message telling me to delete the picture, and then try again.

    When I try to send a picture through Windows Live Mail I get an error message telling me to delete the picture, and then try again.

    original title: RECEIVES the MESSAGE of ERROR WHILE SENDING AND RECEIVING PHOTOS

    Hello Jane,.

    The best place to ask your question of Windows Live is inside Windows Live help forums. Experts specialize in all things, Windows Live, and would be delighted to help you with your questions. Please choose a product below to be redirected to the appropriate community:

     

    Windows Live Mail

    Windows Live Hotmail

    Windows Live Messenger

     

    Looking for a different product to Windows Live? Visit the home page Windows Live Help for the complete list of Windows Live forums to www.windowslivehelp.com.

  • OTA - Application name Blackberry Curve 8520 gets cut.

    On the downloading application page (with 'Download' & 'Cancel' buttons)on
    device ,the application name is not displayed completely and it gets cut.
    

    Thanks for posting of the JAD file example.  I was able to reproduce this.  I don't have a work around to provide a version 4.6.1.  However, this problem has been resolved in BlackBerry device software version 5.0.

  • Picture taken with the camera...

    Hi all

    I am currently facing a lot of problems to use the camera. After days and days of trying to change/adapt my code, you are my last hope...

    What I want to do is:

    1. Departure from camera
    2. The take a snapshot
    3. Resizing in my application
    4. Store in the FET (don't cause me problems)

    Here is part of my code:

    1. Beginning camera & look the file system
        public CameraBlackBerry() {
    //            invoking camera
            UiApplication.getApplication().addFileSystemJournalListener(this);
            Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments());
        }
    

    2 get path to the new image and transfer to another class

        public void fileJournalChanged() {
            AIDOO.debug(">>>>>>>> FS MODIFIED !!!");
            Application app = UiApplication.getApplication();
            app.removeFileSystemJournalListener(this);
            long USN = FileSystemJournal.getNextUSN();
            for (long i = USN - 1; i >= 0; i--) {
                System.out.println(">>>>>>>> FS MODIFIED !!! : " + i);
                FileSystemJournalEntry entry = FileSystemJournal.getEntry(i);
                if (entry.getEvent() == FileSystemJournalEntry.FILE_ADDED) {
                    path = entry.getPath();
                    if (path.endsWith(".jpg")) {// Try to kill camera app here by injecting esc. HAD to remove condition '&& path.indexOf("IMG") >= 0' because changed in OS6
                        //#ifdef DebugMode
                        AIDOO.debug(">>>>>>>> Found a file added ending with jpg @  :" + path);
                        //#endif
                        // Get out of camera app
                        EventInjector.KeyEvent inject = new EventInjector.KeyEvent(EventInjector.KeyEvent.KEY_DOWN, Characters.ESCAPE, 0);
                        inject.post();
                        inject.post();
                        app.requestForeground();
                        AIDOO.currentCameraBlackBerry = null;
                        new CameraBlackBerryFileHandler(path);
                        break;
                    }
                }
                if (entry == null) {
                    // we didn't find an entry.
                    break;
                }
            }
        }
    

    3. how to get a FileConnection

        private FileConnection openFile() {
            try {
                FileConnection file = (FileConnection) Connector.open("file://" + path);
                if (file != null) {
                    boolean fileExists = file.exists();
                    int existCount = 0;
                    while (!fileExists && existCount < 50) {
                        AIDOO.debug("fileExists sleeping for 100 msecond");
                        Thread.sleep(100);
                        fileExists = file.exists();
                        existCount++;
                    }
                    if (existCount < 50 && fileExists) {
                        return file;
                    } else {
                        return null;
                    }
                } else {
                    return null;
                }
            } catch (InterruptedException ex) {
                alerta = new Alert(Lng.getString(Lng.a_alert), "InterruptedException while opening picture connection : " + ex.getMessage() + "  " + ex.getClass() + " path :" + path, null, null);
                AIDOO.handleError("Exception while opening picture connection", ex);
                return null;
            } catch (IllegalArgumentException ex) {
                alerta = new Alert(Lng.getString(Lng.a_alert), "IllegalArgumentException while opening picture connection : " + ex.getMessage() + "  " + ex.getClass() + " path :" + path, null, null);
                AIDOO.handleError("Exception while opening picture connection", ex);
                return null;
            } catch (ConnectionNotFoundException ex) {
                alerta = new Alert(Lng.getString(Lng.a_alert), "ConnectionNotFoundException while opening picture connection : " + ex.getMessage() + "  " + ex.getClass() + " path :" + path, null, null);
                AIDOO.handleError("Exception while opening picture connection", ex);
                return null;
            } catch (IOException ex) {
                alerta = new Alert(Lng.getString(Lng.a_alert), "IOException while opening picture connection : " + ex.getMessage() + "  " + ex.getClass() + " path :" + path, null, null);
                AIDOO.handleError("Exception while opening picture connection", ex);
                return null;
            }
        }
    

    4 getting the stream

        private DataInputStream tryAccessingImage(FileConnection file) {
            DataInputStream is = null;
            nbBytes = 0;
            try {
                is = file.openDataInputStream();
            } catch (IOException ex) {
                return null;
            }
            if (is != null && file.canRead()) {
                try {
                    nbBytes = file.fileSize();
                    isAvailNbBytes = is.available();
                    int unreadableCount = 0;
                    while (nbBytes <= 0 && unreadableCount < 50) {
                        AIDOO.debug("fileSize problem, sleeping for 100 msecond");
                        Thread.sleep(100);
                        nbBytes = file.fileSize();
                        unreadableCount++;
                    }
                    if (unreadableCount < 50) {
                        return is;
                    } else {
                        return null;
                    }
                } catch (InterruptedException ex) {
                    String problem = Lng.getString(Lng.pic_couldnt_be_stored) + "(2) " + ex.getMessage() + "/ InterruptedException can read file : " + file.canRead() + " " + nbBytes + "bytes / " + path;
                    append(problem, imageProblem);
                    alerta = new Alert(Lng.getString(Lng.a_alert), problem, null, null);
                    return null;
                } catch (IOException ex) {
                    String problem = Lng.getString(Lng.pic_couldnt_be_stored) + "(2) " + ex.getMessage() + "/ IOException2 can read file : " + file.canRead() + " " + nbBytes + "bytes / " + path;
                    append(problem, imageProblem);
                    alerta = new Alert(Lng.getString(Lng.a_alert), problem, null, null);
                    return null;
                }
            } else {
                alerta = new Alert(Lng.getString(Lng.a_alert), Lng.getString(Lng.pic_couldnt_be_stored) + "(2) / InterruptedException can read file : " + file.canRead() + " " + nbBytes + "bytes / " + path, null, null);
                return null;
            }
        }
    

    5 reading the stream

        private byte[] readingImage(DataInputStream is) {
            byte[] raw = new byte[(int) nbBytes];
            isReadBytes = -2; // -2 to differ from eventual -1, 0 or n (positive) returned by read()
            try {
                isReadBytes = is.read(raw);
                return raw;
            } catch (IOException ex) {
                String problem = Lng.getString(Lng.pic_couldnt_be_stored) + "readingImage " + ex.getMessage() + "/ IOException1 can read file : " + nbBytes + "bytes / " + path;
                append(problem, imageProblem);
                alerta = new Alert(Lng.getString(Lng.a_alert), problem, null, null);
                return null;
            }
        }
    

    6 then I do the following

    try {
                            is.close();
                            screenWidth /= 4;
                            screenWidth *= 3;
                            screenHeight /= 4;
                            screenHeight *= 3;
                            append("resizing image", imageBlank16);
                            raw = resizeImage(raw, 640, 480);
                            append("resize for preview image", imageBlank16);
                            byte rawPreview[] = resizeImage(raw, screenWidth, screenHeight);
                            AIDOO.debug("ok here");
                            append("creating preview image", imageBlank16);
                            imagePreview = Image.createImage(rawPreview, 0, rawPreview.length);
                            AIDOO.debug("ok here2");
                            String devinceInfo = DeviceInfo.getSoftwareVersion();
                            AIDOO.debug(devinceInfo);
                            AIDOO.debug("ok here3");
                            //#if !BlackBerry_OS_46 && !BlackBerry_Older_than_46
                            //raw = resizeImage(raw);
                            nbBytes = raw.length;
                            //#endif
                            if (nbBytes > CAMERA_IMAGE_MAX_SIZE) {
                                alerta = new Alert(Lng.getString(Lng.a_alert), Lng.getString(Lng.pic_size_is_too_large) + " : " + nbBytes, null, null);
                                System.out.println("error 2 after insert");
                                returnValue = false;
                            }
                        } catch (IOException ioe) {
                            alerta = new Alert(Lng.getString(Lng.a_alert), "IOException : " + ioe.getMessage() + "available Bytes : " + nbBytes, null, null);
                            AIDOO.handleError("IO problem while saving picture 0", ioe);
                            System.out.println("error 2 after insert");
                            returnValue = false;
                        }
    

    7 Behold my image resizing function

        private byte[] resizeImage(byte[] image, int width, int height) {
            AIDOO.debug("Start of image resizing");
            Bitmap bmp1 = null, bmp2 = null;
            try {
                bmp1 = Bitmap.createBitmapFromBytes(image, 0, -1, 1);
                bmp2 = new Bitmap(width, height);
            } catch (IllegalArgumentException ex) {
                throw new IllegalArgumentException("exception while createBitmapFromBytes()" + ex.getMessage() + "isAvailNbBytes = " + isAvailNbBytes + " isReadBytes = " + isReadBytes + " length = " + image.length + " nbBytes = " + nbBytes + " image = " + image);
            }
            AIDOO.debug("Scale into");
            bmp1.scaleInto(bmp2, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FIT);
            AIDOO.debug("End of Scale into");
            JPEGEncodedImage encoded = JPEGEncodedImage.encode(bmp2, 90);
            return encoded.getData();
        }
    

    My problems are:

    1. sometimes the image is cropped, this size (w/h) is OK, but for some strange reason it is not all the time. There is always a large black area at the bottom of the image. It seems that something has not been correctly readen.

    2. sometimes I had an IllegalArgumentException in createBitmapFromBytes() function.

    I read a lot of posts that talk about these problems, but I have found no solution.

    Is it so hard to take a picture of the camera and display it?

    Anyone have a good example/code example on how to handle this?

    Thank you for your support and for reading me

    (Sorry for my English )

    I suspect that these problems are caused by the fact that the earpiece of the paper you use is told on the file being written until the writing is actually completed.

    I think that Ihad this problem in an application that I wrote and to get around it, rather than process the image in the JournalListener, I actually got the JournalListener to save the file created in the method of invocation of the "onExposed" screen, I checked to see if the name of the file has been updated and if so , I would treat it then.  onExposed is not get leads until the camera application has closed at this time, according to me, that it is save saying that the file has been saved.

    I think that there are other options.  For example, you could start a thread check the size of the file and if it does not grow after a second or two, you might assume that the writing was completed.

    In all cases, this is where I would start looking for the problem.

  • I am trying to print a credit card statement, get cut.

    I am trying to print a credit card statement, but when I click on the icon to print, I get a gray rectangle dark on the top and the bottom of the overview page. When I printed the page, the top of the page and the six lines of the actual declaration get cut. This has never happened before, and I don't have this problem with Internet Explorer. Can someone please?

    Hi cielos9886138 ,

    I apologize for the inconvenience.

    Assuming that you have Acrobat installed on your computer, try following the steps:

    1 - Launch Acrobat > open the document > then click Print > select the option made under design & management of the Page and then click on print.

    Step 2 - If 1 does not work, try disabling protected mode, launch Acrobat > click Edit > then click on Preferences > under categories, click on (enhanced) protection > under the Protections of Sandbox, select Disable next to protected mode and then click OK.

  • Why my design get cut?

    Hi, I am trying to create my first website with Adobe Muse, can anyone tell my why my design is getting cut off like that? (Plan mode and preview below :) )

    Screen Shot 2014-11-05 at 4.52.30 PM.png

    Screen Shot 2014-11-05 at 5.00.31 PM.png

    Thank you!

    I usually always saw in the browser rather than the preview of Muse. You will get a better idea of the result of this way... also try different browsers and widths.

  • Have Windows 7 running on Parallels Desktop with a Mac. Get "setup.exe is not a valid Win32 application" when trying to download a program with Windows Explorer. I can download from these sites with Vista and XP with other computers.

    Have Windows 7 running on Parallels Desktop with a Mac. Get "setup.exe is not a valid Win32 application" when trying to download a program with Windows Explorer. I can download from these sites with Vista and XP with other computers. Now, I can't download the programs that are supposed to solve the problem! including FoxFire

    Try to download from this site:

  • I have updated and now when I try to log on to Web sites with fingerprint reader, I get "Firefox doesn't know how to open this address, because the Protocol (dpql) is not associated with any program."

    I have updated and now when I try to log on to Web sites with fingerprint reader, I get "Firefox doesn't know how to open this address, because the Protocol (dpql) is not associated with any program."

    What is the Digital Persona fingerprint scanner? If it's that they have abandoned, for more details, see https://support.mozilla.com/en-US/questions/799388

  • Today, only with Firefox open, I get a constant strong siren (like Super Mario). I uninstalled then reinstalled... siren always there. I didn't Remove Favorites, what should I do? Is it possible to save my favorites until I kill them? More importantly,.

    Today, only with Firefox open, I get a strong Mermaid CONSTANT (like Super Mario). I uninstalled then reinstalled... siren always there. I didn't Remove Favorites, what should I do? Is it possible to save my favorites until I kill them? Will be more important, killing personal settings and then reinstalling cure the mermaid?

    This has happened

    Each time Firefox opened

    Is May 21, 2010, when I opened Firefox 3.6.3

    You have the Cool Previews installed addon? Google has a Pacman game on their homepage today and I had to uninstall the addon and the siren noise stopped.

  • I stopped to receive mail after December 31.  It indicates that the computer cannot connect to my account but when I log in with my password I get the message "this account already exists." How can I get my email account to work again?

    I stopped to receive mail after December 31.  It indicates that the computer cannot connect to my account but when I log in with my password I get the message "this account already exists." How can I get my email account to work again?

    MacBook Air, OS X El Capitan

    First of all, make sure that you don't have two accounts with the same address. What happens if one of them is an iCloud account.

    From the Mail menu bar, you select

    ▹ Connection Doctor window

    In the window that opens, look for an SMTP (outgoing mail) account with a name that corresponds to the account that you are trying to add. Double-click it. Another window opens, displaying the list of all outgoing mail accounts. Click the sign button less to remove the corresponding one, and then click OK.

    Try to add the email account again. If you still can not, log off or restart the computer, and then open the preferences window accounts Internet and check if the account is displayed.

  • I have created a new domain with win2012r2 and created users. Add after the client in my area so that the newspaper with the user I get error below.

    Hello

    I have created a new domain with win2012r2 and created users. Add after the client in my area so that the newspaper with the user I get error below.

    "You cannot connect because the logon method, you use is not allowed on this computer, please, see your ad min for more information network"

    Please help me with that and I don't want to give permission to admin for all users group...

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • I have a samsung galaxy s2 sprint phone and I just did an update for my phone. After doing so, I am unable to get my phone to register with my computer to get my music files off of it?

    I have a samsung galaxy s2 sprint phone and I just did an update for my phone. After doing so, I am unable to get my phone to register with my computer to get my music files off of it? How can I fix this problem? It worked absolutely fine before the update.

    Contact your cellular provider or Samsung with this problem.

Maybe you are looking for