Exemple #1
0
void
Dib::GetSize (/*[in]*/ long *	pcx,
	      /*[in]*/ long *	pcy)
  const
{
  *pcx = static_cast<LONG>(GetBitmapInfo()->bmiHeader.biWidth);
  *pcy = static_cast<LONG>(GetBitmapInfo()->bmiHeader.biHeight);
}
Exemple #2
0
int PageMemory::SetDIBits(HDC clientDC,const void *lpBits)
{
	BITMAPINFO bmi=GetBitmapInfo();
	::SetDIBits(clientDC,_bitmap,0,Height,lpBits,&bmi,DIB_RGB_COLORS);

	return TRUE;
}
CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args)
{
    CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
    if (pPlatform->m_GdiplusExt.IsAvailable()) {
        return pPlatform->m_GdiplusExt.LoadDIBitmap(args);
    } else if (args.flags == WINDIB_OPEN_MEMORY) {
        return NULL;
    }
    HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)args.path_name, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    if (hBitmap == NULL) {
        return NULL;
    }
    HDC hDC = CreateCompatibleDC(NULL);
    int width, height;
    GetBitmapSize(hBitmap, width, height);
    CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
    if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) {
        delete pDIBitmap;
        DeleteDC(hDC);
        return NULL;
    }
    CFX_ByteString info = GetBitmapInfo(pDIBitmap);
    int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
    if (!ret) {
        delete pDIBitmap;
        pDIBitmap = NULL;
    }
    DeleteDC(hDC);
    return pDIBitmap;
}
Exemple #4
0
    BOOL DrawBitmapEx(HDC hDC, HBITMAP hBitmap, const RECT& dstRect, const RECT& srcRect, COLORREF clrTransColor)
    {
        BITMAP bmpInfo = {0};
        if (! GetBitmapInfo(hBitmap, bmpInfo))
            return FALSE;

        HDC hMemDC = ::CreateCompatibleDC(hDC);
        if (hMemDC == NULL)
            return FALSE;

        HBITMAP hOldBmp = (HBITMAP)::SelectObject(hMemDC, hBitmap);

        BOOL bSuc = FALSE;
        if (clrTransColor == NO_TRANSPARENT) {
            bSuc = ::StretchBlt(hDC, 
                dstRect.left, dstRect.top, (dstRect.right - dstRect.left), (dstRect.bottom - dstRect.top), 
                hMemDC, 
                srcRect.left, srcRect.top, (srcRect.right - srcRect.left), (srcRect.bottom - srcRect.top), 
                SRCCOPY);
        } else {
            bSuc = ::TransparentBlt(hDC, 
                dstRect.left, dstRect.top, (dstRect.right - dstRect.left), (dstRect.bottom - dstRect.top), 
                hMemDC, 
                srcRect.left, srcRect.top, (srcRect.right - srcRect.left), (srcRect.bottom - srcRect.top), 
                clrTransColor);
        }

        ::SelectObject(hMemDC, hOldBmp);
        ::DeleteDC(hMemDC);

        return bSuc;
    };
Exemple #5
0
void
Dib::Render (/*[in]*/ HDC	hdc,
	     /*[in]*/ int	x,
	     /*[in]*/ int	y,
	     /*[in]*/ int	cx,
	     /*[in]*/ int	cy)
{
  if (cx < 0)
  {
    cx = GetWidth();
  }
  if (cy < 0)
  {
    cy = GetHeight();
  }
  SetStretchBltMode (hdc, COLORONCOLOR);
  if (StretchDIBits(hdc,
    x,
    y,
    cx,
    cy,
    0,
    0,
    GetWidth(),
    GetHeight(),
    GetBits(),
    GetBitmapInfo(),
    DIB_RGB_COLORS,
    SRCCOPY)
      == GDI_ERROR)
  {
    FATAL_WINDOWS_ERROR ("StretchDIBits", 0);
  }
}
HBITMAP	CFX_WindowsDIB::GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC)
{
    CFX_ByteString info = GetBitmapInfo(pBitmap);
    HBITMAP hBitmap = NULL;
    hBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
        pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
    return hBitmap;
}
Exemple #7
0
    BOOL DrawBitmap(HDC hDC, HBITMAP hBitmap, const RECT& dstRect, COLORREF clrTransColor)
    {
        BITMAP bmpInfo = {0};
        if (! GetBitmapInfo(hBitmap, bmpInfo))
            return FALSE;

        RECT srcRect = {0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight};
        return DrawBitmapEx(hDC, hBitmap, dstRect, srcRect, clrTransColor);
    };
