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

📄 pixelbuffer.h

📁 vncviewer_source_1.0
💻 H
字号:
/* Copyright (C) 2006 Lucas Gomez  All Rights Reserved.
 * 
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 * USA.
 */

#ifndef __PIXELBUFFER_H__
#define __PIXELBUFFER_H__

// INCLUDES
#include <e32def.h>
#include <e32const.h>
#include <w32std.h>

#include "PixelFormat.h"

// ENUMERATIONS

// CONSTANTES

// CLASS DECLARATION

/**
* CPixelBuffer application class.
*/
class CPixelBuffer : public CBase
{
public: // Constructors and destructor 
    /**
    * ~CPixelBuffer
    * Virtual Destructor.
    */
    virtual ~CPixelBuffer();

protected: // Constructors

    /**
    * CPixelBuffer.
    * C++ default constructor.
    */
    CPixelBuffer();
    
    /**
    * ConstructL
    * 2nd phase constructor.
    */
    void ConstructL();
    
public:	// class methods
    void SetPF(CPixelFormat* aPF);
    
    CPixelFormat* GetPF();
    
    TInt GetWidth();
    
    TInt GetHeight();
    
    TInt GetArea();
    
    TInt GetStride();
    
    void FillRect(TInt aX,TInt aY,TInt aW,TInt aH,TInt aPix);
    
    void ImageRect(TInt aX,TInt aY,TInt aW,TInt aH,TDes8& aPix,TInt aOffset);
    
    void CopyRect(TInt aX,TInt aY,TInt aW,TInt aH,TInt aSrcX,TInt aSrcY);
    
    void MaskRect(TInt aX, TInt aY,TInt aW,TInt aH,TDes8& aPix,TDes8& aMask);
    
    inline TDes8& GetData() {return iData;}
    
protected:	// member variables
	RBuf8 iData;
	
	CPixelFormat* iFormat;
	TInt iWidth, iHeight;
};

class CManagedPixelBuffer : public CPixelBuffer
{
public: // Constructors and destructor
   /**
    * NewL.
    * Two-phased constructor.
    * Construct a CConn for the AVKON application aApp
    * using two phase construction, and return a pointer
    * to the created object.
    * @return A pointer to the created instance of CConn.
    */
    static CManagedPixelBuffer* NewL();

    /**
    * NewLC.
    * Two-phased constructor.
    * Construct a CConn for the AVKON application aApp
    * using two phase construction, and return a pointer
    * to the created object.
    * @return A pointer to the created instance of CConn.
    */
    static CManagedPixelBuffer* NewLC();
   
    /**
    * ~CPixelBuffer
    * Virtual Destructor.
    */
    virtual ~CManagedPixelBuffer();

protected: // Constructors

    /**
    * CPixelBuffer.
    * C++ default constructor.
    */
    CManagedPixelBuffer();
    
    /**
    * ConstructL
    * 2nd phase constructor.
    */
    void ConstructL();
    
public:	// class methods
	void SetSize(TInt aW,TInt aH);
	
	void SetPF(CPixelFormat* aPF);
	
	TInt DataLen();
	
	void CheckDataSize();
    
protected:	// member variables

};

class CPixelBufferImage : public CPixelBuffer
{
public: // Constructors and destructor
   /**
    * NewL.
    * Two-phased constructor.
    * Construct a CConn for the AVKON application aApp
    * using two phase construction, and return a pointer
    * to the created object.
    * @return A pointer to the created instance of CConn.
    */
    static CPixelBufferImage* NewL(TInt aW,TInt aH);

    /**
    * NewLC.
    * Two-phased constructor.
    * Construct a CConn for the AVKON application aApp
    * using two phase construction, and return a pointer
    * to the created object.
    * @return A pointer to the created instance of CConn.
    */
    static CPixelBufferImage* NewLC(TInt aW,TInt aH);
   
    /**
    * ~CPixelBuffer
    * Virtual Destructor.
    */
    virtual ~CPixelBufferImage();

private: // Constructors

    /**
    * CPixelBuffer.
    * C++ default constructor.
    */
    CPixelBufferImage();
    
    /**
    * ConstructL
    * 2nd phase constructor.
    */
    void ConstructL(TInt aW,TInt aH);
    
public:	// class methods
	void Resize(TInt aW,TInt aH);
	
	void Put(TInt aX,TInt aY,TInt aW,TInt aH,CWindowGc* aGraphics);
	
	void CopyRect(TInt aX,TInt aY,TInt aW,TInt aH,TInt aSrcX,TInt aSrcY);
	
	void SetColourMapEntries(TInt aFirstColour,TInt aNColours,RArray<TInt>& aRgbs);
	
	void UpdateColourMap();
	
	inline CFbsBitmap* GetImage() {return iImage;}
    
private:	// member variables
	CFbsBitmap* iImage;
	CPalette* iCM;
	
	RArray<TRgb> iRgb;
};

class CCursor : public CManagedPixelBuffer
{
public: // Constructors and destructor
   /**
    * NewL.
    * Two-phased constructor.
    * Construct a CConn for the AVKON application aApp
    * using two phase construction, and return a pointer
    * to the created object.
    * @return A pointer to the created instance of CConn.
    */
    static CCursor* NewL();

    /**
    * NewLC.
    * Two-phased constructor.
    * Construct a CConn for the AVKON application aApp
    * using two phase construction, and return a pointer
    * to the created object.
    * @return A pointer to the created instance of CConn.
    */
    static CCursor* NewLC();
   
    /**
    * ~CPixelBuffer
    * Virtual Destructor.
    */
    virtual ~CCursor();

private: // Constructors

    /**
    * CPixelBuffer.
    * C++ default constructor.
    */
    CCursor();
    
    /**
    * ConstructL
    * 2nd phase constructor.
    */
    void ConstructL();
    
public:	// class methods
	void SetSize(TInt aW,TInt aH);
	
	TInt MaskLen();
	
	inline void SetHotspotX(TInt aHotspotX) {iHotspotX=aHotspotX;}
	
	inline void SetHotspotY(TInt aHotspotY) {iHotspotY=aHotspotY;}
	
	inline TInt GetHotspotX() {return iHotspotX;}
	
	inline TInt GetHotspotY() {return iHotspotY;}
	
	inline TDes8& GetMask() {return iMask;}
    
private:	// member variables
	TInt iHotspotX, iHotspotY;

	RBuf8 iMask;
};

#endif // __PIXELBUFFER_H__


⌨️ 快捷键说明

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