DrawTexturedPath - Rotation

Hey,.

Right now my xPts and yPts are configured to give this PolygonPath a rotation of-20 degrees from the x axis. I'm not quite sure how to determine the values of Fix32 below. How can I calculate these values?

graphics.drawTexturedPath (_xPts, _yPts, null, null, 0, 0, 0, - (1)< 16),="" (1="">< 16),="" 0,="">

Have a look here:

Rotate and scale of bitmaps

In your case, you will need to do something like this:

int dux;
int duy;
int dvx;
int dvy;

int angle = Fixed32.toFP(-20);

dux = Fixed32.cosd(angle);
dvx = - Fixed32.sind(angle);
duy = - dvx;
dvy = dux;

graphics.drawTexturedPath(_xPts, _yPts, null, null, 0, 0, dux, dvx, duy, dvy, _targetBitmap);

Have not tested, but should work.

When we talked about this last time (graphic;) Police thread), my 90 degrees angle - this is the 0, -1, 1, 0 came (staggered 16-bit to the left to be in the format Fixed32).  Furthermore, I quoted the same article, I now use under the reference .

Tags: BlackBerry Developers

Similar Questions

  • Rotation of bitmap with drawTexturedPath

    I'm trying to find the fastest way to draw a bitmap to an arbitrary angle.  Here's what I have so far:

    private void drawRotatedBitmap(Graphics graphics, Bitmap bm, int angle, int x, int y) {
      int w = bm.getWidth(); int h = bm.getHeight();
      double a = Math.toRadians(angle);
      int x1 = (int) (x - h * Math.sin(a));
      int y1 = (int) (y + h * Math.cos(a));
      int x2 = (int) (x1 + w * Math.cos(a));
      int y2 = (int) (y1 + w * Math.sin(a));
      int x3 = (int) (x + w * Math.cos(a));
      int y3 = (int) (y + w * Math.sin(a));
      int xPts[] = {x, x1, x2, x3};
      int yPts[] = {y, y1, y2, y3};
      int fAngle = Fixed32.toFP(angle);
      int dvx = Fixed32.cosd(fAngle);
      int dux = -Fixed32.sind(fAngle);
      int dvy = Fixed32.sind(fAngle);
      int duy = Fixed32.cosd(fAngle);
      graphics.drawTexturedPath(xPts, yPts, null, null, x, y, dvx, dux, dvy, duy, bm);
    }
    

    The problem is that drawTexturedPath does exactly what it was designed for: he draws a path.  Could someone please suggest a way to hide the part of path, so the rotated image would not have a line around it?  Are there other ways to draw a rotated quickly image and with a quality comparable to that drawTexturedPath produced?

    I found the source of the problem.  Apparently the path comes only when you enable the anti-aliasing polygon by calling

    graphics.setDrawingStyle (Graphics.DRAWSTYLE_AAPOLYGONS, true);

    Deleting this line solves the problem.

  • Problems with the image after the rotation of the

    Hello world

    I'm turning my .png image using the ImageManipulator library. Current rotation works fine, BUT - my image with alpha background is rendered on a gray square instead of alpha channel. What should I do with my image? How to preserve this alpha channel after rotation?

    OK, finally I managed to solve it. For those who are facing the same bugs with alpha channel by using ImageManipulator, you must change the method ' private Sub paintTransformedBitmap (Graphics g, int textureOriginX, int textureOriginY)

    private void paintTransformedBitmap(Graphics g, int textureOriginX, int textureOriginY) {
            // Make the drawing space transparent first before painting
            g.setGlobalAlpha(getBackgroundAlpha());
            g.setBackgroundColor(getBackgroundColor());
            g.clear();
            g.setGlobalAlpha(255);
            /**
             * Keep the precision of our transformation and Scale the drawing as
             * well. Scale is applied as though a matrix of the form
             *
             * 
             * | ScaleX  0     0|
             * | 0    ScaleY   0|
             * | 0       0     1|
             * 
    * is multiplied by the Transformation matrix * / dux int = Fixed32.div (transformMatrix [UX], resultantScaleX); DVX int = Fixed32.div (transformMatrix [VX], resultantScaleY); Duy int = Fixed32.div (transformMatrix [UY], resultantScaleX); dvy int = Fixed32.div (transformMatrix [VY], resultantScaleY); Necessary for alpha changes with Graphics.Clear 6.0 / / g.setColor (Graphics.WHITE); g.drawFilledPath (bitmapXPts, bitmapYPts, null, null); g.drawTexturedPath (bitmapXPts, bitmapYPts, null, null, textureOriginX, textureOriginY, dux, dvx, duy, dvy, bitmap); }

    Notice the end of the method - setColor and drawFilledPath now commented and image appears.

  • drawBitmap, flipping and rotations

    Hello

    How can we draw a rotated bitmap or returned WITHOUT creating a new bitmap and do the conversion manually?

    Thank you

    I don't know if this will help, but the origin x and y values are the origins of the screen and not the origins of the image as with drawBitmap. 0,0 IE will begin to draw to the screen 0,0 location and does not start the drawing of the location of the image 0,0 as with drawBitmap. I guess this, because drawTexturedPath the image tiles, but the documentation is not very clear.

  • Display Rotation error

    Hello

    I had a problem with the rotation of the screen under macOS Sierra function. As the screen rotates, there is an error that pop up and later that I'm unable to get into system-> Display Preferences. It is for me a "mistake preferably: County not load display preferences" message and I was unable to rotate the screen back. I started from the system in safe mode and temporarily solved the problem. But if I want to rotate the screen again, it pops up the same error again. I was using the rotation function pretty well in OS X El Capitan. But since I updated to macOS Sierra, I had this problem.

    I wanted to know if there is a lasting solution to this problem.

    I'm using macOS Sierra on MacBook (13-inch, early 2015) Air with processor 1.6 Ghz Intel Core i5 and 8 GB memory DDR3 at 1600 MHz with 128 GB of storage.

    Hello PavanGJ,

    Thank you for using communities Support from Apple. I see that since upgrading to Mac OS Sierra problems of screen rotation. The preferences window does not. I know how it is important for your Mac to work reliably. I'll be more than happy to help.

    Great job to test mode without failure. In Safe Mode disables most of the third-party services, it could be a compatibility problem with an application that you have. Check out this article:

    OS X El Capitan: If you have problems with startup items

    You can not hold account that the title suggests it's to El Capitan. It applies to macOS Sierra as well.

    You can also test the issue in a new user account.

    How to test a question in another account on your Mac - Apple Support

    Let us know if that helps.

    Take care!

  • Function of more limited rotation on imac than the iphone!

    I just realized that the edit > function of rotation is more limited on Photos/imac compared on my iphone.

    It is surely not good! On my 27 inch screen it only allows me to rotate 90 degrees, but on the iphone I can adjust to any angle that I wish, and it also gives a grid to help align things.

    Maybe it's a setting I'm missing - otherwise I find it's a huge gap for not being able to properly rotate the photos on my imac.

    In Photos on my Mac 2.0,.

    -I select the picture

    -Click the button to reveal the editing tools (top right photo window, to the left of the Details button)

    -then right click on the first symbol third with two arrows dotted ("crop" in French...)

    -then click, hold down and up and down

  • Are aware that even if the rotation function is no longer available on the new trackpad, it is always presented on their Apple tutorial. Please discuss!

    Are aware that even if the rotation function is no longer available on the new trackpad, it is always presented on their Apple tutorial. Please discuss!

    Hello

    Read this article to support > gestures multitouch for use on your Mac - Apple supported

  • Beach ball of rotation on Mac Mini (mid 2011)

    My Mac Mini (mid 2011). When I try to install everything I get is a beach of rotation ball.

    Hello Jerry5337,

    Thanks for this info and choosing the communities Support from Apple. I know the importance of being able to update your Mac Mini is for you! The good news is that the following steps will be useful for your problem of not being able to install the macOS Sierra update and get your Mac Mini is working again!

    Try running first emergency tool on your hard disk with the built in disk utility, allowing to correct simple issues that you are experiencing. Restart your Mac Mini and then try to install again.

    For Mac disk utility: repair a disk using disk utility
    How to turn on or off your Mac

    Use SafeMode to start up your Mac so that it performs certain checks, remove files from the system cache, check your startup disk and trying to fix problems directory if necessary. Sign in to your account in safe mode and try to reinstall.

    Try safe mode if your Mac does not end commissioning
    Graphics performance limited in recovery of OS X or in safe mode

    See you soon!

  • iPad air2, locked rotation

    MY new iPad is currently locked in portrait after update to 10.02.

    iPhone 6 is blocked as well.

    Do check that the rotation lock is disabled on both.

    Any ideas?

    Start simple with a reset. Press and hold the home and power buttons until the Apple logo appears. Release the two fingers. Wait for your iPad to begin on its own.

  • I have an imac 27 "... on power there is no signal to startap, usb ports are not working and its deadlock with the logo of the Apple with the circle of rotation... Help, please

    I have an imac 27 "... on power there is no signal to startap, usb ports are not working and its deadlock with the logo of the Apple with the circle of rotation... Help, please

    Wake the computer to your Apple store or Apple authorized service for the service provider. He probably suffered a hardware failure.

  • Automatic rotation of the order

    Hello

    I Iphone5s using last year, but now, suddenly, auto-rotation doesn't work on my phone can someone pls suggest me how to get this resolved?

    Concerning

    GO

    Not all screens will rotate from portrait to landscape. Are you sure that it is a screen that turns? If you are, make sure that the orientation lock is not on. Go to the control center and the lock is the last icon in the top row. If it is white, it is on, black and turned off. You can turn on and back it was off. You can also do a reset on the phone. This will affect all the data. Hold down the home and sleep/wake together until you see the Apple logo and then release. The phone will restart. Test.

  • Firefox is no longer load any website on my iMac Yosemite 10.10.5 running upward. It was working fine but now it does nothing but show the circle of rotation.

    Help! One day he was working, and the next day he was not. No update, nothing. I deleted and then got a new copy of Mozilla, but it did not.
    All I get is the circle of rotation; no load Web sites.

    Start Firefox in Safe Mode {web link} by holding down the < shift >
    (Mac options)
    key and then from Firefox. Is always the problem?

  • Some Images open in a new window or tab are backwards or rotated 90 degrees,

    Some Images open in a new window or tab are backwards or rotates 90 degrees, but they appear in the correct position when you use Internet EXPLORER.

    I don't even know if it's a browser or a browser-server interaction problem. The problem manifests a certain user forums where members post jpg images that appear as thumbnails. "I can right-click and select"Open in new window"or open in a new tab. Either way some images open OK, some open pivot 90 degrees out of position sometimes upside down. If I use Internet EXPLORE the same images will open on the right side.

    computer: Dell Latitude
    OS: Windows 7 Pro
    Browsers: Firefox 41.02 / MSIE 11.0.9600.18059

    MysteryTech said

    Not in bold. Looks like this:
    Layout.CSS.image - orientation.enabled; true
    Status: default
    Boolean type

    Laughing out loud! But if I double-click on it replaces:
    Layout.CSS.image - orientation.enabled; false
    Set of users of status
    Boolean type

    Now when I right-click the image and select either "open in new tab" or "open in new window" the image is right-side up!
    

    Thanks to you all!

  • Ball rotation range

    I have a 2011 21 "iMac with 8 GB of Ram. I use OS X of El Capitan. When I get the rotation beach ball I have to restart. Also, when I get the beach ball all four carrots are 100%. The apps I have running is the finder, mail, iMessage, Safari & Parallels when this happens. It also happens when the screen saver is turned on and I try to put my password. Is it a memory problem?

    Your profile says your Mac works v10.11.5 so see if the update using v10.11.6. Open these System co> App Store > check now or open the App Store and then select updates from the menu.

    Aside from that, check the hard disk.

    Open utility disk located in Applications/Utilities

    Select the disk to boot on the left then click the first aid tab, and then click run.

  • rotation of Messages iOS 9.3.3

    It seems that iOS 9.3.3 will only allow messages in landscape mode (on iPhone 6). Is there a way to rotate the picture as before? Really annoying, this

    Philsparke wrote:

    It seems that iOS 9.3.3 will only allow messages in landscape mode (on iPhone 6). Is there a way to rotate the picture as before? Really annoying, this

    No, this isn't I have no problem with a rotation on my 6 iPhone on ios 9.3.3.

    Have what troubleshooting you done?

Maybe you are looking for