I recently found this (Win32 API Speed Issues)
to improve drawing speed, but it seems the code :
pBits[(y * WIDTH) + x] = RGB(0, 0, 0xFF);
always make the image flipped (from bottom-left to top-right),
Do you guys know how to fix this problem ??
.
Here's the flipped image:
flipped-bitmap.png
Here's my code :
for (i=0; i<200; i++) {
for (j=0; j<200; j++) {
int x, y;
cr1 = GetPixel(hdc_tmp, i*2, j*2);
cr2 = GetPixel(hdc_tmp, i*2, 1+j*2);
cr3 = GetPixel(hdc_tmp, 1+i*2, j*2);
cr4 = GetPixel(hdc_tmp, 1+i*2, 1+j*2);
red = (GetRValue(cr1) + GetRValue(cr2) + GetRValue(cr3) + GetRValue(cr4)) / 4;
green = (GetGValue(cr1) + GetGValue(cr2) + GetGValue(cr3) + GetGValue(cr4)) / 4;
blue = (GetBValue(cr1) + GetBValue(cr2) + GetBValue(cr3) + GetBValue(cr4)) / 4;
pbits[i+j*200] = RGB(red, green, blue); // BUG ??
}
}
BitBlt(hdc, 0, 0, 200, 200, hdc_aa, 0, 0, SRCCOPY);