Guest User

Untitled

a guest
Jul 16th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. // Bitmap anlegen welches doppelt so groß ist wie das Originalbild
  2. Bitmap outputimage = new Bitmap(inputimage.Width * 2, inputimage.Height * 2);
  3.  
  4. // Erste for-Schleife durchläuft das Bild horizontal
  5. for (int x = 0; x < inputimage.Width; x++)
  6. {
  7.  
  8. // Zweite for-Schleife durchläuft das Bild Vertikal
  9. for (int y = 0; y < inputimage.Height; y++)
  10. {
  11.  
  12. // Farbwerte des Originalbildes holen
  13. Color pixelRGB = inputimage.GetPixel(x, y);
  14.  
  15.  
  16. // Vergrößern der Pixel und Zusammensetzen des skalierten Bildes
  17. outputimage.SetPixel(x * 2 + 1, y * 2, pixelRGB);
  18. outputimage.SetPixel(x * 2 + 1, y * 2 + 1, pixelRGB);
  19. outputimage.SetPixel(x * 2, y * 2, pixelRGB);
  20. outputimage.SetPixel(x * 2, y * 2 + 1, pixelRGB);
  21.  
  22. }
  23. }
  24.  
  25.  
  26. return outputimage;
Add Comment
Please, Sign In to add comment