C
Hier nun meine Lösung
#define BUFFER_COLOR_SIZE (1024*24)
char bmpbuffer[ BUFFER_COLOR_SIZE ];
CImage image;
image.Load("C:\\test.png");
int * colorBuffer; //a 24Bit color-buffer (the image)
int width = 128;
int height = 64;
BITMAPINFO bitmapinfo;
HBITMAP bitmap;
CBitmap bmp;
CDC *pDC = this->GetDC();
CDC *pngDC = CDC::FromHandle(image.GetDC());
CDC MemDC;
MemDC.CreateCompatibleDC(pDC);
//Set up windows bitmap stuff
bitmapinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmapinfo.bmiHeader.biWidth = width;
bitmapinfo.bmiHeader.biHeight = -height; /* top-down */
bitmapinfo.bmiHeader.biPlanes = 1;
bitmapinfo.bmiHeader.biBitCount = 24;
bitmapinfo.bmiHeader.biCompression = BI_RGB;
bitmapinfo.bmiHeader.biSizeImage = width * height * sizeof(int);
bitmapinfo.bmiHeader.biXPelsPerMeter = 0;
bitmapinfo.bmiHeader.biYPelsPerMeter = 0;
bitmapinfo.bmiHeader.biClrUsed = 0;
bitmapinfo.bmiHeader.biClrImportant = 0;
bitmap = CreateDIBSection(MemDC, &bitmapinfo, DIB_RGB_COLORS, reinterpret_cast <void**> (&colorBuffer), 0, 0);
SelectObject(MemDC, bitmap);
//weißer Hintergrund
CRect rect = new CRect(0,0,128,64);
CBrush brush;
brush.CreateSolidBrush(RGB(255,255,255));
MemDC.FillRect(rect,&brush);
MemDC.BitBlt(0,0,64,48,pngDC,0,0,SRCCOPY);
////////hier zeichnen!!!!!!!!!!!!
//Bitmap anzeigen
pDC->BitBlt(0,0,128,64,&MemDC,0,0,SRCCOPY);
bmp.Attach(bitmap);
bmp.GetBitmapBits(BUFFER_COLOR_SIZE,bmpbuffer);
image.ReleaseDC();
int x,y,bytePerLine;
bytePerLine=width*3;
for(y=0; y<height/2; y++)
{
for(x=0; x<bytePerLine; x++)
{
swap(bmpbuffer[y*bytePerLine+x],bmpbuffer[(height-1-y)*bytePerLine+x]);
}
}
danach folgt nur noch der Code zum übermitteln ans LCD....geht jetzt sauber!