GDI + thumb rules

I worked on some GDI + code in .NET and studied my lessons very hard. Simple things like:

  • What looks good on the screen may not look so good on paper and vice versa
  • Caching too many objects may throw an OutOfMemoryException
  • Floats are not accurate

... etc. I am sure that there is much more that experienced people can add to this.

What good rules should be followed when using GDI + or any graphics library in general?

One helpful tip per post would be nice. Thanks.

+3
source share
7 answers

( /) ( Dispose wrapping if IDisposable).

+5

, , .

+2

, / . , .

, , ; , , . .

, , API, ( GDI +), .

+2

, .

, ( GDI +, API, ). , (, ), .

+2

GDI Gotchas, .

  • () (Rectangle, PixelFormat). , clone(), . (), .
  • FromFile, , ( ).
  • DrawImage SmoothingMode, InterpolationMode PixelOffsetMode .
+2

GDI +, , :

, GDI + .NET, - Matrix Transform Graphics. ( ++/CLI):

g->Transform->Translate(100.0f, 250.0f);    // WRONG. Will not have any effect.

Transform . , , . , (MultiplyTransform, TranslateTransform, ScaleTransform ..), .

g->TranslateTransform(100.0f, 250.0f);
+1

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


All Articles