Rotate image X degrees on WM5

Hello,
I'm creating a programs for a PPC running WM5. The program needs to be able to rotate an image X degrees. But until now I didn't find much that I can use.
On a desktop you've got the Advanced graphics and awt.geom. But I can't seem to find anything that�s CDC (with PP) compatible.
I found one tread of someone that did it manual, but it has two disadvantages: 1: It's to slow | 2 it doesn't fill empty spots that are generated by rotating an image.
The tread:
http://forum.java.sun.com/thread.jspa?forumID=80&threadID=754901
Does anyone know a solution of how to do this correctly?

1: It's to slowThat's completely unoptimised code. I would estimate that with some effort it can be made at least 10 times faster, if not 100.
2 it doesn't fill empty spots that are generated by rotating an image. What do you mean?
Edit: Oh, I get it. Yes, the first change I'd make to that code is to iterate over destination pixels rather than source pixels.

Similar Messages

  • Rotate TV 90 degrees and display images properly?

    I would like to rotate our LG HDTV to Vertical orientation (not the traditional horizontal orientation), and display the images from an Apple TV in the vertical orientation. Is this possible? I know that I can rotate images on my MacPro monitor (Cinema display) by 90, 180, or 270 degrees. This is the sort of control I would like from an Apple TV when output to the Vertical standing HDTV.

    While you could easily turn the Tv and have any Portrait photos rotated landscape to view on a tv in portrait mode, AppleTV itself will not natively support display rotation - the photos properly tagged would show ok but menu would be all wrong and not rotated. You'd be better using a Mac Mini or other computer that allowed display rotation - use a DVI to HDMI adapter.

  • 360 degree rotate image mouse drag edge tutorial

    360 degree rotate image mouse drag edge tutorial and give edge file

    My thoughts would be to, use an event listener for mouse
    down.. then depending on where the mouse is down have it create
    another event listener for mouse move, for example if the mouse x
    and y was in the range of where you want.. And after that in the
    mouse move function create a tween depending on where the mouse x
    or why moves to.
    private function mouseDOWN(evt:MouseEvent):void{
    //if mouse x or y is in the position rang wanted, create the
    event listener for mouse movement and mouse up.
    private function mouseMOVED(evt:MouseEvent):void{
    //if mouse y moved from original position, figure out the
    difference
    // create a tween on the object's original location, and
    addition of the difference.
    private function mouseUP(evt:MouseEvent):void{
    // remove all of the event listeners to stop all
    interaction. Also removing the mouse up listener.
    hope this helps

  • Why would an image distort when rotating it 90 degrees?

    I got a file from a client, which, when I attempt to rotate it 90 degrees, it distorts elongated. And no, it doesn't matter whether I use PS, Illustrator, or InDesign. Weirdness is making me crazy!?!

    If you want assistance from your fellow users, you need to give a lot more detailed information:
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers: 
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Rotated image overlaps other controls

    Hi, I am working on an AIR app involving images. One of the functionalities is viewing as well as rotating images. I made a simple test app to illustrate this portion:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
        <mx:Script>
            <![CDATA[
                private function rotate():void
                    var bitmap:Bitmap = Bitmap(img.content);
                    var matrix:Matrix = bitmap.transform.matrix;
                    var centerX:Number = bitmap.width/2;
                    var centerY:Number = bitmap.height/2;
                    matrix.translate(-centerX, -centerY);
                    matrix.rotate(90*Math.PI/180);
                    matrix.translate(centerY, centerX);
                    bitmap.transform.matrix = matrix;
            ]]>
        </mx:Script>
        <mx:Text width="100%" text="Some text"/>
        <mx:Image id="img" width="100%" height="100%" source="test.jpg" horizontalAlign="center" verticalAlign="middle"/>
        <mx:Button label="rotate 90" click="rotate()"/>
    </mx:WindowedApplication>
    The application window has text on the top and a button on the bottom, with the image in the middle. Each click of the button rotates the image by 90 degrees.
    On launch, the app works great. It fetches the image file and fits it to the Image container. As I resize the application, the image also resizes and maintains the position relative to the other controls. Top text and bottom button are where they should be. All good. Let's assume the image is landscape/wide. After I perform the rotate 90 degrees by clicking the button, although the image is rotated and now in portrait orientation, the bottom portion of the image is now out of the image boundary and overlapping the button.
    Is there a way to tell the image to fit the content to the container again? Basically, re-layout the whole thing as if the image is in this new orientation.
    I suppose I can try to figure out a change in scale and resize the image, but I am not sure if this will hold when the user resizes the application. Also, the rotated image is now rather far to the left, as the "top left" corner is where a landscape image would be. For a portait orientation that's centered horizontally, it should be further to the right. I suppose I can also come up with some formula to center the rotated image. It just seems that the application already has all this logic built in, as it did exactly what I wanted when the image was loaded initially. If I can just ask the application to do it again. Note that similar issue occurs if the image starts out in portrait orientation and is rotated to landscape (too far to the right).
    Thanks in advance for the help.
    Will

    Thanks Sheila and Arnis,
    Today I opened the project to try different zoom settings and the problem has vanished; I get the correct arrow at zooms of 100, 120 and 140%.
    Likely a bug somewhere deep in Frame's innards. Anyway we've ordered TCS3 so soon I'll be using FM10. Thanks anyway.
    --- Derek

  • Rotated images in inDesign

    I have used CS6 on my Mac (10.6.8) to create a 240 page book with several images on most pages. Some of these have been rotated by about 20 degrees or so for effect, and are fine when viewed on inDesign. However, when exported to pdf in high quality mode a grey (un-rotated) box appears around each of the rotated images. It's faint but it is there. I did try rotating in Photoshop first and then creating a clipping path, which I have done for other images but this appears compromised by the rotation also. Grouping a number of images before rotating, as I have done on the cover, also seems to cause a particular problem, with the crop then coming in at an angle also. Even if you then ungroup these, the program seems to remember they were grouped before and still refuses to do a vertical crop, though it behaves ok with the rotated image before it is grouped. Drop Shadows on the title text appear VERY dull on my screen when viewed in the high-quality pdf mode also, though a friend viewing the same file on his computer does not get this effect. I think I can work round most of these, but the grey boxes are a real issue.
    Thanks
    Les Brown

    Hi Peter
    interesting. I was just clicking on the file, so I think it was Apple preview. However, if I select Acrobat 10.1.1 the image looks good against a white background (my main problem.) Does this mean the file is OK to send for printing in this form? I note that for the cover image (blue background) the drop shadows are still very dull and there is still a slight colour issue with the rotated image.
    Thanks
    Les

  • Rotating images in Address Book??

    I am rather confused at the determination of Address Book to store contact photo's on one side??
    I have rotated images right round 360 degress but no matter what way up they are once I drag them on to the image frame, address book automatically rotates the image 90 degrees counterclockwise of the right way up???
    It is clever how it knows but also very frustrating? Does anybody else have this experience?
    Mac Mini connecting iPod Nano + Sony Ericsson K810i   Mac OS X (10.4.8)  

    Hi Wesley,
    Welcome to Apple Discussions
    Are you saying that Address Book takes an perfectly good upright image and rotates it 90 degrees CCW?
    I am a little confused by your statement.."It is clever how it knows but also very frustrating?"
    What program are you using to edit/rotate your images?
    Regards,
    John

  • Rotated Images

    When I download a picture to Desktop it transfers the picture to a folder called Rotated Images no matter which ISP I am using. It also happen if I drop an image /picture onto the desktop: it sits there apx 3 seconds then creates a Rotated Images folder & the picture is there rotated 90 degrees.
    I have tried deleting the folder to Trash, emptying the Trash, and Restart. Same thing happens. Although there is no Rotated Images folder on the Desktop, as soon as I drop any image on the Desktop it creates an Rotated Images folder and the picture goes in there and rotates 90 degrees. It seemed to suddenly start. I don't believe I installed any app that would cause it to happen (I hadn't installed an app at the time it started).
    I don't know if it was 'spammed' to my iMac -possibly?
    When I use Spotlight it doesn't find Rotated Images except for the newly created folder on the Desktop.
    Has anyone encountered this problem? Has anyone found a solution? It is confusing and annoying. I have to add it to iPhoto then rotate it and Revert to Original rotates back.
    The work/around is to Rotate & Save in Photoshop, then Import to iPhoto. Bummer.
    Thank you.

    I meant to ask: Has anyone encountered this problem? Has anyone found a solution? It is confusing and annoying. I have to add it to iPhoto then rotate it and Revert to Original rotates back.
    The work/around is to Rotate & Save in Photoshop, then Import to iPhoto. Bummer.
    Thank you.

  • Is it possible to rotate images?

    I'd like to rotate some images slightly, like cards scattered on a table -- that is, not all neatly squared up.
    I can't find a way to do it in IBA. Is it possible to rotate images a few degrees?
    tks
    jgoshawk

    Sure...select an image, open the Inspector, hit the 'Metrics' tab, then use the 'rotate' wheel at the lower part of that window.

  • Rotating image affects location

    Following up on the animated half image and placing labels on the curve I finally got the layout right. Though the curious thing is, when rotating the wheel, the control y position changes.
    First I thought that this might be a similar effect, that could be solved with setting the inset, but that is not true.
    My theory is that, as the image is square, when the square rotated by 45 degrees the height is larger. How can I counteract this. I tried to update the translateY property but that had no effect.

    What I have figured out so far is the following: As the image is basically a rectangle, when rotating the square by 45° it's height is larger than unrotated. This application demonstrates it:
    package javafxtest;
    import javafx.application.Application;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.geometry.Bounds;
    import javafx.geometry.Point2D;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    public class RotatedClippedArea extends Application {
        @Override
        public void start(Stage stage) {
            stage.setTitle("Steering Wheel");
            Group root = new Group();
            Scene scene = new Scene(root, 1000, 350);
            scene.setFill(Color.LIGHTBLUE);
            HBox hBox = new HBox();
            hBox.setSpacing(10);
            //Group g = new Group(background);
            for (int i = 0; i<=90; i += 20) {
                VBox vbox = new VBox();
                SteeringWheelGroup background = new SteeringWheelGroup(200, i);
                Label angle = new Label("Angle: "+i+"°");
                final Label heigth = new Label("Heigth: "+background.getBoundsInLocal().getHeight()+"px");
                heigth.boundsInLocalProperty().addListener(new ChangeListener<Bounds>(){
                    @Override
                    public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) {
                        heigth.setText("Heigth: "+t1.getHeight()+"px");
                vbox.getChildren().addAll(background, angle, heigth);
                hBox.getChildren().add(vbox);
            root.getChildren().addAll(hBox);
            stage.setScene(scene);
            stage.show();
        private Point2D calculateBasePoint(Point2D center, double radius,
                double angle) {
            float newX = (float) (center.getX() + radius * Math.cos(Math.toRadians(angle)));
            float newY = (float) (center.getY() + radius * Math.sin(Math.toRadians(angle)));
            return new Point2D(newX, newY);
        private class SteeringWheelGroup extends Group {
            private double scale;
            public SteeringWheelGroup(int destinationWidth, double angle) {
                //InputStream is = getClass().getResourceAsStream("SteeringWheel.png");
                //Image unscaled = new Image(is);
                Rectangle rect = new Rectangle(getImageWidth(), getImageWidth(), Color.RED);
                scale = destinationWidth / rect.getWidth();
                //ImageView steeringWheel = new ImageView(unscaled);
                rect.setScaleX(scale);
                rect.setScaleY(scale);
                rect.setRotate(angle);
                Group rotationGroup = new Group(rect);
                int width = getImageWidth();
                Rectangle clip = new Rectangle(0, 0, width, width / 2);
                rotationGroup.setClip(clip);
                this.getChildren().add(rotationGroup);
            public double getScale() {
                return scale;
            public final int getImageWidth() {
                return 479;
        public static void main(String[] args) {
            Application.launch(args);
    This will create this application.
    What seems inconsistent that the clipping initialized with half the height in the unrotated state, will always clip half the height. I would have expected to only get the the top 200 pixels of the image irrelevant of the current state of the rendering.
    But the basic question is: How can I figure out the current height? The boundsInLayout will always return the same value. I could calculate the height of the visible part using the angle of the rotation but would like to avoid that.
    If I get the current height I can apply a second clip which basically translated the the whole thing. While this may not make sense for this example, my use case involves an image with a centered circle, so the most top visible part of the image will always be at the same height above the (clipped) bottom line.

  • Rotating image moves pixels out of canvas.

    I was under the impression that using Image => Image Rotation => => 90 CW would rotate everything ninety degrees clockwise, but I guess I don't understand exactly how it works.
    When makin a very simple 2 pixel pattern, I filled the right pixel with black and left the other pixel empty. I then wanted to see how the pattern would look horizontally so I rotated the image 90 deg clockwise and found that my black pixel was moved off of the canvas.
    Next I tried some testing to see if I could better understand what was happening. I found that if I rotate the image CCW then the pixel would be in the correct place, but if I fill the left pixel with black instead of the right I would have to rotate CW to keep the fill from going off canvas. I thout that maybe I was rotating the canvas only, but when testing a larger image I found that wasn't the case.
    I could go on, but basically I can't figure out how to rotate an image with 2 pixels ninety degrees. Kind of silly, what am I doing wrong?

    Doesn't happen on my end. Maybe a video driver issue?

  • Saving rotated image without background

    Ok I need help....I have rotated an image 20 degrees and would like to save it as a rotated image but whenever I do there is a white background around the image. Look at the image below, I rotated it 20 degrees but when I saved it, it saved with the white background. How can I save the rotated image but without the white background????
    (I changed the color so you could see the background)

    If your working with one layer (locked background layer), double click
    on the layer thumbnail in the layers panel to make it a new unlocked layer.
    Then when you rotate the photo, the background should be transparent.
    Also to maintain transparency, save in another format other than jpeg, such
    as psd, tif, png-24.
    MTSTUNER

  • Rotating images and PDFs arbitrary in Viewer

    All my scans are slightly out of rectangularity, because my scanner ist not running correctly.
    Is there a way to rotate in finer degrees than 90/180 etc.) Maybe the automator gives a clue?

    Most image editing applications will do that. Some will look for horizontal lines and do it automatically. Others will let you choose two points on a horizontal line. I have straightened scans with Photoshop Elements, Gimp, and Graphic Converter.
    Of course, often the original is not straight, and sometimes different parts of an image are not parallel to other parts. The scanner may not be the problem.

  • OCR without rotating image

    In Acrobat 9 I can't find any setting to disable image automatic rotating of recognized documments by OCR.
    I have usually very exact position of originals and I don't need this teature.
    Besides, after this rotating by 0,0... degrees, Acrobat ruins image and add some linear deformates.
    Please, help me how to make OCR without rotate image.

    I am assuming that when you open your photo in CS5 that the layer is automatically locked?
    If yes, then you can right click that layer and there is an option at the top called "Layer From Background...".
    This unlocks that layer without having to duplicate it.
    To rotate an image without changing dimensions of the actual photo?  When you rotate an image the width and the height dimensions are switch depending on how you rotate.
    Under Edit>>Transform, you will get 4 different options to rotate.
    The rotate at the top is to manually rotate the image.  The other rotates are presets which might be what your after.

  • Browser background - how to rotate image?

    When I insert an image for my browser background it rotates itself 90 degrees when I publish the site. In iweb the image is correct, it's only when I publish that it has the wrong rotation.  How can I control this?

    Try publishing your site to a local folder and launch it in the browser by double clicking the index.html file...
    http://www.iwebformusicians.com/iWeb/Publish-Website.html
    If the background image is wrong in this version, try the troubleshooting steps under "Fix iWeb" here...
    http://www.iwebformusicians.com/iWeb/iWeb-Tips.html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

Maybe you are looking for