LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to rotate a bitmap?

Hi,
I need to be able to display different colored shapes on my picture control:rectangles, arrows, trapezoids now I know I can draw them using bitmaps but the hard part is that depending on other info I'll have to display them at different coordinates and more importantly facing all kinds of different ways, so how should I do this? I need to say have an arrow that will be facing a circle that I have drawn on my picture control, but it can me facing it from 360 different degrees and I'm sincerely hoping there is a way to do this without making 360 bitmaps, please help!
0 Kudos
Message 1 of 8
(4,178 Views)
My suggestion is to try "Drawing functions" related to picture control in order to increase flexibility.
Another idea is to make your own activeX control, implement everything in it and just set some parameters (like angles, coordinates, etc.) from LabVIEW.
Hope this helps
0 Kudos
Message 2 of 8
(4,178 Views)
Helper;

There is a new VI for LabVIEW 6i that allows you to rotate picture images to any desired angle. Check it out!

Rotating Graphics (Pixmaps) in LabVIEW

Regards;
Enrique
www.vartortech.com
Message 3 of 8
(4,178 Views)
If your application is very simple, such as just draw and rotate some geometric shapes (either 2d or 3d) on the screen based on some user inputs, then I would suggest to use OpenGL for speed, and it is not necessarily slow in development time. LabVIEW gives you advantage in development time for most of the application but limits the speed and uses more memory.

Joe
0 Kudos
Message 4 of 8
(4,178 Views)
Hi,
Actually my application is rather complex, well it basically has one big picture control with lots of things constantly being displayed on it. So that's where the shapes come in, based on certain angles that will be input data to my VI, I have to display say arrows pointing in towards a circle. The circle will always be at the center of my picture control but the arrows (which I am still not sure how to draw since they need to vary in size/color) will have to point in or away from it from all kinds of different angles which will only be determined on the fly. I hope that is more clear on my task at hand.
0 Kudos
Message 5 of 8
(4,178 Views)
> I need to be able to display different colored shapes on my picture
> control:rectangles, arrows, trapezoids now I know I can draw them
> using bitmaps but the hard part is that depending on other info I'll
> have to display them at different coordinates and more importantly
> facing all kinds of different ways, so how should I do this? I need to
> say have an arrow that will be facing a circle that I have drawn on my
> picture control, but it can me facing it from 360 different degrees
> and I'm sincerely hoping there is a way to do this without making 360
> bitmaps, please help!


If I were doing this, I wouldn't use bitmaps at all. The picture
control is quite good at drawing vector graphics such as lines,
rectangles and polygons. Rotating the points of
these shapes just
involves some simple trig and basic math.

I don't have enough details of what you are trying to draw, but if the
arrows are simply three lines, you can compute the primary point
tangential to the circle and compute three other points, one at the same
angle but with a longer radius and two at plus and minus 15 degree
angles. If you want to change color or other line attributes that
shouldn't be a problem either.

If you want the triangles filled, compute the same four points and
append them to make an array of points to send to the polygon VI.

It is true that there are higher performance graphics techniques, but
you can get quite a bit done with the picture control in a very short
amount of time. For examples that do similar things, you can look at
the robot arm example.

Greg McKaskle
0 Kudos
Message 6 of 8
(4,178 Views)
I have to draw arrows & dashed lines in a picture control, Just like we can do that in word or paint etc. I need to do the same using the mouse and drag the line/arrow till I realease the mouse. I am able to this for a normal line ( it works perfectly) but when I have to draw an arrow or a line I am stumped. Since you have been working on the same I was wondering if you have come up with a solution. Could you help me.
0 Kudos
Message 7 of 8
(4,178 Views)
> I have to draw arrows & dashed lines in a picture control, Just like
> we can do that in word or paint etc. I need to do the same using the
> mouse and drag the line/arrow till I realease the mouse. I am able to
> this for a normal line ( it works perfectly) but when I have to draw
> an arrow or a line I am stumped. Since you have been working on the
> same I was wondering if you have come up with a solution. Could you
> help me.
>

Rotating a bitmap is one way of doing this, but it will be much easier
to do this with polygons and vectors. The line is represented as two
endpoints. A line with an arrowhead has a few additional points located
relative to one of the endpoints and oriented about the line. Doing a
bit of trig to rotate all of the p
oints will give you points that you
can make a polygon out of for you to fill.

Greg McKaskle
0 Kudos
Message 8 of 8
(4,178 Views)