Performance while drawing an image

2

I currently use the DrawImage method of the Graphics class. However, the drawing speed in the components is very slow. How can I optimize its use?

Can libraries like MonoGame or OpenTK perform better on this?

Here is an example of code in the OnPaint method overload.

  if (m_IsThumbnail)
        for (int j = 0; j < 3; j++)
        {
            g.DrawLine(new Pen(Color.DarkGray),
                new Point(dl + 3, dt + dh + 1 + j),
                new Point(dl + dw + 3, dt + dh + 1 + j));
            g.DrawLine(new Pen(Color.DarkGray),
                new Point(dl + dw + 1 + j, dt + 3),
                new Point(dl + dw + 1 + j, dt + dh + 3));
        }

        XImage = dl;
        YImage = dt;

        g.DrawImage(m_Image, dl, dt, dw, dh); // lentidão.
    
asked by anonymous 07.07.2015 / 14:51

0 answers