Can you optimize this code with bit shifting?

Hi there,
I was wondering if anyone could make this code run faster, by implementing bitshifting techniques. I'd really appreciate it, and thanks!
    public void scaleImage(Image source, Image dest) { 
        int sourceWidth = source.getWidth();
        int sourceHeight = source.getHeight();
        int thumbWidth = dest.getWidth();
        int thumbHeight = dest.getHeight();
        Graphics g = dest.getGraphics();
        int dx, dy = 0;
        for (int y = 0; y < thumbHeight; y++) {
            for (int x = 0; x < thumbWidth; x++) {
                g.setClip(x, y, 1, 1);
                dx = x * sourceWidth / thumbWidth;
                dy = y * sourceHeight / thumbHeight;
                g.drawImage(source, x - dx, y - dy, Graphics.LEFT | Graphics.TOP);
    }Message was edited by:
conlanrios

your method reminds me this stuff:
http://www.java-tips.org/java-me-tips/midp/displaying-images-as-thumbnails-on-j2me-devices.html
you can have a look to this article:
http://developers.sun.com/techtopics/mobility/reference/techart/design_guidelines/image_resizing.html

Similar Messages

  • Can you optimize this sql?

    Hi,
    I believe that this sql can be improved, but honestly i don't know how.
                   Select * From Ctb_Mov m Where m.CodEmp = 1 and m.Plano='G' and
                   Cg Between '211' and '211'
                   and cx between '1' and '9999999'
                   and (M.GRUPO is NULL or
                  M.GRUPO in (select m1.GRUPO
                                        from ctb_mov M1
                                        where M1.CODEMP = m.codemp and
                                                  M1.PLANO = m.plano and
                                                  M1.cg = M.cg and
                                                  M1.cx = M.cx and
                                                  M1.GRUPO = M.GRUPO and
                                                  M1.datamov <= to_date('17092009','ddmmyyyy') and
                                                  M1.GRUPO <> 9999999
                                        group by M1.CODEMP, M1.PLANO, M1.cg,
                                                      M1.CX, M1.GRUPO
                                        having sum(M1.VLD - M1.VLC) <> 0))
    Suggestions?
    Regards
    Jomar

    [HOW TO: Post a SQL statement tuning request - template posting |http://forums.oracle.com/forums/thread.jspa?threadID=863295&tstart=0]
    This thread will give a good insight on how to ask a performance tuning question in this forum. Following that will get you good answers!!

  • Can you fix this flaw with archive & install?

    Any ideas what might be causing this alert after an Archive & Install? >
    "Application Launch Failure"
    The application "Transport Monitor" could not be launched because of a shared library error:
    "8<Transport Monitor><Transport Monitor>HotSyncLib.PPC>"
    It appears after login as the menu bar loads, yet everything seems to be working perfectly - so far.
    Any ideas what might be causing it - and how to fix it, other than just clicking 'OK' to get rid of the alert?

    Reinstall Palm Desktop if you use it, or remove the Transport Monitor from the list of login items for your account in the Accounts pane of System Preferences if you don't.
    (28373)

  • You can only authorize this computer with an Adobe id that hasn't been previously used to authorize any other computer or mobile device

    When I try to download a library book on my Kobo reader, I keep getting this message. First it tells me to change the computer's authorization to be associated with an Adobe ID. When I click on authorize after logging in, the message keeps telling my "you can only authorize this computer with an Adobe ID that hasn't been previously used to authorize any other computer or mobile device. I have no idea what this means. Help!

    Sometimes ADE gets its registration/activation confused and in a semi-authorized state.
    Uninstalling and reinstalling does not help, and indeed installation can even trigger this state.
    Unfortunately, it often then gives misleading error messages about what is wrong.
    A common incorrect message informs you that the ID is already in use on another computer and cannot be reused.
    Another is  "E_AUTH_NOT_READY"
    This can often be resolved by completely removing any authorization using ctrl-shift-D to the Library screen on ADE (cmd-shift-D if on Mac).
    Restart ADE, and then reauthorize with your (old) Adobe ID.
    In extreme cases on the mac, the following extra step has helped some people.  Navigate to /Users//Library/Application Support/Adobe/Digital Editions and drag the activation.dat file to the trash. If you are using 10.7, see Access hidden user library files | Mac OS 10.7 Lion. http://forums.adobe.com/thread/1265248?tstart=0

  • I can not register this product with the code supplied? [was:Photoshop]

    I can not register this product with the code supplied?

    Welcome to the forum.
    Along with Trevor's important questions, I have a few more, please:
    Did you buy Ps directly from Adobe (the Adobe Store), or from a certified reseller, such as directly from Amazon?
    Did you buy Ps with physical media, or as a download?
    If the former, did you get the S/N from the envelope that the media came in?
    If the latter, did you get the S/N directly via e-mail from Adobe?
    Do you get any error messages?
    If so, what is the exact text of each one?
    When you say "register," do you mean Activation, or actually registering with Adobe?
    Good luck,
    Hunt

  • I got a new Kobe and i am unable to register it on Adobe, when I log in to my account I receive the following error message "you can only authorize this computer with an Adobe ID that hasn't been previously used to authorize any other computer or mobile d

    I got a new Kobo and tried to register it so that I can download books from the public library. When I tried to register my device I received the following message " You can only authorize this computer with an Adobe ID that hasn't been previously used to authorize any other computer or mobile devices. Please try again.

    Please refer to Can't authorize with a previously used Adobe ID

  • I have a lenovo S410 Touch laptop -with windows 8.1 -Itunes 11.1.1 ,i am trying to connect my iphone 4s but does not connect , it shows that it wants to connect , how can you connect this?

    I have a lenovo S410 Touch laptop -with windows 8.1 -Itunes 11.1.1 ,i am trying to connect my iphone 4s by USB cable but does not connect , it shows that it wants to connect , how can you connect this?

    http://support.apple.com/kb/ts1538

  • Hey guy can you please help me with this issue PLEASE!

    Hey Apple can you please help me with this issue, i have a iPhone 3gs and when i put my sim card into the iPhone it makes iphone 3gs shut down suddenly how do i fix that?
    iPhone version: 6.0.1
    service provider: Vodafone nz

    You could restarting your phone that sometimes fixes issues
    Hold down the Sleep/Wake button and the home button together until the apple logo appears (ignore the ON/OFF slider) then let both buttons go and wait for phone to restart (no data will be lost).

  • HT1553 Hi, I'm stuck at step 9. I don't see my external harddrive when I want to save the DMG backup file. Can you please help me with this? I'm desperate to make this backup! Big thanx in advance!

    Hi, I'm stuck at step 9. I don't see my external harddrive when I want to save the DMG backup file. Can you please help me with this? I'm desperate to make this backup! Big thanx in advance!
    http://support.apple.com/kb/HT1553

    Repair permissions and restart your computer.  If this does not work, zap the pram.  You should now see your external hard drive. 

  • HT201318 I tried to downgrade my iCloud and when i did it never refunded me can you please help me with this thank you James

    I tried to downgrade my iCloud and when i did it never refunded me can you please help me with this thank you James
    <Personal Information Edited by Host>

    How did you try to downgrade
    (Don't post your telephone number in public places, unless you need more useless phone calls) I will ask for it to be removed.

  • I just bought the monthly package of lightroom and photoshop cc. I can't seem to find it under the apps on creative cloud - can you please assist me with this.

    i just bought the monthly package of lightroom and photoshop cc. I can't seem to find it under the apps on creative cloud - can you please assist me with this.

    You can right click the tab and choose "Close Tab" to close a tab.
    Some menu entries are hidden by default and only appear if you use the keyboard to open the menu.
    You can see the difference if you use Alt+F or Alt+B to open the "File" and "Bookmarks" menu and compare that to what you see if you use the mouse to open the menu after you have made the menu bar visible by pressing Alt or by pressing F10.
    Press F10 or press and hold the Alt key down to bring up the "Menu Bar" temporarily.

  • When I try to open my Address Book from Finder, it says :You can't use this version with this version of Mac OS x. I have Address Book 5.0.3 and Mac OS X 10.7.5 What should I do to get my Address Book back???

    When I try to open my Address Book from Finder, it says :You can't use this version with this version of Mac OS x. I have Address Book 5.0.3 and Mac OS X 10.7.5 What should I do to get my Address Book back???

    Unless you deleted Address Book 6, or restored from a backup made before you upgraded to Lion, Address Book 6 should be on your disk somewhere.  Try to find it with spotlight or by browsing likely folders with Finder.  Also check Trash. If you find other Address Books, using Quick View or Get Info in Finder should show the version number.
    Have you ever moved Address Book out of the Applications folder, either before or after you upgraded to Lion?
    If you can't figure out how this happened in the first place, I would be worried that other OS X utilities are similarly affected.

  • New HD, "You can only authorize this computer with an Adobe ID that hasn't previously been used to a

    We had ADE on a system whose hard drive was dying and becomming unusable. I replace the old hard drive with a new one and resinstalled everything. I was able to extract the My Digital Editions Folder from the original drive and copied it to the new drive. I then installed the latest ADE. When we attempt to authorize the new ADE install on the new harddrive we see the dreaded "You can only authorize this computer with an Adobe ID that hasn’t previously been used to authorize any other computer or mobile devices. Please try again."
    How can we get back running on the new disk?
    Thanks

    Please refer to Can't authorize with a previously used Adobe ID

  • I have install adobe digital on my coputer without an adobe ID.  I want to change as I now have an ID but i get this notice "You can oly authorize this computer with a adobe ID that hasn't been previously used to authorize any other computer or mobile dev

    I have installed adobe digital on my computer without an adobe ID.  I want to change as I not have an ID but I get this notice: "You can only authorize this computer with an adobe ID that hasn't been previously used to authorize any other computer or mobile device. What do I have to do?

    Perhaps someone in the Adobe Digital Editions forum? (Adobe Reader has no connection, we don't have much of a clue). Adobe Digital Editions

  • Tried my k3772-z modem to connect macbook air to internet and got the message: you can't use this application with this version of mac os x. Is there a setting that needs to be changed?

    Tried my k3772-z modem to connect macbook air to internet and got the message: you can't use this application with this version of mac os x. Is there a setting that needs to be changed?

    I can't help you with a direct answer.  For third-party devices you should contact the vendor (Vodafone). 
    If you have an iPhone (or an Android phone with hot-spot capability) you can use that to connect to the Internet without paying for a separate cellular service.

Maybe you are looking for

  • Why is my PDF printing off center when I have the landscape box checked?

    I am having some trouble with printing my pdf's. I have several PDF's that are oriented in landscape orientation. In the past, they printed normally in landscape mode or autoportrait/landscape mode. Now they print fine in autoportrait/landscape mode,

  • IPod Video Storage Question

    I have an older 30 GB iPod Video (called the Classic now, I think?). I keep only music on it, and while I've long since outgrown the storage capacity, I like to keep it as full as possible. I understand that I only have about 28 GB of usable space, b

  • IWeb Rotates jpeg on upload

    Ok, this is very weird. I'm using iWeb 3.0.4; on MAC OS 10.7.5, on a MacBook Pro 15-inch early 2008. I've been working on the web site in question for about 5 years and this has never happened before. I do modifications, updates and ftps all the time

  • How to use dreamweaver to check scripts.

    I am both new to scripting and in using dreamweaver, I n eed to be able to copy an asp code and paste in dreamweaver and c ontinue with it, can anyone please help me on how to do this? , I a m testing dream weaver cs4

  • How to open a word document in safari?

    How do I open a Microsoft Word document on my ipad using Safari?