Exemple #8
0
    SIZE GetBitmapSize(HBITMAP hBitmap)
    {
        SIZE szSize = {0};
        BITMAP bmpInfo;
        if (! GetBitmapInfo(hBitmap, bmpInfo))
            return szSize;

        szSize.cx = bmpInfo.bmWidth;
        szSize.cy = bmpInfo.bmHeight;
        return szSize;
    };
Exemple #9
0
/*ARGSUSED*/
static void
XawSmeBSBInitialize(Widget request, Widget cnew,
		    ArgList args, Cardinal *num_args)
{
    SmeBSBObject entry = (SmeBSBObject)cnew;

    if (!entry->sme_bsb.font) XtError("Aborting: no font found\n");

    if (entry->sme_bsb.label == NULL) 
	entry->sme_bsb.label = XtName(cnew);
    else
	entry->sme_bsb.label = XtNewString(entry->sme_bsb.label);

    GetDefaultSize(cnew, &entry->rectangle.width, &entry->rectangle.height);
    CreateGCs(cnew);

    entry->sme_bsb.left_bitmap_width = entry->sme_bsb.left_bitmap_height = 0;
    entry->sme_bsb.right_bitmap_width = entry->sme_bsb.right_bitmap_height = 0;

    GetBitmapInfo(cnew, True);	/* Left Bitmap Info */
    GetBitmapInfo(cnew, False);	/* Right Bitmap Info */
}
Exemple #10
0
internal rectangle2
DEBUGTextOp(debug_state *DebugState, debug_text_op Op, v2 P, char *String, v4 Color = V4(1, 1, 1, 1)) {
    rectangle2 Result = InvertedInfinityRectangle2();
    if (DebugState && DebugState->DebugFont) {
        render_group *RenderGroup = DebugState->RenderGroup;
        loaded_font *Font = DebugState->DebugFont;
        hha_font *Info = DebugState->DebugFontInfo;

        u32 PrevCodePoint = 0;

        for (char *At = String; *At; ++At) {
            u32 CodePoint = *At;

            if (At[0] == '\\' && IsHex(At[1]) && IsHex(At[2]) && IsHex(At[3]) && IsHex(At[4])) {
                CodePoint = (GetHex(At[1]) << 12 |
                             GetHex(At[2]) <<  8 |
                             GetHex(At[3]) <<  4 |
                             GetHex(At[4]) <<  0);
                At += 4;
            }

            r32 AdvanceX = DebugState->FontScale * GetHorizontalAdvanceForPair(Info, Font, PrevCodePoint, CodePoint);
            P.x += AdvanceX;

            if (CodePoint != ' ') {
                bitmap_id BitmapID = GetBitmapForGlyph(RenderGroup->Assets, Info, Font, CodePoint);
                hha_bitmap *BitmapInfo = GetBitmapInfo(RenderGroup->Assets, BitmapID);

                r32 BitmapScale = DebugState->FontScale * (r32)BitmapInfo->Dim[1];
                v3 BitmapOffset = V3(P.x, P.y, 0);
                if (Op == DEBUGTextOp_DrawText) {
                    PushBitmap(RenderGroup, BitmapID, BitmapScale, BitmapOffset, Color);
                } else {
                    Assert(Op == DEBUGTextOp_SizeText);

                    loaded_bitmap *Bitmap = GetBitmap(RenderGroup->Assets, BitmapID, RenderGroup->GenerationID);
                    if (Bitmap) {
                        used_bitmap_dim Dim = GetBitmapDim(RenderGroup, Bitmap, BitmapScale, BitmapOffset, 1.0f);
                        rectangle2 GlyphDim = RectMinDim(Dim.P.xy, Dim.Size);
                        Result = Union(Result, GlyphDim);
                    }
                }
            }

            PrevCodePoint = CodePoint;
        }
    }

    return Result;
}
Exemple #11
0
void CaptureUseDC()
{
    TCHAR filename[MAX_PATH] = { 0 };
    HDC compatibleHDC = NULL;
    HBITMAP compatibleHbitmap = NULL;

    compatibleHDC = NULL;
    compatibleHbitmap = NULL;
    GetCurDisplay(compatibleHDC, compatibleHbitmap);
    BITMAPINFO rBmpinfo = { 0 };
    GetBitmapInfo(rBmpinfo, compatibleHbitmap);

    ZeroMemory(filename, sizeof(filename));
    _stprintf_s(filename, MAX_PATH, L"%d.bmp", GetTickCount());
    CreateBMPFile(filename, &rBmpinfo, compatibleHbitmap, compatibleHDC);
    DeleteDC(compatibleHDC);
    DeleteObject(compatibleHbitmap);
}
Exemple #12
0
int PageMemory::Create(HDC clientDC, int width, int height, double renderDPI, double *defcmt, double *deficmt)
{
	//Delete object
	Dispose();
	Width=width;
	Height=height;
	for(int i=0; i<6; ++i){
		defCTM[i] = defcmt[i];
		defICTM[i] =deficmt[i];
	}
	_renderDPI = renderDPI;
	BITMAPINFO bmi=GetBitmapInfo();
	bmi.bmiHeader.biHeight=-bmi.bmiHeader.biHeight;
	if((_bitmap = CreateDIBSection(clientDC, &bmi, DIB_RGB_COLORS, &_bits,NULL,0))==NULL){
//		ASSERT(1==0);
		return FALSE;
	}
	
	return TRUE;
}
Exemple #13
0
    HICON CreateIconFromBitmap(HBITMAP hBitmap)
    {
        BITMAP bmpInfo = {0};
        if (! GetBitmapInfo(hBitmap, bmpInfo))
            return NULL;

        HICON hIcon = NULL;

        HBITMAP hMonoBitmap = ::CreateBitmap(bmpInfo.bmWidth, bmpInfo.bmHeight, 1, 1, NULL);
        ICONINFO ii = {0};
        ii.fIcon = FALSE;
        ii.xHotspot = 0;
        ii.yHotspot = 0;
        ii.hbmMask = hMonoBitmap;
        ii.hbmColor = hBitmap;
        hIcon = ::CreateIconIndirect(&ii);
        ::DeleteObject(hMonoBitmap);

        return hIcon;
    };
