When scale with AffineTransform, the size is correct but the x, y is not...
When I scale wither an image or some text by adding an AffineTrasnform.getScaleInstance(double sx, double sy), the size of the text or image is correct. however, it does not properly place the x, y. For example:
1. Original background image: 284, 213
2. Original x, y = 35, 35
3. Scaled background image: 700, 525
4. Scaled x, y: 94, 112
That is incorrect. The x should have been 86 and y should have been 86. Why are they being translated to 94 and 112?
My AffineTransform:
AffineTransform scaleTransform = AffineTransform.getScaleInstance( 2.464788732394366, 2.464788732394366 );
camickr wrote:
So where is your SSCCE?To see how it's off, check the pixel spots in photoshop. Scale the original "Some String" to the proper size and you'll see it ends up in a slightly different spot.
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import java.awt.image.*;
import java.io.*;
public class TestScale extends JPanel
public void paintComponent(Graphics g)
Graphics2D graphics = ( Graphics2D ) g;
//Location
int x = 35;
int y = 35;
//I have to rotate it (so that's why I'm including it in this SSCCE)
double theta = Math.toRadians( 15 );
AffineTransform transform = AffineTransform.getRotateInstance( theta, ( double ) x, ( double ) y );
//Set the transform
graphics.setTransform( transform );
//Draw normally
graphics.drawString( "Some string", x, y );
//Now adjust the transform to scale it
transform.scale( 2.464788732394366, 2.464788732394366 );
graphics.setTransform( transform );
graphics.drawString( "Some string", x, y );
public static void main(String[] args)
JFrame frame = new JFrame("Display image");
TestScale panel = new TestScale();
frame.getContentPane().add(panel);
frame.setSize( 704, 560);
frame.setVisible( true );
}
Similar Messages
-
I have the new OS X Mavericks operating system, and when I invoke IMaps, the location given is not correct. I have attempted to correct it, but it stays the same. Whazzup with that?
In addition to answering innocentius' question:
You say that nothing happens, yet you are able to export to youtube. Please describe in detail what you are trying.
What destinations do you see? How exactly are you trying to export?
Also: Cmd-E will only work if you set a default destination. -
My Outlook/iCloud calendar invites to others appear to work on my end and sync with my PC and mobile, but when other people "accept" the invite, it will not populate/add in to their calendar. How can I fix this without turning off iCloud?
I am at a new office that uses Outlook (not Outlook Exchange) which does not sync with my mobile... I just got iCloud set up on my PC to sync my contacts, calendar, reminders, etc... The sync worked (not without flaws, but the other issues seem solvable... I think), so that i can now see all my appointments on both my phone and on my PC. The problem I am having is that iCloud moved all of my calendar items from Outlook into iCloud calendar and now when I send out meeting/calendar invites the recipients may accept them, but the meeting does not get added to their calendar. This is a huge problem and may mean that i need to turn off iCloud.
Does anyone know how to fix this?
Thanks!I am replying to my own post here as I seem to have fixed the problem.
I do have some calendars that are shared. Some of those are shared with users who have time zone support turned on. So i activated time zone support on my iphone, then deleted my icloud subscription. I then signed in to icloud again and voila... problem solved.
It is a weird one as the other calendar views were always fine and when you opened an event that appeared in the wrong day (on list view), the correct date of the event was shown in the information...
one more bug in a complicated system I guess -
When I download videos (from an external hard drive), they appear to be downloaded (file sizes look correct) but they all stop playing a few minutes in!
Try the following in the terminal
ls -alh filename
du -chs filename
And what happens if you play the files directly of the external drive? -
I've a new account on iMac. When composing an email the contact list does not show up on the bar, which would allow me to select the persons I want to include on the distribution of the email. When I start keying in a name in the email, it comes up with the person's address, which shows it is synced. How do I engage the contact list from the email like I do on my old account (where a contact list icon shows up, along with the "attach" and other icons) ?
With the New Message window open, go to the View menu and select "Customize Toolbar...".
In the screen that opens, drag the item labelled "Address" into the Toolbar area of the New Message window, then click the "Done" button.
That item should be then added to the Toolbar for the New Message window.
Note that the main Mail window and the New Message window (as well as the separate message window if you open a message that way) use different toolbars - the settings/inclusions for one do not carry over to another. -
i downloaded a movie to my ipad, when synced with computer, the computer is now also downloading the movie. why? and how do i stop the movie from being downloaded again
Do you not want a backup of the iTunes content on your computer in the event the iPad is lost, stolen, or simply fails?
-
when i sync my iphone5 on my computer with itune the last part does not stop sync download safari i dont know why is not stop sync and i cant stop it i am try to download some song and this thing cant stop sync help?
Hi,
/Users/sarahschadek/Desktop/Safari.app/Contents/MacOS/Safari
Move the Safari app from the Desktop to the Applications folder.
Restart your Mac.
That's why you see this:
When I try to do the updates my computer says it has ready it goes through like it is downloading them then at the end it says some of the files could not be saved to "/" files.
After your restart your Mac, click the Apple menu (top left in your screen) then click: Software Update ...
Carolyn -
iTunes shows I have an encrypted backup under preferences. It's got the pad lock. When I click restore the encrypted backup is not an option. I've been test MDM products and may have caused this. How do I restore the encrypted backup.
I just came here today to ask the same question.
I have an iPod Gen2 with version 4.2.1 iOS, and iTunes 11.0.2.26
My iPod Touch was running sluggish so I backed up and selected the "Encrypt local backup" to "back up account passwords used on my iPod".
I selected a password for this backup and restored my iPod Touch.
When I went to restore from backup, that encrypted backup is not available on the drop down list.
However, if I go to the top of ITunes and click "Edit", "Preferences" "Device", it shows the back up with the pad lock on it.
I thought I was being smart backing up with encryption to back up account passwords, but now I have lost everything.
So many people have the issue where it asks for a password when they never told iTunes to do an encrypted backup and here we are with an encrypted backup, and we know the password, but we don't get the option to restore from it. -
Already then, why apple ID when logging in to the iTunes Store is not?
Please,helpme
What do you mean 'why Apple id when logging in to the iTunes Store is not ' ? If you are trying to log into your account and can't then what happens e.g. are you getting any error messages ?
-
Why when i buy books on my ipad, when i log onto the store it does not show that i have purchased them?
how many books and songs were therefore lost when i had to wipe my ipad?
this is SHOCKING from Apple... this is not in my domain of settings!!!In the iBooks application on the Mac, there is a checkbox to sync highlights and notes across devices.
I don't see a similar setting in the iBooks app on my iPad. It may require iBooks on the Mac as a mediator.
Also:
Can I highlight text and make notes?
Yes, iBooks includes built-in Highlight and Note features. Highlight any word or passage of text within a book. You can also create a Note from your highlighted selection. Review your Highlights and Notes by tapping the Table of Contents button and then tapping Bookmarks. Highlights and Notes appear in their own section under Bookmarks. -
When you turn on the ipad2 it does not start up properly. The rotating disk that happens when you turn off the ipad appears after the apple logo comes up during start-up and stays there for ten minutes. Then, the ipad will start up properly.
Have you tried a reset ? Press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
-
I can not register. requires a bank card. when choosing a card the word "no" is not present. What to do?
You are supposed to be able to set up an account without a credit card. See HT2534 - Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card.
If you've already created the Apple ID that you want to use and are now being asked for a credit card try the method given here. If you use this I'd be interested to know how you get on because I haven't yet had the time to try it myself.
tt2 -
my ipod 3g hung up in the middle of a song and when i restarted it, the downloaded apps are not working
- Try a reset. Nothing is lost:
Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Purchase/install any new app
- The remaining items in:
iOS: Troubleshooting applications purchased from the App Store -
When migrating to mavericks my photos transferred ok, but my videos clips do not. Can you help me retrieve my videos
Apple doesn’t routinely monitor the discussions.
Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
Feedback -
i am trying to synch my ipad to my computer and i have turn off my Find my iPad function. I have put in my Apple password to do that. i know my password is correct but it says it is not correct. How do I fix that?
And I am incorrect...
Have you ever changed your passcode?
Try again. Maybe a typo?
Maybe you are looking for
-
Can i record with more than one audio interface
I need to record 16 tracks, I have two different audio iterface, in GarageBand i can only find one of them, if i go to prefrenses-audio, I can set any of them as my audio interface, but only one at the time. Any tips to how I can use bouth simultanio
-
Does it matter where the external usb hub is plugged in?
I just got e new 7 port powered usb hub from Sitecom to connect a camera (once in a while) or card reader, printer(s), scanner, external drive etc. When I use one of the four ports on the backside of the iMac, only 1 -and only this one- specific port
-
How to convert .mov files to MP3?
I am recording an entire book for someone who can't read. I'm using Quicktime Pro to do the recording. I want to burn a CD for her that she'll be able to play on any old CD player. How do I converrt the .mov files to MP3 or other usable format?
-
Upgrading from Acrobat 6.0 Pro to Acrobat XI Pro
My company recently upgraded from Windows XP Pro to Windows 7 Pro. We have our old copy of Acrobat 6.0 and it is not compatible with Windows 7. I was wondering since we cannot load Acrobat 6.0 onto our computers in order to receive the upgrade. I d
-
CS6 lags when using brushes (MBP, Intuos)
Hello! I'm using a MBP (Late 2011, i7, discrete ATI Radeon 6570m) with 16 Gigs of RAM, a 256GB SSD Samsung 830 and a Wacom Intuos5 tablet. My secondary screen is a Dell U2711. Ps is already updated to 13.0.1 Everytime i use a brush tool (healing, clo