Re: problems with flips/rotations of certain shapes

From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 01/08/05


Date: Sat, 8 Jan 2005 02:14:49 +0100

Always draw as if you were drawing to an untransformed graphics device. The
matrix you use should always be fresh. That is to say that if you're drawing
is rotated 90 degrees and flipped horizontally then do hat every time you
draw. Dont rotate 90 degrees in one cycle and then flip horizontally in the
next.

Matrices can be compounded by multiplying them together. The order in which
you multiply is important.

-- 
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<sean.slavin@wonderware.com> wrote in message 
news:1105138006.490959.142200@f14g2000cwb.googlegroups.com...
> I'm trying to debug some code and now I'm lost. Here's the problem.
>
> I have a graphic editor with which I can draw shapes and other
> graphical items. I can also do rotations (90 degree increments,
> clockwise and counterclockwise) and flips (horizontal and vertical).
> With some shapes, such as a curve, they 'walk' across the screen as
> they are being rotated or flipped. Rotation and flips are being
> accomplished with a matrix. There is no apparent pattern to the
> 'walking'. Sometimes they move only 1 in the x and y directions.
> Sometimes more depending on how I've tried to compensate. I just can't
> seem to put a definitive finger on where this is happening.
>
> As far as I can tell, the calculation for determining the shapes
> bounding rectangle is off a little. I'm not sure why this occurring.
> I'm hoping that someone has had experience with this type of problem.
>
> If my explanation is lacking, please let me know and I'll do my best to
> explain further. I'm not sure if I can supply sample code but I might
> be able to come up with a snippet if need be.
>
> Thanks in advance
>
> Sean
> 


Relevant Pages

  • Re: Ignored advice, am now in serious poo on graphics
    ... Then I put in a thread.sleep, after the draw in the Paint method, and noticed a strange thing - the image was shown for 1000 milliseconds, then disappears. ... If you're doing your own drawing, there's nothing in a PictureBox control that is useful to you. ... It would take a lot more than a single newsgroup post to address all of the complexities of graphics under Windows. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Anchors and Objects
    ... You're looking for info on interactive designers. ... raster drawing programs use. ... Basically you need to store the information about your shapes in an array ... Some of my programs allow you to DRAW an item, ...
    (microsoft.public.vb.general.discussion)
  • Re: Memory problems, I think...
    ... In the same way when you draw to a MetaDC you draw ... > list of API drawing commands that have been fired at it. ... or have to rasterise the shapes as you draw them. ... >> the source floorplan image) to the small memory DC, ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Transparency Revisited...
    ... Draw the shapes on bitmaps then use bitblt to copy the bitmaps to the desired ... > Anyone have any suggestions on how to separate the two drawing planes? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Clear
    ... If you're using a picture box as a canvas for drawing on then you probably ... Use a panel as a placeholder and draw in response to the panel's ... > How do I clear a graphics region & repaint a new drawing. ...
    (microsoft.public.dotnet.framework.drawing)