Exemple #14
0
char* GetCaptureScreenDCRGBbits(int& rWidth,int& rHeight, int& rPixelBitSize)
{
    HDC compatibleHDC = NULL;
    HBITMAP compatibleHbitmap = NULL;

    compatibleHDC = NULL;
    compatibleHbitmap = NULL;
    GetCurDisplay(compatibleHDC, compatibleHbitmap);
    ASSERT_NOTNULL(compatibleHDC);
    ASSERT_NOTNULL(compatibleHbitmap);
    BITMAPINFO rBmpinfo = { 0 };
    GetBitmapInfo(rBmpinfo, compatibleHbitmap);
    rWidth = rBmpinfo.bmiHeader.biWidth;
    rHeight = rBmpinfo.bmiHeader.biHeight;
    rPixelBitSize = rBmpinfo.bmiHeader.biBitCount;
    char* lpRGBBits = GetBMPBinaryData(&rBmpinfo, compatibleHbitmap, compatibleHDC);
    ASSERT_NOTNULL(lpRGBBits);
    DeleteDC(compatibleHDC);
    DeleteObject(compatibleHbitmap);
    return lpRGBBits;
}
Exemple #15
0
// 需要使用free来释放获得的BMP的内存
char* GetBMPBinaryDataEx(LPSTR pszFileName)
{
    HBITMAP hBitmap = (HBITMAP)::LoadImageA(NULL, pszFileName,
                                            IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
    if (NULL == hBitmap)
    {
        DWORD dwError = ::GetLastError();
        return NULL;
    }
    BITMAPINFO rBmpinfo = { 0 };
    GetBitmapInfo(rBmpinfo, hBitmap);
    DeleteObject(hBitmap);
    FILE* pFile = NULL;
    errno_t errcode = fopen_s(&pFile, pszFileName, "rb");
    if (errcode != 0 && pFile == NULL) {
        return NULL;
    }

    // 计算像素数据长度
    int pixelLength = rBmpinfo.bmiHeader.biWidth * 3;
    pixelLength *= rBmpinfo.bmiHeader.biHeight;

    // 读取像素数据
    char* pixelData = NULL;
    pixelData = (char*)malloc(pixelLength);
    assert(pixelData);
    if (!pixelData) {
        fclose(pFile);
        return NULL;
    }
    int contentSize = sizeof(BITMAPINFOHEADER);
    contentSize += sizeof(BITMAPFILEHEADER);

    fseek(pFile, contentSize, SEEK_SET);
    fread(pixelData, pixelLength, 1, pFile);
    fclose(pFile);
    return pixelData;
}
Exemple #16
0
///////////////////////////////////////////////
// pBuf size need to be width*height*4
// wupeng
BOOL GetCaptureScreenDCRGBAbitsEx(int& rWidth, int& rHeight, int& rPixelBitSize, char* pBuf)
{
    ASSERT_NOTNULLRET(pBuf, FALSE);
    HDC compatibleHDC = NULL;
    HBITMAP compatibleHbitmap = NULL;

    compatibleHDC = NULL;
    compatibleHbitmap = NULL;
    GetCurDisplay(compatibleHDC, compatibleHbitmap);
    ASSERT_NOTNULLRET(compatibleHDC, FALSE);
    ASSERT_NOTNULLRET(compatibleHbitmap, FALSE);
    BITMAPINFO rBmpinfo = { 0 };
    GetBitmapInfo(rBmpinfo, compatibleHbitmap);
    rWidth = rBmpinfo.bmiHeader.biWidth;
    rHeight = rBmpinfo.bmiHeader.biHeight;
    rPixelBitSize = rBmpinfo.bmiHeader.biBitCount;
    BOOL bRes = FALSE;
    bRes = GetBMPBinaryDataEx(&rBmpinfo, compatibleHbitmap, compatibleHDC, pBuf);
    ASSERT_NOTFALSERET(bRes, FALSE);
    DeleteDC(compatibleHDC);
    DeleteObject(compatibleHbitmap);
    return true;
}
Exemple #17
0
CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(FX_LPCWSTR filename)
{
    CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
    if (pPlatform->m_GdiplusExt.IsAvailable()) {
        WINDIB_Open_Args_ args;
        args.flags = WINDIB_OPEN_PATHNAME;
        args.path_name = filename;
        return pPlatform->m_GdiplusExt.LoadDIBitmap(args);
    }
    HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    if (hBitmap == NULL) {
        return NULL;
    }
    HDC hDC = CreateCompatibleDC(NULL);
    int width, height;
    GetBitmapSize(hBitmap, width, height);
    CFX_DIBitmap* pDIBitmap = FX_NEW CFX_DIBitmap;
    if (!pDIBitmap) {
        DeleteDC(hDC);
        return NULL;
    }
    if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) {
        delete pDIBitmap;
        DeleteDC(hDC);
        return NULL;
    }
    CFX_ByteString info = GetBitmapInfo(pDIBitmap);
    int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS);
    if (!ret) {
        if (pDIBitmap) {
            delete pDIBitmap;
        }
        pDIBitmap = NULL;
    }
    DeleteDC(hDC);
    return pDIBitmap;
}
Exemple #18
0
//============================================================================
//		NCGImage::GetObject : Get the object.
//----------------------------------------------------------------------------
NCFObject NCGImage::GetObject(bool cloneData) const
{	NCFObject			cgDataProvider, theObject;
	CGBitmapInfo		bitmapInfo;
	NCFData				theData;



	// Get the state we need
	bitmapInfo = GetBitmapInfo(GetFormat());
	theData    = GetData();



	// Prepare the data
	if (cloneData)
		cgDataProvider.SetObject(CGDataProviderCreateWithCFData(theData.GetObject()));
	else
		cgDataProvider.SetObject(CGDataProviderCreateWithData(NULL, theData.GetData(), theData.GetSize(), NULL));

	if (!cgDataProvider.IsValid())
		return(theObject);



	// Get the object
	theObject.SetObject(CGImageCreate(	GetWidth(),
										GetHeight(),
										GetBitsPerComponent(),
										GetBitsPerPixel(),
										GetBytesPerRow(),
										NCGColor::GetDeviceRGB(),
										bitmapInfo, cgDataProvider,
										NULL, false, kCGRenderingIntentDefault));

	return(theObject);
}
Exemple #19
0
int PageMemory::Draw(HDC hdc, int xSrc, int ySrc, int width, int height, int xDest, int yDest)
{
	BITMAPINFO bmi=GetBitmapInfo();
	//********START DIB
	//HDC dc;
	HDC mdc;
	//CDC tmpDC;
	//HBitmap bmpTmp;
	//dc.Attach(hdc);
	//mdc.CreateCompatibleDC(&dc);
	mdc = CreateCompatibleDC(hdc);
	HGDIOBJ pOld = SelectObject(mdc,_bitmap);
	if(_factorW!=1 || _factorH !=1)
	{
		BITMAPINFO bih = GetBitmapInfo();
		bih.bmiHeader.biHeight = -bih.bmiHeader.biHeight ; //Top-Down
		SetStretchBltMode(hdc,COLORONCOLOR );
		/*
		StretchDIBits(hdc,
			xDest*_factorW,
			yDest*_factorH,		//Location 
			width*_factorW,		//Width dest
			height*_factorH,	//Height dest
			xSrc,
			-ySrc,			//Source position
			width,
			height,		//Source Size
			_bits,				//DIB Bits
			&bih,				//Bitmap Info Header
			DIB_RGB_COLORS,		//RGB Data
			SRCCOPY );			//Copy the source
		*/
		int w=width;
		int h=height;
		//ZoomOut
		if(width*_factorW<w || height*_factorH<h)
		{
			w*=_factorW;
			h*=_factorH;
		}
		
		StretchBlt(hdc,
			xDest,
			yDest,
			w*_factorW,
			h*_factorH ,
			mdc,
			xSrc/_factorW,
			ySrc/_factorH,
			w,
			h,
			SRCCOPY);

	}else{
		

		BitBlt(hdc,xDest,yDest,width,height,mdc,xSrc,ySrc,SRCCOPY);		

		
	}
	SelectObject(mdc,pOld);
		DeleteDC(mdc);
		//dc.Detach();



	//********END DIB
	return TRUE;
}
Exemple #20
0
    BOOL DrawRoundBitmap(HDC hDC, HBITMAP hBitmap, const RECT& dstRect, LONG nSideWidth, LONG nSideHeight, COLORREF clrTransColor)
    {
        BITMAP bmpInfo = {0};
        if (! GetBitmapInfo(hBitmap, bmpInfo))
            return FALSE;

        LONG bmpWidth = bmpInfo.bmWidth;
        LONG bmpHeight = bmpInfo.bmHeight;

        LONG dstWidth = dstRect.right - dstRect.left;
        LONG dstHeight = dstRect.bottom - dstRect.top;

        LONG minSideWidth = nSideWidth * 2;
        LONG minSideHeight = nSideHeight * 2;

        if (nSideWidth <= 0 || nSideHeight <= 0)
            return DrawBitmap(hDC, hBitmap, dstRect, clrTransColor);

        if (minSideWidth > bmpWidth || minSideHeight > bmpHeight)
            return DrawBitmap(hDC, hBitmap, dstRect, clrTransColor);

        if (minSideWidth > dstWidth || minSideHeight > dstHeight)
            return DrawBitmap(hDC, hBitmap, dstRect, clrTransColor);

        RECT rcDst = {0};
        RECT rcSrc = {0};
        BOOL bSuc = FALSE;

        //分成9块绘制
        //上左
        rcSrc.left = 0; rcSrc.right = nSideWidth;
        rcSrc.top = 0; rcSrc.bottom = nSideHeight;
        rcDst.left = 0; rcDst.right = nSideWidth;
        rcDst.top = 0; rcDst.bottom = nSideHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);
        //上中
        rcSrc.left = nSideWidth; rcSrc.right = bmpWidth - nSideWidth;
        rcSrc.top = 0; rcSrc.bottom = nSideHeight;
        rcDst.left = nSideWidth; rcDst.right = dstWidth - nSideWidth;
        rcDst.top = 0; rcDst.bottom = nSideHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);
        //上右
        rcSrc.left = bmpWidth - nSideWidth; rcSrc.right = bmpWidth;
        rcSrc.top = 0; rcSrc.bottom = nSideHeight;
        rcDst.left = dstWidth - nSideWidth; rcDst.right = dstWidth;
        rcDst.top = 0; rcDst.bottom = nSideHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);

        //中左
        rcSrc.left = 0; rcSrc.right = nSideWidth;
        rcSrc.top = nSideHeight; rcSrc.bottom = bmpHeight - nSideHeight;
        rcDst.left = 0; rcDst.right = nSideWidth;
        rcDst.top = nSideHeight; rcDst.bottom = dstHeight - nSideHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);
        //中中
        rcSrc.left = nSideWidth; rcSrc.right = bmpWidth - nSideWidth;
        rcSrc.top = nSideHeight; rcSrc.bottom = bmpHeight - nSideHeight;
        rcDst.left = nSideWidth; rcDst.right = dstWidth - nSideWidth;
        rcDst.top = nSideHeight; rcDst.bottom = dstHeight - nSideHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);
        //中右
        rcSrc.left = bmpWidth - nSideWidth; rcSrc.right = bmpWidth;
        rcSrc.top = nSideHeight; rcSrc.bottom = bmpHeight - nSideHeight;
        rcDst.left = dstWidth - nSideWidth; rcDst.right = dstWidth;
        rcDst.top = nSideHeight; rcDst.bottom = dstHeight - nSideHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);

        //下左
        rcSrc.left = 0; rcSrc.right = nSideWidth;
        rcSrc.top = bmpHeight - nSideHeight; rcSrc.bottom = bmpHeight;
        rcDst.left = 0; rcDst.right = nSideWidth;
        rcDst.top = dstHeight - nSideHeight; rcDst.bottom = dstHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);
        //下中
        rcSrc.left = nSideWidth; rcSrc.right = bmpWidth - nSideWidth;
        rcSrc.top = bmpHeight - nSideHeight; rcSrc.bottom = bmpHeight;
        rcDst.left = nSideWidth; rcDst.right = dstWidth - nSideWidth;
        rcDst.top = dstHeight - nSideHeight; rcDst.bottom = dstHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);
        //下右
        rcSrc.left = bmpWidth - nSideWidth; rcSrc.right = bmpWidth;
        rcSrc.top = bmpHeight - nSideHeight; rcSrc.bottom = bmpHeight;
        rcDst.left = dstWidth - nSideWidth; rcDst.right = dstWidth;
        rcDst.top = dstHeight - nSideHeight; rcDst.bottom = dstHeight;
        ::OffsetRect(&rcDst, dstRect.left, dstRect.top);
        bSuc = DrawBitmapEx(hDC, hBitmap, rcDst, rcSrc, clrTransColor);

        return TRUE;
    };