Zooming of Shapes Problem - Shapes also translate

Hi,
i have the following problem, i wish to zoom a shape - the problem is - while the shape zooms - it also moves away from my screen - instead of staying at its original point and just growing and growing it grows & moves away - im not sure where the error is.
Pseudo Code :
zoomTrans = AffineTransform.getScaleInstance(1.1,1.1);
while(true) {
zoomingShape = mergeTrans.createTransformedShape(zoomingShape);
zoomingShape.draw(g);
Do i have to add a negative translation here which removes the translation done by the zooming ? Im quiet confused - i thought scaling was working like rotation..
Thanks

You have to translate like Dr Las said. One way is to
translate the center of your shape to (0,0), scale it,
then translate it back to the correct position.
JonIndeed. Scaling has a fixed point: imagine pinning your shape to the X-Y plane; scaling won't cause that point to move. For the basic scale transform, that fixed point is the origin. So choose your fixed point (In the code below it is (1,2), the upper-left corner of the rectangle), and as Jon writes translate it to the origin, scale then translate it back:
import java.awt.*;
import java.awt.geom.*;
public class X {
    public static void main(String[] args)  {
        Shape shape = new Rectangle2D.Float(1,2,3,4); //x,y,w,h
        dump(shape);
        AffineTransform xform = getScale(2, 2, 1, 2);
        dump(xform.createTransformedShape(shape));
    static void dump(Shape shape) {
        float[] coords = new float[6];
        System.out.println("Shape dump:");
        for (PathIterator i = shape.getPathIterator(null);!i.isDone(); i.next()) {
            switch(i.currentSegment(coords)) {
            case PathIterator.SEG_MOVETO:
                System.out.println("move to (" + coords[0] + "," + coords[1] + ")");
                break;
            case PathIterator.SEG_LINETO:
                System.out.println("line to (" + coords[0] + "," + coords[1] + ")");
                break;
            case PathIterator.SEG_CLOSE:
                System.out.println("close");
                break;
            default:
                System.out.println("to lazy to write other cases");
    static AffineTransform getScale(double sx, double sy, double tx, double ty) {
        AffineTransform xform = AffineTransform.getTranslateInstance(tx, ty);
        xform.scale(sx, sy);
        xform.translate(-tx, -ty);
        return xform;

Similar Messages

  • Have been using Lightroom on my Apple computer for years. Now, ever since upgrading to Apple's  Yosemite operating system I get an error message (150:30) every time I try to open a lightroom file. Has anyone else experienced this problem?  Also how do I s

    Have been using Lightroom on my Apple computer for years. Now, ever since upgrading to Apple's  Yosemite operating system I get an error message (150:30) every time I try to open a lightroom file. Has anyone else experienced this problem?  Also how do I subscribe to Adobe's Premium Support? Every time I've tried (through contact support) I just get taken on an unending loop.

    I think we need a lot more information.
    Exactly what does the message say?
    Exactly what files are you trying to open?
    Exactly how are you trying to open them (what menu command or button or mouse action or keyboard shortcut)?
    And lastly, what version of Lightroom are you using?

  • I have an early 2008 Mac Pro, which has re-booting problems. Also what does the spinning beach-ball indicate?

    Hi, I have an early 2008 Mac Pro which has re-booting problems.
    Processor speed is: 2.8
    Memory: 2GB 800 MHz DDR2 FB-DIMM
    2 x 28GHz Quad Core Intel Xeon
    I am running OSX Yosemite Version 10.10
    My Mac Pro keeps re-booting. Last year I had to replace my graphics card. My original card was the ATI Radeon HD 2600 XT 255MB, and that is what I have now. At this precise moment my Mac Pro is running perfectly, except that it is slow and the spinning beach-ball keeps appearing. I have managed to do some work with the disk utilities, verifying, cleaning and partitioning. Some errors were found and when it was cleaned this seemed to help my Mac Pro to function properly. Although I am able to use my Mac Pro now, from day to day I still experience re-boot problems. Also quite unexpectedly my mac dictionary has an error, it closed itself down and will not open at all, I had the message to say that a report will be sent to Apple.
    I have tried starting my computer with an external hard drive fitted via a USB cable, I use for back-ups. This worked and I was able to wipe my hard drive clear and replace all info from the back up I had done only a few days ago.
    This worked for a few days and then the same problem started again.
    I am beginning to wonder if I need to buy a new hard drive.
    If there is anyone who has some answers to help me solve my problem, I would be most grateful.
    Robert

    When you have the beachball activity, note the exact time: hour, minute, second.  
    These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.
    Each message in the log begins with the date and time when it was entered. Scroll back to the time you noted above.
    Select the messages entered from then until the end of the episode, or until they start to repeat, whichever comes first.
    Copy the messages to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of it useless for solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • Problem in language Translation

    Hi Experts,
    I am having problem in language translation of smart form.
    I have include all text as text element and have done translation in SE63. But when I login in to translated language the output remains in English.
    I have made the translation from English to Chinese in SE63.
    Please suggest why the output does not come into translated language.

    Hi ,
    I have been working on translations for 8 months now. I think i can resolve your issue.
    Remember one thing in mind when you do translations firstly when you go to se 63 and make some changes make sure that you have not opened the smartform in Change mode. If you do so then you will face this sort of probelm. As per your messages i think you have already checked the language in the form
    If not make sure you do it. Now try again in SE63 make changes in what ever langauage you are doing and then "saveactive" .
    One more final thing if anytext in smartform say   &invoivce_no& is blank in smartform then it will not show up in se63 i think you know about this.

  • My Intel iMac with 4 ext, daisy chained drives freezes up sometimes. If I unplug all drives there is no problem. Also Disk Warrior gives me the error msg,that in Time Machine, (which is on a lg. (1TB ext. HD) error msg me that there is not enough memory

    My Intel iMac with 4 ext daisy chained drives freezes up sometimes. If I unplug all drives there is no problem. Also Disk Warrior gives me the error msg (2154) that in Time Machine, (which is on a lg.(1TB ext. HD only 1/4 used space) error msg me that there is not enough memory. I am using Lion 10.7.2.

    My Intel iMac with 4 ext daisy chained drives freezes up sometimes. If I unplug all drives there is no problem. Also Disk Warrior gives me the error msg (2154) that in Time Machine, (which is on a lg.(1TB ext. HD only 1/4 used space) error msg me that there is not enough memory. I am using Lion 10.7.2.

  • We are having problems sending iMessages we have reset but still having problems. Also Icalls cutting off.

    We are having problems sending IMessages they are not sending have reset but still having problems. Also calls are cutting out or not connecting

    This is a known issue with Apple. I can't sent iMessages either...It' doesn't matter how many times I power down my phone, delete messages or disconnect from wifi...Very frustrating.

  • Will 16Gb RAM on a Early 2011 2.7 Ghz i7 Macbook 13" cause any problem? Also i plan to upgrade to Mountain Lion, will it work?

    I want to upgrade my machine with 16 GB RAM, it already has a G.Skill single RAM chip of 8gb. need help with the following. Will upgrading to 16Gb RAM on a Early 2011 2.7 Ghz i7 Macbook 13" cause any problem? Also i plan to upgrade to Mountain Lion, will it work?

    It won't cause you any issues or problems....
    it is however, suggested you install the same brand RAM that are of the same specs....
    1333MHz........
    Installing different brands with different CL speed might cause issues....
    so if you already have a G.Skill RAM installed, then install the same brand.

  • Zoom 100%, Shape Tool Appears on Fraction of Pixel

    This has been an issue for a while since the shape tool got a major refactoring and was hoping that this would have been fixed by now, but since it hasn't I want to make sure this issue is known and people are aware.
    This used to be default behavior (before CC and CS6):
    When you were zoomed out to 100% and used a vector tool (shape tool), you could draw anywhere and the edges would be aligned on pixels by default because if you are zoomed out to 100% you literally cannot click on a fraction of a pixel.
    Since there is now the "snap vector tools and transforms to pixel grid" option, yes you can automatically snap to pixels, but you should still be able to have vector tools line up on the pixels when zoomed to 100% and have snap turned off. I do not understand why this change was made.
    Article regarding CS4/CS5 in how to align shape tools perfectly: If you have Snap to Pixels turned off, drawing at 100% zoom achieves the same result.
    Source: http://bjango.com/articles/roundrect/

    You need to file a bug report using https://bugreport.apple.com/ to make sure this is tracked by a specific bug report at Apple.
    You will need to convert your Apple ID account into a developer account, but you can sign up for free as a Safari developer here:  https://developer.apple.com/devcenter/safari/
    Information that will be useful:
    A list of all devices and iOS versions that this bug reproduces on.
    A list of all devices and iOS versions that this bug does NOT reproduce on.
    Attach a (reduced) stand-alone test case to the bug report.
    Looking at the web page briefly in Web Inspector from Safari 7.0 on Mavericks (Safari 6.1 on Lion/Mountain Lion would also work), there is a <canvas> element that's position: absolute that is being used as a background for the page.  Because this element is positon: absolute, it's put into a layer.  And because it's behind all the other content on the page, it puts everything else into a layer as well.  As seen on the Safari 6.1/7.0 Web Inspector when loaded in Safari 7.0 for Mavericks:
    Layers use a lot of memory, which is why Safari on iOS 7 crashes due to lack of memory when zooming back out--layers must be recreated at each zoom level.
    This is still a valid bug, but finding an alternate way to paint the background (using a repeating background image with CSS) would make the page use much less memory-intensive.  You can verify that there are fewer layers on the page after changing (or removing) the canvas element, and Safari for iOS should stop crashing on zoom out.

  • Zoom in shape object

    Hello, I am trying to zoom on a shape object with the AffineTransform class, and would like to know how to zoom from the center of my object graph, and this graphic object can be a circle, rectangle, polygon, etc. .. .
    I'm lost in logic to perform the transformation.
    Thanks.

    Is there a question? Are you asking me to run your partial code snippet for you?
    user2307826 wrote:
    Here's part of my code, entered the getScaleInstance now as I could zoom in from the center of my object, assuming for example that my object is a rectangle?
    thanks
    @Override
    public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setColor(Color.RED);
    AffineTransform tx = AffineTransform.getScaleInstance(scale, scale);
    g2.draw(tx.createTransformedShape(rect1));

  • Canon MG6220 wierd zooming/cropping printing problem, only when printing with Windows XP?

    The printer in question is a Canon Pixma MG6220, connected to a WindowsXP printer.  I've printed this same document on a Brother laser printer, that is connected to the same computer, and it prints correctly.  I've printed this same document on a Epson inkjet printer, and it prints correctly.  I've printed this same document at Staples, on one of their big laser printers, and it prints correctly.  So, this printing problem is only occurring with this Canon printer. One other thing that may help you with this, is that last night I moved this Canon printer to another computer, except this one had Windows 7 on it, and it printed flawlessly!  So, it seems that it may have something to do with Windows XP printer driver. 
    I'm printing a one page document from Word 2002 which consists of about 10 pictures, no text.  All the pictures on the page are the same height but a different width.  When I print the document, some of the pictures print correctly and some of them do not.
    Essentially, what is happening is that some pictures are zoomed in about 50%, yet still print in the same area that is set in the document.  So, the image looks like it has been rudely cropped.
    The oddest thing is that this only happens to some of the pictures.  There is nothing special about these pictures.  The pictures that print correctly are from the same source as the ones that don't print correctly. I’ve done other Word documents like this, with the same format but different pictures, and they printed wrong too, some pictures correct and some zoomed/cropped.
    Here is a summary of the pictures from the files I attached,  and which ones  printed correctly, and which did not:  The first one is a screen capture of the Word document, and the other is a scan of the printed document.
    Row 1
        Pic 1 – error (zoomed/cropped), Pic 2 – error, Pic 3 – correct, Pic 4 – error
    Row 2
        Pic 1 – correct, Pic 2 – correct, Pic 3 – correct
    Row 3
        Pic 1 – error, Pic 2 – error, Pic 3 – correct, Pic 4 – error
    Row 4
        Pic 1 – error, Pic 2 – error, Pic 3 – correct
    One observation of the incorrectly printed pictures, is that the upper left corners appear unaffected.  It is the lower right corners that get the weird zooming/cropping effect.

    Urgently restore a backup of the registry.
    Urgently do not use the word 'urgently' in a forum of volunteers.
    Also it can not be urgent, as Forms 4.5 dates from the Flintstone age, and probably isn't even certified on XP.
    However, the error message is very clear: Apparently Forms 4.5 uses the registry to store printer info: you need to get that entry back. That kind of info is usually documented. Documentation is likely still online.
    Sybrand Bakker
    Senior Oracle DBA

  • Why zooming in Windows 7 changed also the font size in Firefox?

    I have win7 and I tried to change the text/icon size from the windows to 125%. It also affected everything in firefox (text in tabs, address bar etc., not the text on the pages which you can change with ctrl +/-).I changed it back to 100% and everything became really tiny. How can I make it standard size no matter what zoom I use in windows itself.
    Have you had experience from this kind of problem before?
    Sincerely
    Antti

    I just had the VERY same experience, also caused by the Win 7 font size change, which was subsequently restored to its original settings, and here, too, only FF 11 was affected by the change...
    I'm reluctant to add yet another add-on. Are there no settings in the about:config page that can be changed to control this?
    Following an advice on this forum, I tried changing the following on the about:config --
    layout.css.devPixelsPerPx
    from 1.0 to larger. This changes the spacing of the *areas* of the tool-bars and the Bookmarks column, but not the font size. Is there no settings that controls font size???

  • Touchscreen pinch to zoom , left speaker problem.

    Hello, i have Hp touchsmart tx2-1270us notebook and i installed windows 7 on it after that i installed windows8 pro 32bit
    then in windows 8 i tried to do the touchscreen maultitouch like pinch to zoom and rotate .....ex but it not working also after i installed windows 8 my speakers worked great for a while then after like a month the left speaker is not working any more "my headphones are working" , so i installed al the drives the screen and speaker's need but it didn't work .
    please help , Thanks
    P.S : my warranty  has expired and i can't get support right now.
    SN: [Personal Information Removed]
    PN:NV174UA#ABA

    What was the original operating system and type?
    Did you switch from a 64-bit Windows 7 to 32-bit Windows 8?
    Best regards,
    erico 
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • Update on BIOS & MEMORY problems? also DOT, PAT, settings...

    Okie dokie, I'm new here, and I've been pouring through threads for the past 2-3 hours and doing searches, so please excuse these questions if they seem to have already been answered, but I would like to just ask a few (hopefully susinct) questions to get the quickest and most direct answers possible...
    I just bought the 865pe-LS board, p-4 2.6ghz 800FSB HT CPU, and value-select Corsair PC3200 512MB dual-channel kit, and it has become apparent that there is or has been a HUGE problem with this board accepting corsiar memory.  ARGH   or should is say DOH for not checking into all of this BEFOREHAND!  
    But it seems that several bios versions have come out since the majority of those threads I have been reading about back in august.  Sooo, can anyone tell me if the current version, 1.9 bios, has fixed these incompatibilities with the corsairs memory sticks?  I realize that most people are going the LL version routes for the memory, and I have opted for the value-select versions...but it still seems to be a possible dilemma.  I am wondering if it is worth it to try to pay the 15% restock fee or sell it on ebay (hopefully for about what I paid) and go get the same stuff in kingston memory instead, since these seem to be much more compatible?  Or has this problem been fixed with newer bios versions?
    Another important factor to consider, I think, is that I may not be THAT interested in overclocking much of anything, but perhaps just wishing to use the fast or turbo modes, probably not ultra-turbo since i would need the XMS or hyper-X versions to even try this.  If the bios is now accepting corsair, I am trying to figure out, short of "experimenting" since i have not gotten all of my components in yet, if its even possible or recommended to overclock or use the fast/turbo mode with the cas-3 value select dual-channel setup I will be using...any clues?  
    Lastly, which may have been already answered by now, is it best to use the PAT or DOT settings or opt for manual setting for any sort of higher-performance setup, considering my specs for my soon-to-be new computer?  Or does it really make THAT much difference?  Im not into squeezing out every nano-second of speed, but if a little tweaking would make a BIG difference and wouldnt require me spending MANY hours or days to do so, then I'm all for it.  I'm practically a noob at this stuff, only really educating myself in any depth about all this stuff tonight (going off of what outhers have recommended in making these purchases)...thanks for the understanding and the help in advance!  
    *looking for any help*  
      is how i feel, haha...*sigh*

    There doesn't seem to be any particular Ram type that is working for everybody. Also, many people that are experiencing problems are trying to overclock(some to extremes). You don't seem very interested in that aspect. For the Ram, you really just have to put it in and see what happens.
    If you haven't already, read the FAQ HERE for the Neo/Neo2 boards. Particularly #5 which will help you setup the SATA/IDE devices in the Bios. Use Native mode for Windows XP.
    Things I would set in the Bios right out of the box:
    (Some of these might already be set by default)
    Boot device select- Order that you want to boot from particular devices. Might have to set "On-chip IDE Config" items first and re-boot to see all your devices here.
    HT-On
    MPS revision-1.4
    APIC ACPI....- Enabled
    Dram Timing- By SPD
    Integrated Peripherals is fairly intuitive except the "On-chip IDE config" see FAQ page.
    DOT- disabled for now
    MAT- slow to start
    DRAM freq- 400
    CPU Bus- 201(seems strange but do it; try a search here for "201" and you'll know why)
    DDR voltage- 2.7v (like reilly said)
    If this works OK(try something that stresses it) you can try raising the MAT to fast. After you're happy that this is stable, you can try turbo if you want but I'm not sure with the value Ram. Once you settle on this, try playing with the DOT features. I think General is the equivalent of a 10% increase on the system. Once you've found a setting you like here, you should leave it for a while and just enjoy your new compputer!
    If you get bored, you can always go in and disable the DOT and manually raise FSB for more fun.
    Things you should read up on before you do any overclocking:
    Clearing CMOS
    5:4 FSB/MEM ratio
    Have fun!

  • Unicode problem in PCD translation

    hi,
    I am translating the PCD content in german, french and finding some special charachter which I am replacing with HTML unicode as below mentioned.
    English -Upcoming Events and Training
    French  -Calendrier des &#233;v&#233;nements et formations
    It is getting translation properly in top level navigation but not getting translation in detail level navigation. well I have tried Java Unicode also.
    I am doing translation work from "Portal content tranlation"
    Please provide me your suggestion.
    Regards,
    Sanjeev

    Hi,
    I was using the same french character first time, but it was showing some special character, A1/4 like character, so I decided to move to html unicode.
    IS there any setting required at the iview and page,workset level? Why Java unicode is not working since it is universal, It is printing the same I give like \u00e9
    Regards,
    Sanjeev

  • Problem with Language translation

    Hi All,
         Our project has gone under EHP Upgrade last week,
         But the customer is facing problem with XD03 transaction.
         The problem is, even after logging in Finish the following fields are displayed in English....
    Customer chain
    Agreem. grp. 1
    Agreem. grp. 2
    Agreem. grp. 3
    Agreem. grp. 4
    Agreem. grp. 5
    Agreem. grp. %
              I have checked with translation for the standard program, it is maintained in Finish still problem is coming.
              Can anyone guide me why this fields are not getting displayed in Finish languga

    Try to generate the main program SAPMF02D and the speciific screen

Maybe you are looking for

  • Why does my macbook air work when connected to HDMI but not my iMac

    Hi. I have an HDTV, an HDMI cord, and a HDMI -> thundebolt adapter. I plug this in to my 2013 MBA and it works fine, but when I plug it into my iMac, nothing happens. Why? Do I need a DVI -> HDMI adapter (I already have one for my dual monitor, so it

  • Can't find the fullscreen option for acrobat 9 pro

    In the technotes it's mentioned that an embedded movie (.mov, .mp4) in acrobat 9 pro can be played in fullscreen. I can't find the option.

  • Video conferencing with more than 2 people and with PC and mac users

    I want to do a video conference with up to 4 people at a time. I have a mac - MBA Rev C (OS is 10.56). I just started up iChat today for the first time and am using my AIM ID on it as I don't have a .mac account. The problem is I want to chat with ot

  • Management Pack for Windows Server 2008 Enterprise SP1

    Hello, I tried to manage the performance of a Windows Server 2008 Enterprise SP1 (6.0.6001) but SCOM 2007 R2 just check the availability with a ping status. I have installed the normal management packs: On the same SCOM, I have servers with Windows S

  • Sleeping Clients - WLC 7.6

    We are running 7.6 on our 5508-WLC.  We have a number of issues w/ 'i-clients' when they go asleep.  From what I can tell, I need to enable the 'sleeping clients' feature (not just the session and idle timeouts). On our WLANs we use Layer-2 (WPA+WPA2