2005-03-25 22:46:10 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2005-06-23 23:46:17 +00:00
|
|
|
// Copyright (c) 2001-2005, Haiku, Inc. All rights reserved.
|
|
|
|
// Distributed under the terms of the MIT license.
|
2005-03-25 22:46:10 +00:00
|
|
|
//
|
2005-06-23 23:46:17 +00:00
|
|
|
// File Name: DisplayDriverPainter.h
|
2005-03-25 22:46:10 +00:00
|
|
|
// Authors: DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
// Gabe Yoder <gyoder@stny.rr.com>
|
|
|
|
// Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
//
|
|
|
|
// Description: Abstract class which handles all graphics output
|
|
|
|
// for the server
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
#ifndef _DISPLAY_DRIVER_PAINTER_H_
|
|
|
|
#define _DISPLAY_DRIVER_PAINTER_H_
|
|
|
|
|
|
|
|
#include "DisplayDriver.h"
|
|
|
|
|
2005-03-26 22:09:02 +00:00
|
|
|
class HWInterface;
|
|
|
|
class Painter;
|
|
|
|
|
2005-03-25 22:46:10 +00:00
|
|
|
class DisplayDriverPainter : public DisplayDriver {
|
2005-05-26 09:21:51 +00:00
|
|
|
public:
|
2005-06-23 23:46:17 +00:00
|
|
|
DisplayDriverPainter(HWInterface* hwInterface);
|
2005-03-25 22:46:10 +00:00
|
|
|
virtual ~DisplayDriverPainter();
|
|
|
|
|
|
|
|
// when implementing, be sure to call the inherited version
|
2005-06-23 23:46:17 +00:00
|
|
|
virtual status_t Initialize();
|
2005-03-25 22:46:10 +00:00
|
|
|
virtual void Shutdown();
|
|
|
|
|
2005-06-23 23:46:17 +00:00
|
|
|
virtual void Update();
|
|
|
|
|
2005-05-03 21:47:08 +00:00
|
|
|
// clipping for all drawing functions, passing a NULL region
|
|
|
|
// will remove any clipping (drawing allowed everywhere)
|
|
|
|
virtual void ConstrainClippingRegion(BRegion* region);
|
|
|
|
|
2005-03-25 22:46:10 +00:00
|
|
|
// drawing functions
|
2005-04-26 13:50:34 +00:00
|
|
|
virtual void CopyRegion( /*const*/ BRegion* region,
|
|
|
|
int32 xOffset,
|
|
|
|
int32 yOffset);
|
2005-03-25 22:46:10 +00:00
|
|
|
|
|
|
|
virtual void CopyRegionList( BList* list,
|
|
|
|
BList* pList,
|
|
|
|
int32 rCount,
|
|
|
|
BRegion* clipReg);
|
|
|
|
|
|
|
|
virtual void InvertRect( const BRect &r);
|
|
|
|
|
2005-05-20 00:09:59 +00:00
|
|
|
virtual void DrawBitmap( ServerBitmap *bitmap,
|
2005-03-25 22:46:10 +00:00
|
|
|
const BRect &source,
|
|
|
|
const BRect &dest,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillArc( const BRect &r,
|
|
|
|
const float &angle,
|
|
|
|
const float &span,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillBezier( BPoint *pts,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillEllipse( const BRect &r,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillPolygon( BPoint *ptlist,
|
|
|
|
int32 numpts,
|
|
|
|
const BRect &bounds,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillRect( const BRect &r,
|
|
|
|
const RGBColor &color);
|
|
|
|
|
|
|
|
virtual void FillRect( const BRect &r,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillRegion( BRegion &r,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillRoundRect( const BRect &r,
|
|
|
|
const float &xrad,
|
|
|
|
const float &yrad,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillShape( const BRect &bounds,
|
|
|
|
const int32 &opcount,
|
|
|
|
const int32 *oplist,
|
|
|
|
const int32 &ptcount,
|
|
|
|
const BPoint *ptlist,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void FillTriangle( BPoint *pts,
|
|
|
|
const BRect &bounds,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void StrokeArc( const BRect &r,
|
|
|
|
const float &angle,
|
|
|
|
const float &span,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void StrokeBezier( BPoint *pts,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void StrokeEllipse( const BRect &r,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
// this version used by Decorator
|
|
|
|
virtual void StrokeLine( const BPoint &start,
|
|
|
|
const BPoint &end,
|
|
|
|
const RGBColor &color);
|
|
|
|
|
|
|
|
virtual void StrokeLine( const BPoint &start,
|
|
|
|
const BPoint &end,
|
2005-04-12 08:15:25 +00:00
|
|
|
DrawData *d);
|
2005-03-25 22:46:10 +00:00
|
|
|
|
2005-05-03 21:47:08 +00:00
|
|
|
virtual void StrokeLineArray(const int32 &numlines,
|
|
|
|
const LineArrayData *data,
|
|
|
|
const DrawData *d);
|
|
|
|
|
2005-03-25 22:46:10 +00:00
|
|
|
// this version used by Decorator
|
|
|
|
virtual void StrokePoint( const BPoint &pt,
|
|
|
|
const RGBColor &color);
|
|
|
|
|
|
|
|
virtual void StrokePoint( const BPoint &pt,
|
2005-04-12 08:15:25 +00:00
|
|
|
DrawData *d);
|
2005-03-25 22:46:10 +00:00
|
|
|
|
|
|
|
virtual void StrokePolygon( BPoint *ptlist,
|
|
|
|
int32 numpts,
|
|
|
|
const BRect &bounds,
|
|
|
|
const DrawData *d,
|
|
|
|
bool is_closed=true);
|
|
|
|
|
|
|
|
// this version used by Decorator
|
|
|
|
virtual void StrokeRect( const BRect &r,
|
|
|
|
const RGBColor &color);
|
|
|
|
|
|
|
|
virtual void StrokeRect( const BRect &r,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void StrokeRegion( BRegion &r,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void StrokeRoundRect(const BRect &r,
|
|
|
|
const float &xrad,
|
|
|
|
const float &yrad,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void StrokeShape( const BRect &bounds,
|
|
|
|
const int32 &opcount,
|
|
|
|
const int32 *oplist,
|
|
|
|
const int32 &ptcount,
|
|
|
|
const BPoint *ptlist,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
virtual void StrokeTriangle( BPoint *pts,
|
|
|
|
const BRect &bounds,
|
|
|
|
const DrawData *d);
|
|
|
|
|
|
|
|
// Font-related calls
|
|
|
|
|
|
|
|
// DrawData is NOT const because this call updates the pen position in the passed DrawData
|
|
|
|
virtual void DrawString( const char *string,
|
|
|
|
const int32 &length,
|
|
|
|
const BPoint &pt,
|
|
|
|
DrawData *d);
|
|
|
|
|
|
|
|
virtual void DrawString( const char *string,
|
|
|
|
const int32 &length,
|
|
|
|
const BPoint &pt,
|
|
|
|
const RGBColor &color,
|
|
|
|
escapement_delta *delta=NULL);
|
|
|
|
|
|
|
|
virtual float StringWidth( const char *string,
|
|
|
|
int32 length,
|
|
|
|
const DrawData *d);
|
|
|
|
|
2005-05-04 09:39:06 +00:00
|
|
|
virtual float StringWidth( const char *string,
|
|
|
|
int32 length,
|
|
|
|
const ServerFont &font);
|
|
|
|
|
2005-03-25 22:46:10 +00:00
|
|
|
virtual float StringHeight( const char *string,
|
|
|
|
int32 length,
|
|
|
|
const DrawData *d);
|
|
|
|
|
2005-06-23 23:46:17 +00:00
|
|
|
virtual bool Lock();
|
2005-03-28 18:03:45 +00:00
|
|
|
virtual void Unlock();
|
|
|
|
|
2005-06-23 23:46:17 +00:00
|
|
|
bool WriteLock();
|
|
|
|
void WriteUnlock();
|
2005-03-29 22:57:43 +00:00
|
|
|
|
2005-06-23 23:46:17 +00:00
|
|
|
virtual bool DumpToFile( const char *path);
|
2005-03-25 22:46:10 +00:00
|
|
|
virtual ServerBitmap* DumpToBitmap();
|
|
|
|
|
|
|
|
private:
|
2005-06-23 23:46:17 +00:00
|
|
|
BRect _CopyRect( BRect r,
|
|
|
|
int32 xOffset,
|
|
|
|
int32 yOffset) const;
|
2005-04-26 13:50:34 +00:00
|
|
|
|
2005-06-23 23:46:17 +00:00
|
|
|
void _CopyRect( uint8* bits,
|
|
|
|
uint32 width,
|
|
|
|
uint32 height,
|
|
|
|
uint32 bpr,
|
|
|
|
int32 xOffset,
|
|
|
|
int32 yOffset) const;
|
2005-03-30 16:05:05 +00:00
|
|
|
|
2005-03-26 22:09:02 +00:00
|
|
|
Painter* fPainter;
|
|
|
|
HWInterface* fGraphicsCard;
|
2005-05-04 23:48:19 +00:00
|
|
|
uint32 fAvailableHWAccleration;
|
2005-03-25 22:46:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DISPLAY_DRIVER_PAINTER_H_
|