// ?????????????豸?????x????y???????????????????(0 - 1)
VOID ImageDraw(HDC DC?? INT x?? INT y?? CONST BitmapData *data?? float alpha = 1.0f)
{
BITMAPINFO bi;
RECT r?? r2;
LPVOID scan0;
BitmapData dst?? src;
// ???DC???????
if (GetClipBox(DC?? &r) <= NULLREGION) return;
r.left = r.top = 0;
r2.left = x;
r2.top = y;
r2.right = data->Width + x;
r2.bottom = data->Height + y;
// ????data??DC???????r????????????????????????src
if (!IntersectRect(&r?? &r?? &r2)) return;
GetBitmapData(data?? x < 0? -x : 0?? y < 0? -y : 0??
r.right - r.left?? r.bottom - r.top?? &src);
// ??src??罨???μ?32λ???????dst
dst.Width = src.Width;
dst.Height = src.Height;
dst.Stride = dst.Width << 2;
dst.Scan0 = scan0 = (LPVOID)new CHAR[dst.Height * dst.Stride];
dst.Reserved = 0;
GetBitmapInfoHeader(&src?? &bi);
// ???alpha<1??????data??Alpha????????DC??????????dst
if (alpha < 1.0f || HasAlphaFlag(data))
GetDCImageData(DC?? r.left?? r.top?? &dst?? &bi);
// dst?????????????Windowsλ????
dst.Scan0 = (LPBYTE)scan0 + (dst.Height - 1) * dst.Stride;
dst.Stride = -dst.Stride;
// ?????
ImageMixer(&dst?? &src?? alpha);
// ???dst????????????????DC
dst.Scan0 = scan0;
BitBltImageData(DC?? r.left?? r.top?? &dst?? &bi);
delete[] scan0;
}
//---------------------------------------------------------------------------

???????????????????????Windows API???C++????? -- ????ɡ???????????????????
?????????á?C++????? -- ????ɡ??е???????????е?GDI+???????????????ImageDraw??????

 

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Gdiplus::Bitmap *dest =  new Gdiplus::Bitmap(L"..\..\media\xmas_011.png");
Gdiplus::Bitmap *source =  new Gdiplus::Bitmap(L"..\..\media\Apple.png");
//  Gdiplus::Graphics *g = new Gdiplus::Graphics(Canvas->Handle);
//  g->DrawImage(dest?? 0?? 0);
//  g->DrawImage(source?? dest->GetWidth()?? 0);
BitmapData dst?? src;
LockBitmap(dest?? &dst);
LockBitmap(source?? &src);
ImageDraw(Canvas->Handle?? 0?? 0?? &dst?? 1);            //
ImageDraw(Canvas->Handle?? dst.Width?? 0?? &src?? 1);    //
ImageMixer(&dst?? &src?? 0.75);
ImageDraw(Canvas->Handle?? dst.Width << 1?? 0?? &dst?? 1);//
UnlockBitmap(source?? &src);
UnlockBitmap(dest?? &dst);
//  g->DrawImage(dest?? dest->GetWidth() << 1?? 0);
//  delete g;
delete source;
delete dest;
}
//---------------------------------------------------------------------------

????????Ч????C++????? -- ????ɡ?????Ч????????????????£?