C++????????????
???????????? ???????[ 2015/1/7 11:15:40 ] ????????C++ net
// ?????????????豸?????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++????? -- ????ɡ?????Ч????????????????£?
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????