2003-01-13 01:51:01 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2005-06-24 03:46:17 +04:00
|
|
|
// Copyright (c) 2001-2005, Haiku, Inc. All rights reserved
|
|
|
|
// Distributed under the terms of the MIT license.
|
2003-01-13 01:51:01 +03:00
|
|
|
//
|
|
|
|
// File Name: DisplayDriver.h
|
2005-03-25 20:29:45 +03:00
|
|
|
// Authors: DarkWyrm <bpmagic@columbus.rr.com>
|
2004-01-27 03:39:41 +03:00
|
|
|
// Gabe Yoder <gyoder@stny.rr.com>
|
2005-03-25 16:15:33 +03:00
|
|
|
// Stephan Aßmus <superstippi@gmx.de>
|
2004-01-27 03:39:41 +03:00
|
|
|
//
|
2005-03-25 16:15:33 +03:00
|
|
|
// Description: Abstract class which handles all graphics output
|
2003-01-13 01:51:01 +03:00
|
|
|
// for the server
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
#ifndef _DISPLAY_DRIVER_H_
|
|
|
|
#define _DISPLAY_DRIVER_H_
|
|
|
|
|
2004-01-13 03:08:01 +03:00
|
|
|
#include <Accelerant.h>
|
2003-01-13 01:51:01 +03:00
|
|
|
#include <Font.h>
|
2003-02-10 15:56:10 +03:00
|
|
|
#include <Locker.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <Point.h>
|
2005-03-25 20:29:45 +03:00
|
|
|
|
|
|
|
class BPoint;
|
|
|
|
class BRect;
|
|
|
|
class BRegion;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-03-25 20:29:45 +03:00
|
|
|
class DrawData;
|
|
|
|
class RGBColor;
|
|
|
|
class ServerBitmap;
|
2005-03-25 16:15:33 +03:00
|
|
|
class ServerCursor;
|
2005-05-04 13:40:32 +04:00
|
|
|
class ServerFont;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2003-01-13 01:51:01 +03:00
|
|
|
/*!
|
|
|
|
\brief Data structure for passing cursor information to hardware drivers.
|
|
|
|
*/
|
2005-03-25 20:29:45 +03:00
|
|
|
/*typedef struct
|
2003-01-13 01:51:01 +03:00
|
|
|
{
|
|
|
|
uchar *xormask, *andmask;
|
|
|
|
int32 width, height;
|
|
|
|
int32 hotx, hoty;
|
|
|
|
|
2005-03-25 20:29:45 +03:00
|
|
|
} cursor_data;*/
|
2003-01-13 01:51:01 +03:00
|
|
|
|
2004-10-16 05:57:13 +04:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
BPoint pt1;
|
|
|
|
BPoint pt2;
|
|
|
|
rgb_color color;
|
|
|
|
|
|
|
|
} LineArrayData;
|
|
|
|
|
2005-03-25 16:15:33 +03:00
|
|
|
class DisplayDriver {
|
2005-05-26 13:21:51 +04:00
|
|
|
public:
|
2005-03-25 16:15:33 +03:00
|
|
|
DisplayDriver();
|
|
|
|
virtual ~DisplayDriver();
|
2004-02-24 14:50:10 +03:00
|
|
|
|
2005-03-27 01:03:19 +03:00
|
|
|
// when implementing, be sure to call the inherited version
|
2005-06-24 03:46:17 +04:00
|
|
|
virtual status_t Initialize();
|
2005-03-27 01:03:19 +03:00
|
|
|
virtual void Shutdown();
|
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
// call this on mode changes!
|
|
|
|
virtual void Update() = 0;
|
|
|
|
|
2005-05-04 01:50:14 +04:00
|
|
|
// clipping for all drawing functions
|
|
|
|
virtual void ConstrainClippingRegion(BRegion* region) = 0;
|
|
|
|
|
2004-01-27 03:39:41 +03:00
|
|
|
// Graphics calls implemented in DisplayDriver
|
2005-04-26 17:50:34 +04:00
|
|
|
virtual void CopyRegion( /*const*/ BRegion* region,
|
|
|
|
int32 xOffset,
|
|
|
|
int32 yOffset) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-03-25 20:29:45 +03:00
|
|
|
virtual void CopyRegionList( BList* list,
|
|
|
|
BList* pList,
|
|
|
|
int32 rCount,
|
|
|
|
BRegion* clipReg) = 0;
|
|
|
|
|
|
|
|
virtual void InvertRect( const BRect &r) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
virtual void DrawBitmap( ServerBitmap *bitmap,
|
2005-03-25 16:15:33 +03:00
|
|
|
const BRect &source,
|
|
|
|
const BRect &dest,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillArc( const BRect &r,
|
|
|
|
const float &angle,
|
|
|
|
const float &span,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillBezier( BPoint *pts,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillEllipse( const BRect &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillPolygon( BPoint *ptlist,
|
|
|
|
int32 numpts,
|
|
|
|
const BRect &bounds,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillRect( const BRect &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const RGBColor &color) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillRect( const BRect &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillRegion( BRegion &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillRoundRect( const BRect &r,
|
|
|
|
const float &xrad,
|
|
|
|
const float &yrad,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillShape( const BRect &bounds,
|
|
|
|
const int32 &opcount,
|
|
|
|
const int32 *oplist,
|
|
|
|
const int32 &ptcount,
|
|
|
|
const BPoint *ptlist,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void FillTriangle( BPoint *pts,
|
|
|
|
const BRect &bounds,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeArc( const BRect &r,
|
|
|
|
const float &angle,
|
|
|
|
const float &span,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeBezier( BPoint *pts,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeEllipse( const BRect &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
// this version used by Decorator
|
|
|
|
virtual void StrokeLine( const BPoint &start,
|
|
|
|
const BPoint &end,
|
2005-03-25 20:29:45 +03:00
|
|
|
const RGBColor &color) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeLine( const BPoint &start,
|
|
|
|
const BPoint &end,
|
2005-04-12 12:28:25 +04:00
|
|
|
DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-05-04 01:50:14 +04:00
|
|
|
virtual void StrokeLineArray(const int32 &numlines,
|
|
|
|
const LineArrayData *data,
|
|
|
|
const DrawData *d) = 0;
|
|
|
|
|
2005-03-25 16:15:33 +03:00
|
|
|
// this version used by Decorator
|
|
|
|
virtual void StrokePoint( const BPoint &pt,
|
2005-03-25 20:29:45 +03:00
|
|
|
const RGBColor &color) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokePoint( const BPoint &pt,
|
2005-04-12 12:28:25 +04:00
|
|
|
DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokePolygon( BPoint *ptlist,
|
|
|
|
int32 numpts,
|
|
|
|
const BRect &bounds,
|
|
|
|
const DrawData *d,
|
2005-03-25 20:29:45 +03:00
|
|
|
bool is_closed=true) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
// this version used by Decorator
|
|
|
|
virtual void StrokeRect( const BRect &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const RGBColor &color) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeRect( const BRect &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeRegion( BRegion &r,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeRoundRect(const BRect &r,
|
|
|
|
const float &xrad,
|
|
|
|
const float &yrad,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeShape( const BRect &bounds,
|
|
|
|
const int32 &opcount,
|
|
|
|
const int32 *oplist,
|
|
|
|
const int32 &ptcount,
|
|
|
|
const BPoint *ptlist,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
|
|
|
virtual void StrokeTriangle( BPoint *pts,
|
|
|
|
const BRect &bounds,
|
2005-03-25 20:29:45 +03:00
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2004-01-27 03:39:41 +03:00
|
|
|
// Font-related calls
|
2004-10-17 02:38:43 +04:00
|
|
|
|
|
|
|
// DrawData is NOT const because this call updates the pen position in the passed DrawData
|
2005-03-25 20:29:45 +03:00
|
|
|
virtual void DrawString( const char *string,
|
|
|
|
const int32 &length,
|
|
|
|
const BPoint &pt,
|
|
|
|
DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-03-25 20:29:45 +03:00
|
|
|
virtual void DrawString( const char *string,
|
|
|
|
const int32 &length,
|
|
|
|
const BPoint &pt,
|
|
|
|
const RGBColor &color,
|
|
|
|
escapement_delta *delta=NULL) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-03-25 20:29:45 +03:00
|
|
|
virtual float StringWidth( const char *string,
|
|
|
|
int32 length,
|
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-05-04 13:40:32 +04:00
|
|
|
virtual float StringWidth( const char *string,
|
|
|
|
int32 length,
|
|
|
|
const ServerFont &font) = 0;
|
|
|
|
|
2005-03-25 20:29:45 +03:00
|
|
|
virtual float StringHeight( const char *string,
|
|
|
|
int32 length,
|
|
|
|
const DrawData *d) = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
virtual bool Lock() = 0;
|
2005-03-28 17:43:39 +04:00
|
|
|
virtual void Unlock() = 0;
|
2003-01-13 01:51:01 +03:00
|
|
|
|
2005-03-25 20:29:45 +03:00
|
|
|
virtual bool DumpToFile(const char *path) = 0;
|
|
|
|
virtual ServerBitmap* DumpToBitmap() = 0;
|
2005-03-25 16:15:33 +03:00
|
|
|
|
2003-01-13 01:51:01 +03:00
|
|
|
};
|
|
|
|
|
2003-02-07 20:30:17 +03:00
|
|
|
#endif
|