Mirror / rotate image ( System.Drawing.Graphics / System.Drawing.Drawing2D.Matrix)

E

Eduard Witteveen

Hello list,

I have code the draw MyDrawingObject information on a
System.Drawing.Graphics object. The code is more/less the following:
void MyDrawingObject::Draw(ref System.Drawing.Graphics graphics, ref WindowDrawer windowdrawer)
{
if(_mirror || _rotate != 0) {
// do something here?
}
foreach (drawelements.DrawElement element in _drawelements)
{
if (windowdrawer.LayerActive(element.Layer))
{
element.Draw(ref graphics, ref windowdrawer, _location);
}
)
}

I now want to rotate / mirror the object i draw.
I've looked at the System.Drawing.Drawing2D.Matrix, which can be applied
on the Transform property of the Graphics object, but it will work on
the complete graphics object and there is no mirror method in it.
Can somebody help me do this / give me some pointers?
 
K

Kevin Spencer

To mirror an image, first you need to decide whether to mirror it
horizontally or vertically. Once you've done that, you simply draw it a
pixel at a time (use an unsafe code block), in reverse order of rows or
columns.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
 
E

Eduard Witteveen

Kevin Spencer schreef:
To mirror an image, first you need to decide whether to mirror it
horizontally or vertically. Once you've done that, you simply draw it a
pixel at a time (use an unsafe code block), in reverse order of rows or
columns.
And i should do the rotation in this same step?
Furthermore, arent their any 3th party libs which i could use?

ps: changed subject...
 
E

Eduard Witteveen

Kevin Spencer schreef:
To mirror an image, first you need to decide whether to mirror it
horizontally or vertically. Once you've done that, you simply draw it a
pixel at a time (use an unsafe code block), in reverse order of rows or
columns.
And i should do the rotation in this same step?
Furthermore, arent their any 3th party libs which i could use?

ps: changed subject...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top