BMP-Bild c++ um 90 Grad drehenC++

Programme in C++. Entwicklerforum
Guest
 BMP-Bild c++ um 90 Grad drehen

Post by Guest »

Ich möchte die Bilder um Winkel drehen, die ein Vielfaches von 90 Grad sind. Ich verwende hierfür einen einfachen Pixeltausch.
Wenn ich solchen Code schreibe:

Code: Select all

for (int y = 0; y < image.Height(); y++) {
for (int x = 0; x < image.Width(); x++) {
image[x + y * image.Width()] = origin[ x * origin.Width() + origin.Width() -  y + 1];
}
}
Das Bild ist mit einem seltsamen Artefakt gespiegelt:
[img]https://i. sstatic.net/Mb5NK.png[/img]

Das Originalbild sieht so aus:

Was mache ich falsch?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post