Rotate an image in Windows Mobile Programming

Is there any mechanism in Windows Mobile software for rotating a bitmap?

I would like to rotate this to any angle.

+3
source share
1 answer

You must do this yourself in code, because RotateTransform is not available in CF:

public Bitmap GetRotatedBitmap(Bitmap original)
{
    Bitmap output = new Bitmap(original.Height, original.Width);
    for (int x = 0; x < output.Width; x++)
    {
        for (int y = 0; y < output.Height; y++)
        {
            output.SetPixel(x, y, original.GetPixel(y, x));
        }
    }
    return output;
}

SetPixel and GetPixel are absurdly slow; A faster way to do this is with the LockBits method (there are a number of questions on SO that show how to use this).

+2
source

Source: https://habr.com/ru/post/1714736/


All Articles