/*  $Id: canvas_generic.h,v 1.9 2004/02/07 12:35:30 mbn Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library 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
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
**
*/

#ifndef header_canvas_generic
#define header_canvas_generic

#if _MSC_VER > 1000
#pragma once
#endif

#include "API/Display/canvas.h"

class CL_Surface_Generic;

class CL_Canvas_Generic
{
//! Construction:
public:
	CL_Canvas_Generic() : ref_count(0) { return; }

	virtual ~CL_Canvas_Generic() { return; }

//! Attributes:
public:
	virtual CL_GraphicContext *get_gc() = 0;

	virtual CL_PixelBuffer get_pixeldata(const CL_Rect &area) = 0;

	virtual int get_width() const = 0;
	
	virtual int get_height() const = 0;
	
//! Operations:
public:
	void add_ref() { ref_count++; }

	void release_ref() { ref_count--; if (ref_count == 0) delete this; }

	virtual void set_pixeldata(const CL_Point &dest, const CL_Rect &src, const CL_PixelBuffer &data) = 0;

	virtual void select_surface(CL_Surface_Generic *surface) = 0;
	
	virtual void sync_surface() = 0;

//! Implementation:
private:
	int ref_count;
};

#endif
