⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitmapsk.h

📁 一个在WINCE5.0下开发的MP4播放器,可以播放多种视频文件,画面优质.
💻 H
字号:
// BitmapSK.h: interface for the CBitmapSK class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BITMAPSK_H__9983FE4B_94A3_490E_87B7_7D0C7B762647__INCLUDED_)
#define AFX_BITMAPSK_H__9983FE4B_94A3_490E_87B7_7D0C7B762647__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//////////////////////////////////////////////////////////////////////////
BOOL TransparentBitBlt(HDC hdcDes, 
                       int xDes, 
                       int yDes, 
                       int width, 
                       int height, 
                       HBITMAP hbmSrc, 
                       int xSrc, 
                       int ySrc,
                       COLORREF crTrans, 
                       HPALETTE hPal
                       );
//////////////////////////////////////////////////////////////////////////
class CWinRect: public CRect
{
public:
    CWinRect(HWND hWnd)
    {
        ::GetWindowRect(hWnd, this);
    }
    CWinRect(const CWnd *pWnd)
    {
        ::GetWindowRect(pWnd->GetSafeHwnd(), this);
    } 
    
}; 

class CWinText: public CString
{
public:
    CWinText(HWND hWnd)
    {
        (CWnd::FromHandle(hWnd))->GetWindowText(*this); 
    }
    CWinText(const CWnd *pWnd)
    {
        pWnd->GetWindowText(*this);
    }
}; 


class CClientRect: public CRect
{
public:
    CClientRect(HWND hWnd)
    {
        ::GetClientRect(hWnd, this);
    }
    CClientRect(CWnd *pWnd)
    {
        ::GetClientRect(pWnd->GetSafeHwnd(), this);
    }
}; 

//////////////////////////////////////////////////////////////////////////
class CBitmapSK : public CBitmap  
{
public:
    CBitmapSK();
    virtual ~CBitmapSK(); 

    //load bitmap by resource file path
    BOOL LoadBitmapEx(LPCTSTR lpszFileName); 

    //load bitmap by resource name or ID
    BOOL LoadBitmapEx(LPCTSTR lpszResourceName, UINT nIDResource); 

    //attaches a hBitmap to a CBitmap object.
    BOOL Attach(HBITMAP hbmp)
    {
        return CBitmap::Attach(hbmp);
    }

    void Size(int &width, int &height)
    {
        BITMAP bm;
        memset(&bm, 0, sizeof(bm));
        CBitmap::GetBitmap(&bm);
        width = bm.bmWidth;
        height = bm.bmHeight;
    } 

    //bitmap width
    int Width(void)
    {
        BITMAP bm;
        memset(&bm, 0, sizeof(bm));
        CBitmap::GetBitmap(&bm);
        return bm.bmWidth;
    } 

    //bitmap height
    int Height()
    {
        BITMAP bm;
        memset(&bm, 0, sizeof(bm));
        CBitmap::GetBitmap(&bm);
        return bm.bmHeight;
    } 

    /////// src(bmp) ---> Des(pDC) 

    //draw current bitmap to device(pDC rect(lpr))  
    BOOL Draw(CDC *pDC, LPRECT lprDes);
    //draw current bitmap to device(pDC rect(lpr)) , transparent  
    BOOL Draw(CDC *pDC, LPRECT lprDes, COLORREF crTrans, BOOL isTrans); 
    
    //draw sub bitmap(the rect lprSrc of current bitmap) to special point( the begin point (x,y) of pDC device)
    BOOL Draw(CDC *pDC, int x, int y, LPRECT lprSrc);
    //draw sub bitmap to special point
    BOOL Draw(CDC *pDC, int x, int y, LPRECT lprSrc, COLORREF crTrans, BOOL isTrans); 
    
    BOOL Fill(CDC *pDC, LPRECT lprDes);
    BOOL Fill(CDC *pDC, LPRECT lprDes, COLORREF crTrans, BOOL isTrans); 
    
    BOOL Fill(CDC *pDC, LPRECT lprDes, LPRECT lprSrc); 
    BOOL Fill(CDC *pDC, LPRECT lprDes, LPRECT lprSrc, COLORREF crTrans, BOOL isTrans); 
    
    //Drawing Transparent Bitmaps,Copies a bitmap transparently onto the destination DC
    BOOL TransparentDraw(CDC * pDC, int x, int y, COLORREF crColour);
    
    
    //Copies a bitmap from a source rectangle into a destination rectangle, 
    //stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
    BOOL StretchDraw(CDC *pDC, LPRECT lprDes, LPRECT lprSrc);
    //Copies a bitmap from a source rectangle into a destination rectangle, 
    //stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle. 
    BOOL StretchDraw(CDC *pDC, LPRECT lprSrc); 
    
    //make a region from bitmap, It will show as a window     ::: faulse function :::
    //HRGN CreateRegion(COLORREF crColour, BOOL isTrans = TRUE);   
};


#endif // !defined(AFX_BITMAPSK_H__9983FE4B_94A3_490E_87B7_7D0C7B762647__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -