?? eb_pfwgraphics.h
字號:
/***************************************************************************
EB_PFWGraphics.h -
-------------------
begin : Tue Nov 08 2005
copyright : (C) 2005 by DigitalAirways
email : info@digitalairways.com
***************************************************************************/
/*
* Copyright (c) 2000-2004 DigitalAirways, sarl. All Rights Reserved.
*
* This software is the confidential and proprietary information of
* DigitalAirways, sarl. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with DigitalAirways.
* A copy of this license is included in the licence.txt file included
* on this software package.
*
* $Id: EB_PFWGraphics.h,v 1.11 2007-04-16 08:39:26 franck.lefevre Exp $
*
*/
/*
**************************************************************
* TODO
**************************************************************
- todo : add comments to some undocumented methods
- todo : check warning virtual void drawRectangle(int x,int y,int width,int height,int mode ,int i=0)
**************************************************************
* HISTORY
**************************************************************
- This is the GENTARGET's EB_PFWGraphics.
*/
#ifndef __EB_PFWGRAPHICS__
#define __EB_PFWGRAPHICS__
#include "EB_Graphics.h"
#define PIXFORMAT_DYNAMIC_FORMAT PIXFORMAT_RGB565
class PFWImage ;
class Font ;
class GContext ;
#define IMAGE_TYPE_SCREEN 1
#define IMAGE_TYPE_RAW 2
#define IMAGE_TYPE_DAG 3
struct base_image_struct
{
char sImageType;
int sWidth; //the size of the current bitmap
int sHeight;
DEFINE_NEW(base_image_struct);
DEFINE_DELETE(base_image_struct) ;
};
class KREBDLIBS_API PFWGraphics : public Graphics
{
private:
public:
base_image_struct* fImageStruct;
protected:
// This method is used to implement drawExtract and drawMask
void drawFrom(int xT, int yT, Graphics* from, int xF, int yF, int w, int h, boolean useMask, unsigned char tR, unsigned char tG, unsigned char tB) ;
public:
DEFINE_NEW(PFWGraphics);
DEFINE_DELETE(PFWGraphics);
/*
* Creates a new instance, without managing any content for the moment.
*/
PFWGraphics(GContext* newGContext);
/*
* Creates a new instance, using a content that is already existing.
* Note that the content is not duplicated, a new reference is just
* added on it.
*/
PFWGraphics(GContext* newGContext, int handle);
/*
* Creates a new instance and sets as its content an Image whose
* src is provided.
*/
PFWGraphics(GContext* newGContext, unsigned char* src);
/*
* Creates a new instance and initialize it with an empty surface.
* onScreen==TRUE when this graphics is using the screen as its surface.
*/
PFWGraphics(GContext* newGContext, int width, int height, int newOnScreen=0);
/*
* This dtor is freeing all its resources. This may be dangerous if it
* as been created from existing ones.
*/
virtual ~PFWGraphics();
/* Create the graphics context, and set all fields to Graphics'default values
*
*/
virtual void init(GContext* newGContext, int newOnScreen);
/*
* Returns a handle on the current Graphics. The semantics of this
* handle depends on the graphic toolkit actually used, but it is
* usually a pointer on the graphic surface's structure.
*/
virtual int getHandle();
/*
* Return a pointer on the surface's buffer itself. Note that it may be dangerous to use the returned value
* without knowing its internal structure.
*/
virtual void* getSurfaceBuffer() ;
/*
* This methd allows to create a new surface with the new specified size.
* If a previous surface was existing, it is destroyed.
*/
void createSurface(int newWidth, int newHeight);
/*
* Returns a pointer on the current buffer.
*/
short* getBuffer();
/* Clear the drawing surface
*
*/
virtual void clear();
/* load an image an put it on the current surface of the Graphics
*
*/
virtual void getImage(unsigned char *data, int dataLen);
virtual void getImage(unsigned char *szNewImageURL) ;
/*
* Draws a source Graphics on the current one
*/
virtual void drawBitmap(int x, int y, Graphics* gSource) ;
/*
* This method must be called when the pending modifications on the
* surface must be committed.
*/
virtual void update() ;
/*
* Returns the width of the current surface
*/
virtual int getWidth();
/*
* Returns the height of the current surface
*/
virtual int getHeight();
/*
* A returns a duplicated version of the current graphics.
* The surface is supposed to be fully duplicated.
* There is no assigned font.
*/
virtual Graphics* duplicate() ;
/*
* Return the RGB value of the dot situated at x/y.
* BEWARE: accessing to individual dots may be very inefficient, check
* that's really the best way to achieve your work prior to go this way.
* This function may also be inlined...
*/
virtual void getRGB(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b) ;
virtual void getRGBA(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a) ;
/*
* Sets the RGB value of the dot situated at x/y.
* BEWARE: accessing to individual dots may be very inefficient, check
* that's really the best way to achieve your work prior to go this way.
* This function may also be inlined...
*/
virtual void putRGB(int x, int y, unsigned char r, unsigned char g, unsigned char b);
virtual void putRGBA(int x, int y, unsigned char r, unsigned char g, unsigned char b, unsigned char /*a*/);
void putRGBA(int pixelIndex, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
/*
* Draws an extract of a source Graphics on the current one.
* The upper-left corner's coordinates of the extract to draw is(xF, yF).
* Its size is (w, h) and the target's upper-left corner's coordinates is (xT, yT).
*/
virtual void drawExtract(int xT, int yT, Graphics* gSource, int xF, int yF, int w, int h) ;
/*
* Set the region of the current surface that may be affected by the
* drawings to come.
*/
virtual void setDrawRegion(int left,int top,int width,int height) ;
/*
* Set a region on the current surface that MUST be affected by the
* drawings to come.
*/
virtual void setReservedRegion(int left,int top,int width,int height);
/*
* Draws dots on the current Graphics, using the color (tR, tG, tB)
* The concerned dots are defined by a mask that is the non transparent dots of gSource
* The mask size is (w, h) and the target's upper-left corner's coordinates is (xT, yT).
*/
virtual void drawMask(int xT, int yT, Graphics* gSource, int xF, int yF, int w, int h, unsigned char tR, unsigned char tG, unsigned char tB);
/*
* Sets a global alpha value (0=transparent, 254=opaque) to the
* current surface.
*/
virtual void setAlpha(unsigned char newAlpha);
/*
*
*/
virtual void setTransparent( unsigned char tR,unsigned char tG,unsigned char tB);
/*
*
*/
virtual void getTransparent(unsigned char* tR,unsigned char* tG,unsigned char* tB) ;
/*
* Sets newFont as the current font.
* newFont is the name of the requested font. This method is supposed
* to manage a cache in order to minimize the impact of frequent
* font changes.
*/
virtual void setFont(unsigned char* newFont) ;
virtual void setFont(int style, int height, unsigned char* newFont) ;
/*
* Returns the width of a string when it's displayed using the current
* font.
*/
virtual int getWidth(unsigned char* s);
/*
* Returns the height of a string when it's displayed using the current
* font.
*/
virtual int getHeight(unsigned char* s) ;
/*
* Render the string s on the current surface, using the current mode.
* x/y is the upper-left corner of the box where the string must be
* rendered into.
* In some implementation, the mode may be included in the bitmap
* font itself.
*/
virtual void drawString(unsigned char* s,int x,int y,int mode=0);
virtual void drawString(unsigned char* s,int x,int y, int mode, int maxWidth);
/*
* draw a line.
*/
virtual void drawLine(int x1,int y1,int x2,int y2,int mode);
/*
* Draws a rectangle on the current surface
*/
virtual void drawRectangle(int x,int y,int width,int height,int mode,int i=0);
/*
* Creates a new graphics containing a reduced version of the current
* content.
* Note: a non-toolkit-dependent version of this version is provided
* here.
*/
// virtual Graphics* reduce(int dstWidth, int dstHeight, Graphics* toImg=NULL) ;
/*
* Return the size of the buffers contained in the objet (offscreen buffer, palettes,...)
* This method is used by the cache managers to optimize the caching processes.
*/
virtual int getBuffersSize(void);
virtual Graphics* reduce(int dstWidth, int dstHeight, Graphics* toImg);
virtual Graphics* enlarge(int dstWidth, int dstHeight, Graphics* toImg) ;
private :
virtual Graphics* reduce16(int dstWidth, int dstHeight, Graphics* toImg) ;
virtual Graphics* enlarge16(int dstWidth, int dstHeight, Graphics* toImg) ;
} ;
#endif // ndef __EB_PFWGRAPHICS__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -