Lots of new stuff and tweaks to old specs.
DisplayDriver documentation incomplete. ServerCursor docs nonexistent. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2442 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
75b2a820de
commit
cd5337c0a2
474
src/servers/app/server/DisplayDriver.cpp
Normal file
474
src/servers/app/server/DisplayDriver.cpp
Normal file
@ -0,0 +1,474 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: DisplayDriver.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Mostly abstract class which handles all graphics output
|
||||
// for the server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include "DisplayDriver.h"
|
||||
#include "ServerCursor.h"
|
||||
|
||||
/*!
|
||||
\brief Sets up internal variables needed by all DisplayDriver subclasses
|
||||
|
||||
Subclasses should follow DisplayDriver's lead and use this function mostly
|
||||
for initializing data members.
|
||||
*/
|
||||
DisplayDriver::DisplayDriver(void)
|
||||
{
|
||||
_lock_sem=create_sem(1,"DisplayDriver Lock");
|
||||
|
||||
_buffer_depth=0;
|
||||
_buffer_width=0;
|
||||
_buffer_height=0;
|
||||
_buffer_mode=-1;
|
||||
|
||||
_is_cursor_hidden=false;
|
||||
_is_cursor_obscured=false;
|
||||
_cursor=NULL;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Deletes the locking semaphore
|
||||
|
||||
Subclasses should use the destructor mostly for freeing allocated heap space.
|
||||
*/
|
||||
DisplayDriver::~DisplayDriver(void)
|
||||
{
|
||||
delete_sem(_lock_sem);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Initializes the driver object.
|
||||
\return true if successful, false if not
|
||||
|
||||
Initialize sets up the driver for display, including the initial clearing
|
||||
of the screen. If things do not go as they should, false should be returned.
|
||||
*/
|
||||
bool DisplayDriver::Initialize(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Shuts down the driver's video subsystem
|
||||
|
||||
Any work done by Initialize() should be undone here. Note that Shutdown() is
|
||||
called even if Initialize() was unsuccessful.
|
||||
*/
|
||||
void DisplayDriver::Shutdown(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::CopyBits calls
|
||||
\param Source rectangle.
|
||||
\param Destination rectangle.
|
||||
|
||||
Bounds checking must be done in this call. If the destination is not the same size
|
||||
as the source, the source should be scaled to fit.
|
||||
*/
|
||||
void DisplayDriver::CopyBits(BRect src, BRect dest)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::DrawBitmap calls
|
||||
\param Bitmap to be drawn. It will always be non-NULL and valid. The color
|
||||
space is not guaranteed to match.
|
||||
\param Source rectangle
|
||||
\param Destination rectangle. Source will be scaled to fit if not the same size.
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
|
||||
Bounds checking must be done in this call.
|
||||
*/
|
||||
void DisplayDriver::DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Utilizes the font engine to draw a string to the frame buffer
|
||||
\param String to be drawn. Always non-NULL.
|
||||
\param Number of characters in the string to draw. Always greater than 0. If greater
|
||||
than the number of characters in the string, draw the entire string.
|
||||
\param Point at which the baseline starts. Characters are to be drawn 1 pixel above
|
||||
this for backwards compatibility. While the point itself is guaranteed to be inside
|
||||
the frame buffers coordinate range, the clipping of each individual glyph must be
|
||||
performed by the driver itself.
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
*/
|
||||
void DisplayDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::FillArc calls
|
||||
\param Rectangle enclosing the entire arc
|
||||
\param Starting angle for the arc in degrees
|
||||
\param Span of the arc in degrees. Ending angle = angle+span.
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
\param 8-byte array containing the pattern to use. Always non-NULL.
|
||||
|
||||
Bounds checking must be done in this call because only part of the arc may end up
|
||||
being clipped.
|
||||
*/
|
||||
void DisplayDriver::FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::FillBezier calls.
|
||||
\param 4-element array of BPoints in the order of start, end, and then the two control
|
||||
points.
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
\param 8-byte array containing the pattern to use. Always non-NULL.
|
||||
|
||||
Bounds checking must be done in this call.
|
||||
*/
|
||||
void DisplayDriver::FillBezier(BPoint *pts, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::FillEllipse calls
|
||||
\param BRect enclosing the ellipse to be drawn.
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
\param 8-byte array containing the pattern to use. Always non-NULL.
|
||||
|
||||
Bounds checking must be done in this call because only part of the ellipse may end up
|
||||
being clipped.
|
||||
*/
|
||||
void DisplayDriver::FillEllipse(BRect r, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::FillPolygon calls
|
||||
\param Array of BPoints defining the polygon.
|
||||
\param Number of points in the BPoint array.
|
||||
\param Rectangle which contains the polygon
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
\param 8-byte array containing the pattern to use. Always non-NULL.
|
||||
|
||||
The points in the array are not guaranteed to be within the framebuffer's
|
||||
coordinate range.
|
||||
*/
|
||||
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::FillRect calls
|
||||
\param BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
\param 8-byte array containing the pattern to use. Always non-NULL.
|
||||
|
||||
*/
|
||||
void DisplayDriver::FillRect(BRect r, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::FillRoundRect calls
|
||||
\param X radius of the corner arcs
|
||||
\param Y radius of the corner arcs
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
\param 8-byte array containing the pattern to use. Always non-NULL.
|
||||
|
||||
Bounds checking must be done in this call because only part of the roundrect may end
|
||||
up being clipped.
|
||||
*/
|
||||
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
//void DisplayDriver::FillShape(SShape *sh, LayerData *d, int8 *pat)
|
||||
//{
|
||||
//}
|
||||
|
||||
/*!
|
||||
\brief Called for all BView::FillTriangle calls
|
||||
\param Array of 3 BPoints. Always non-NULL.
|
||||
\param BRect enclosing the triangle. While it will definitely enclose the triangle,
|
||||
it may not be within the frame buffer's bounds.
|
||||
\param Data structure containing any other data necessary for the call. Always non-NULL.
|
||||
\param 8-byte array containing the pattern to use. Always non-NULL.
|
||||
|
||||
Bounds checking must be done in this call because only part of the triangle may end
|
||||
up being clipped.
|
||||
*/
|
||||
void DisplayDriver::FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Hides the cursor.
|
||||
|
||||
Hide calls are not nestable, unlike that of the BApplication class. Subclasses should
|
||||
call _SetCursorHidden(true) somewhere within this function to ensure that data is
|
||||
maintained accurately.
|
||||
*/
|
||||
void DisplayDriver::HideCursor(void)
|
||||
{
|
||||
_SetCursorHidden(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns whether the cursor is visible or not.
|
||||
\return true if hidden or obscured, false if not.
|
||||
|
||||
*/
|
||||
bool DisplayDriver::IsCursorHidden(void)
|
||||
{
|
||||
_Lock();
|
||||
|
||||
bool value=(_is_cursor_hidden || _is_cursor_obscured);
|
||||
|
||||
_Unlock();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Moves the cursor to the given point.
|
||||
|
||||
The coordinates passed to MoveCursorTo are guaranteed to be within the frame buffer's
|
||||
range, but the cursor data itself will need to be clipped. A check to see if the
|
||||
cursor is obscured should be made and if so, a call to _SetCursorObscured(false)
|
||||
should be made the cursor in addition to displaying at the passed coordinates.
|
||||
*/
|
||||
void DisplayDriver::MoveCursorTo(float x, float y)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Inverts the colors in the rectangle.
|
||||
\param Rectangle of the area to be inverted. Guaranteed to be within bounds.
|
||||
*/
|
||||
void DisplayDriver::InvertRect(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Shows the cursor.
|
||||
|
||||
Show calls are not nestable, unlike that of the BApplication class. Subclasses should
|
||||
call _SetCursorHidden(false) somewhere within this function to ensure that data is
|
||||
maintained accurately.
|
||||
*/
|
||||
void DisplayDriver::ShowCursor(void)
|
||||
{
|
||||
_SetCursorHidden(false);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Obscures the cursor.
|
||||
|
||||
Obscure calls are not nestable. Subclasses should call _SetCursorObscured(true)
|
||||
somewhere within this function to ensure that data is maintained accurately. When the
|
||||
next call to MoveCursorTo() is made, the cursor will be shown again.
|
||||
*/
|
||||
void DisplayDriver::ObscureCursor(void)
|
||||
{
|
||||
_SetCursorObscured(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Changes the cursor.
|
||||
\param The new cursor. Guaranteed to be non-NULL.
|
||||
|
||||
The driver does not take ownership of the given cursor. Subclasses should make
|
||||
a copy of the cursor passed to it. The default version of this function hides the
|
||||
cursory, replaces it, and shows the cursor if previously visible.
|
||||
*/
|
||||
void DisplayDriver::SetCursor(ServerCursor *cursor)
|
||||
{
|
||||
_Lock();
|
||||
|
||||
bool hidden=_is_cursor_hidden;
|
||||
bool obscured=_is_cursor_obscured;
|
||||
if(_cursor)
|
||||
delete _cursor;
|
||||
_cursor=new ServerCursor(cursor);
|
||||
|
||||
if(!hidden && !obscured)
|
||||
ShowCursor();
|
||||
|
||||
_Unlock();
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokeBezier(BPoint *pts, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokeEllipse(BRect r, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokeRect(BRect r, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
//void DisplayDriver::StrokeShape(SShape *sh, LayerData *d, int8 *pat)
|
||||
//{
|
||||
//}
|
||||
|
||||
void DisplayDriver::StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::SetMode(int32 mode)
|
||||
{
|
||||
}
|
||||
|
||||
bool DisplayDriver::DumpToFile(const char *path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float DisplayDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
float DisplayDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void DisplayDriver::GetBoundingBoxes(const char *string, int32 count, font_metric_mode mode, escapement_delta *delta, BRect *rectarray)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::GetEscapements(const char *string, int32 charcount, escapement_delta *delta, escapement_delta *escapements, escapement_delta *offsets)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::GetEdges(const char *string, int32 charcount, edge_info *edgearray)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::GetHasGlyphs(const char *string, int32 charcount, bool *hasarray)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayDriver::GetTruncatedStrings( const char **instrings, int32 stringcount, uint32 mode, float maxwidth, char **outstrings)
|
||||
{
|
||||
}
|
||||
|
||||
uint8 DisplayDriver::GetDepth(void)
|
||||
{
|
||||
return _buffer_depth;
|
||||
}
|
||||
|
||||
uint16 DisplayDriver::GetHeight(void)
|
||||
{
|
||||
return _buffer_height;
|
||||
}
|
||||
|
||||
uint16 DisplayDriver::GetWidth(void)
|
||||
{
|
||||
return _buffer_width;
|
||||
}
|
||||
|
||||
int32 DisplayDriver::GetMode(void)
|
||||
{
|
||||
return _buffer_mode;
|
||||
}
|
||||
|
||||
|
||||
// Protected Internal Functions
|
||||
|
||||
bool DisplayDriver::_Lock(bigtime_t timeout)
|
||||
{
|
||||
if(acquire_sem_etc(_lock_sem,1,B_RELATIVE_TIMEOUT,timeout)!=B_NO_ERROR)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DisplayDriver::_Unlock(void)
|
||||
{
|
||||
release_sem(_lock_sem);
|
||||
}
|
||||
|
||||
void DisplayDriver::_SetDepth(uint8 d)
|
||||
{
|
||||
_buffer_depth=d;
|
||||
}
|
||||
|
||||
void DisplayDriver::_SetHeight(uint16 h)
|
||||
{
|
||||
_buffer_height=h;
|
||||
}
|
||||
|
||||
void DisplayDriver::_SetWidth(uint16 w)
|
||||
{
|
||||
_buffer_width=w;
|
||||
}
|
||||
|
||||
void DisplayDriver::_SetMode(int32 m)
|
||||
{
|
||||
_buffer_mode=m;
|
||||
}
|
||||
|
||||
void DisplayDriver::_SetCursorHidden(bool state)
|
||||
{
|
||||
_is_cursor_hidden=state;
|
||||
}
|
||||
|
||||
void DisplayDriver::_SetCursorObscured(bool state)
|
||||
{
|
||||
_is_cursor_obscured=state;
|
||||
}
|
||||
|
||||
bool DisplayDriver::_IsCursorObscured(bool state)
|
||||
{
|
||||
return _is_cursor_obscured;
|
||||
}
|
||||
|
||||
ServerCursor *DisplayDriver::_GetCursor(void)
|
||||
{
|
||||
return _cursor;
|
||||
}
|
||||
|
170
src/servers/app/server/DisplayDriver.h
Normal file
170
src/servers/app/server/DisplayDriver.h
Normal file
@ -0,0 +1,170 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: DisplayDriver.h
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Mostly abstract class which handles all graphics output
|
||||
// for the server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _DISPLAY_DRIVER_H_
|
||||
#define _DISPLAY_DRIVER_H_
|
||||
|
||||
#include <GraphicsCard.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
#include <View.h>
|
||||
#include <Font.h>
|
||||
#include <Rect.h>
|
||||
#include "RGBColor.h"
|
||||
|
||||
class ServerCursor;
|
||||
class ServerBitmap;
|
||||
class LayerData;
|
||||
|
||||
#ifndef ROUND
|
||||
#define ROUND(a) ( (a-long(a))>=.5)?(long(a)+1):(long(a))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief Data structure for passing cursor information to hardware drivers.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uchar *xormask, *andmask;
|
||||
int32 width, height;
|
||||
int32 hotx, hoty;
|
||||
|
||||
} cursor_data;
|
||||
|
||||
#ifndef HOOK_DEFINE_CURSOR
|
||||
|
||||
#define HOOK_DEFINE_CURSOR 0
|
||||
#define HOOK_MOVE_CURSOR 1
|
||||
#define HOOK_SHOW_CURSOR 2
|
||||
#define HOOK_DRAW_LINE_8BIT 3
|
||||
#define HOOK_DRAW_LINE_16BIT 12
|
||||
#define HOOK_DRAW_LINE_32BIT 4
|
||||
#define HOOK_DRAW_RECT_8BIT 5
|
||||
#define HOOK_DRAW_RECT_16BIT 13
|
||||
#define HOOK_DRAW_RECT_32BIT 6
|
||||
#define HOOK_BLIT 7
|
||||
#define HOOK_DRAW_ARRAY_8BIT 8
|
||||
#define HOOK_DRAW_ARRAY_16BIT 14 // Not implemented in current R5 drivers
|
||||
#define HOOK_DRAW_ARRAY_32BIT 9
|
||||
#define HOOK_SYNC 10
|
||||
#define HOOK_INVERT_RECT 11
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class DisplayDriver DisplayDriver.h
|
||||
\brief Mostly abstract class which handles all graphics output for the server.
|
||||
|
||||
The DisplayDriver is called in order to handle all messiness associated with
|
||||
a particular rendering context, such as the screen, and the methods to
|
||||
handle organizing information related to it along with writing to the context
|
||||
itself.
|
||||
|
||||
While all virtual functions are technically optional, the default versions
|
||||
do very little, so implementing them all more or less required.
|
||||
*/
|
||||
|
||||
class DisplayDriver
|
||||
{
|
||||
public:
|
||||
DisplayDriver(void);
|
||||
virtual ~DisplayDriver(void);
|
||||
virtual bool Initialize(void);
|
||||
virtual void Shutdown(void);
|
||||
virtual void CopyBits(BRect src, BRect dest);
|
||||
virtual void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
|
||||
virtual void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
|
||||
|
||||
virtual void FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
||||
virtual void FillBezier(BPoint *pts, LayerData *d, int8 *pat);
|
||||
virtual void FillEllipse(BRect r, LayerData *d, int8 *pat);
|
||||
virtual void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat);
|
||||
virtual void FillRect(BRect r, LayerData *d, int8 *pat);
|
||||
virtual void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
||||
// virtual void FillShape(SShape *sh, LayerData *d, int8 *pat);
|
||||
virtual void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
||||
|
||||
virtual void HideCursor(void);
|
||||
virtual bool IsCursorHidden(void);
|
||||
virtual void MoveCursorTo(float x, float y);
|
||||
virtual void InvertRect(BRect r);
|
||||
virtual void ShowCursor(void);
|
||||
virtual void ObscureCursor(void);
|
||||
virtual void SetCursor(ServerCursor *cursor);
|
||||
|
||||
virtual void StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
||||
virtual void StrokeBezier(BPoint *pts, LayerData *d, int8 *pat);
|
||||
virtual void StrokeEllipse(BRect r, LayerData *d, int8 *pat);
|
||||
virtual void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
||||
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true);
|
||||
virtual void StrokeRect(BRect r, LayerData *d, int8 *pat);
|
||||
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
||||
// virtual void StrokeShape(SShape *sh, LayerData *d, int8 *pat);
|
||||
virtual void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
||||
virtual void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d);
|
||||
virtual void SetMode(int32 mode);
|
||||
virtual bool DumpToFile(const char *path);
|
||||
|
||||
virtual float StringWidth(const char *string, int32 length, LayerData *d);
|
||||
virtual float StringHeight(const char *string, int32 length, LayerData *d);
|
||||
|
||||
virtual void GetBoundingBoxes(const char *string, int32 count, font_metric_mode mode, escapement_delta *delta, BRect *rectarray);
|
||||
virtual void GetEscapements(const char *string, int32 charcount, escapement_delta *delta, escapement_delta *escapements, escapement_delta *offsets);
|
||||
virtual void GetEdges(const char *string, int32 charcount, edge_info *edgearray);
|
||||
virtual void GetHasGlyphs(const char *string, int32 charcount, bool *hasarray);
|
||||
virtual void GetTruncatedStrings( const char **instrings, int32 stringcount, uint32 mode, float maxwidth, char **outstrings);
|
||||
|
||||
uint8 GetDepth(void);
|
||||
uint16 GetHeight(void);
|
||||
uint16 GetWidth(void);
|
||||
int32 GetMode(void);
|
||||
|
||||
protected:
|
||||
bool _Lock(bigtime_t timeout=B_INFINITE_TIMEOUT);
|
||||
void _Unlock(void);
|
||||
void _SetDepth(uint8 d);
|
||||
void _SetHeight(uint16 h);
|
||||
void _SetWidth(uint16 w);
|
||||
void _SetMode(int32 m);
|
||||
void _SetCursorHidden(bool state);
|
||||
void _SetCursorObscured(bool state);
|
||||
bool _IsCursorObscured(bool state);
|
||||
ServerCursor *_GetCursor(void);
|
||||
|
||||
private:
|
||||
sem_id _lock_sem;
|
||||
uint8 _buffer_depth;
|
||||
uint16 _buffer_width;
|
||||
uint16 _buffer_height;
|
||||
int32 _buffer_mode;
|
||||
bool _is_cursor_hidden;
|
||||
bool _is_cursor_obscured;
|
||||
ServerCursor *_cursor;
|
||||
};
|
||||
|
||||
#endif
|
225
src/servers/app/server/ServerBitmap.cpp
Normal file
225
src/servers/app/server/ServerBitmap.cpp
Normal file
@ -0,0 +1,225 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: ServerBitmap.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Bitmap class used by the server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include "ServerBitmap.h"
|
||||
|
||||
/*!
|
||||
\brief Constructor called by the BitmapManager (only).
|
||||
\param Size of the bitmap.
|
||||
\param Color space of the bitmap
|
||||
\param Various bitmap flags to tweak the bitmap as defined in Bitmap.h
|
||||
\param Number of bytes in each row. -1 implies the default value. Any value less
|
||||
than the the default will less than the default will be overridden, but any value
|
||||
greater than the default will result in the number of bytes specified.
|
||||
\param Screen assigned to the bitmap.
|
||||
*/
|
||||
ServerBitmap::ServerBitmap(BRect rect,color_space space, int32 flags,
|
||||
int32 bytesperline=-1, screen_id screen=B_MAIN_SCREEN_ID)
|
||||
{
|
||||
_initialized=false;
|
||||
|
||||
_area=B_ERROR;
|
||||
_width=rect.IntegerWidth()+1;
|
||||
_height=rect.IntegerHeight()+1;
|
||||
_space=space;
|
||||
_area=B_ERROR;
|
||||
_buffer=NULL;
|
||||
|
||||
_HandleSpace(space, bytesperline);
|
||||
}
|
||||
|
||||
//! Copy constructor does not copy the buffer.
|
||||
ServerBitmap::ServerBitmap(const ServerBitmap *bmp)
|
||||
{
|
||||
_initialized=false;
|
||||
_area=B_ERROR;
|
||||
_buffer=NULL;
|
||||
|
||||
if(bmp)
|
||||
{
|
||||
_width=bmp->_width;
|
||||
_height=bmp->_height;
|
||||
_bytesperrow=bmp->_bytesperrow;
|
||||
_space=bmp->_space;
|
||||
_flags=bmp->_flags;
|
||||
_bpp=bmp->_bpp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_width=0;
|
||||
_height=0;
|
||||
_bytesperrow=0;
|
||||
_space=B_NO_COLOR_SPACE;
|
||||
_flags=0;
|
||||
_bpp=0;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Empty. Defined for subclasses.
|
||||
*/
|
||||
ServerBitmap::~ServerBitmap(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Gets the number of bytes occupied by the bitmap, including padding bytes.
|
||||
\return The number of bytes occupied by the bitmap, including padding.
|
||||
*/
|
||||
uint32 ServerBitmap::BitsLength(void)
|
||||
{
|
||||
return (uint32)(_bytesperrow*_height);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Internal function used to translate color space values to appropriate internal
|
||||
values.
|
||||
\param Color space for the bitmap.
|
||||
\param Number of bytes per row.
|
||||
*/
|
||||
void ServerBitmap::_HandleSpace(color_space space, int32 bytesperline=-1)
|
||||
{
|
||||
// Big convoluted mess just to handle every color space and dword align
|
||||
// the buffer
|
||||
switch(space)
|
||||
{
|
||||
// Buffer is dword-aligned, so nothing need be done
|
||||
// aside from allocate the memory
|
||||
case B_RGB32:
|
||||
case B_RGBA32:
|
||||
case B_RGB32_BIG:
|
||||
case B_RGBA32_BIG:
|
||||
case B_UVL32:
|
||||
case B_UVLA32:
|
||||
case B_LAB32:
|
||||
case B_LABA32:
|
||||
case B_HSI32:
|
||||
case B_HSIA32:
|
||||
case B_HSV32:
|
||||
case B_HSVA32:
|
||||
case B_HLS32:
|
||||
case B_HLSA32:
|
||||
case B_CMY32:
|
||||
case B_CMYA32:
|
||||
case B_CMYK32:
|
||||
|
||||
// 24-bit = 32-bit with extra 8 bits ignored
|
||||
case B_RGB24_BIG:
|
||||
case B_RGB24:
|
||||
case B_LAB24:
|
||||
case B_UVL24:
|
||||
case B_HSI24:
|
||||
case B_HSV24:
|
||||
case B_HLS24:
|
||||
case B_CMY24:
|
||||
{
|
||||
if(bytesperline<(_width*4))
|
||||
_bytesperrow=_width*4;
|
||||
else
|
||||
_bytesperrow=bytesperline;
|
||||
_bpp=32;
|
||||
break;
|
||||
}
|
||||
// Calculate size and dword-align
|
||||
|
||||
// 1-bit
|
||||
case B_GRAY1:
|
||||
{
|
||||
int32 numbytes=_width>>3;
|
||||
if((_width % 8) != 0)
|
||||
numbytes++;
|
||||
if(bytesperline<numbytes)
|
||||
{
|
||||
for(int8 i=0;i<4;i++)
|
||||
{
|
||||
if( (numbytes+i)%4==0)
|
||||
{
|
||||
_bytesperrow=numbytes+i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
_bytesperrow=bytesperline;
|
||||
_bpp=1;
|
||||
}
|
||||
|
||||
// 8-bit
|
||||
case B_CMAP8:
|
||||
case B_GRAY8:
|
||||
case B_YUV411:
|
||||
case B_YUV420:
|
||||
case B_YCbCr422:
|
||||
case B_YCbCr411:
|
||||
case B_YCbCr420:
|
||||
case B_YUV422:
|
||||
{
|
||||
if(bytesperline<_width)
|
||||
{
|
||||
for(int8 i=0;i<4;i++)
|
||||
{
|
||||
if( (_width+i)%4==0)
|
||||
{
|
||||
_bytesperrow=_width+i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
_bytesperrow=bytesperline;
|
||||
_bpp=8;
|
||||
break;
|
||||
}
|
||||
|
||||
// 16-bit
|
||||
case B_YUV9:
|
||||
case B_YUV12:
|
||||
case B_RGB15:
|
||||
case B_RGBA15:
|
||||
case B_RGB16:
|
||||
case B_RGB16_BIG:
|
||||
case B_RGB15_BIG:
|
||||
case B_RGBA15_BIG:
|
||||
case B_YCbCr444:
|
||||
case B_YUV444:
|
||||
{
|
||||
if(bytesperline<_width*2)
|
||||
{
|
||||
if( (_width*2) % 4 !=0)
|
||||
_bytesperrow=(_width+1)*2;
|
||||
else
|
||||
_bytesperrow=_width*2;
|
||||
}
|
||||
else
|
||||
_bytesperrow=bytesperline;
|
||||
_bpp=16;
|
||||
break;
|
||||
}
|
||||
case B_NO_COLOR_SPACE:
|
||||
_bpp=0;
|
||||
break;
|
||||
}
|
||||
}
|
119
src/servers/app/server/ServerBitmap.h
Normal file
119
src/servers/app/server/ServerBitmap.h
Normal file
@ -0,0 +1,119 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: ServerBitmap.h
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Bitmap class used inside the server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _SERVER_BITMAP_H_
|
||||
#define _SERVER_BITMAP_H_
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Rect.h>
|
||||
#include <OS.h>
|
||||
|
||||
/*!
|
||||
\class ServerBitmap ServerBitmap.h
|
||||
\brief Bitmap class used inside the server.
|
||||
|
||||
This class is not directly allocated or freed. Instead, it is
|
||||
managed by the BitmapManager class. It is also the base class for
|
||||
all cursors. Every BBitmap has a shadow ServerBitmap object.
|
||||
*/
|
||||
class ServerBitmap
|
||||
{
|
||||
public:
|
||||
ServerBitmap(BRect rect,color_space space, int32 flags,
|
||||
int32 bytesperline=-1, screen_id screen=B_MAIN_SCREEN_ID);
|
||||
ServerBitmap(const ServerBitmap *bmp);
|
||||
~ServerBitmap(void);
|
||||
|
||||
/*!
|
||||
\brief Returns the area in which the buffer resides
|
||||
\return
|
||||
- \c B_ERROR if the buffer is not allocated in an area
|
||||
- area_id for the buffer
|
||||
*/
|
||||
area_id Area(void) { return _area; }
|
||||
|
||||
//! Returns the bitmap's buffer
|
||||
uint8 *Bits(void) { return _buffer; }
|
||||
uint32 BitsLength(void);
|
||||
|
||||
//! Returns the size of the bitmap
|
||||
BRect Bounds() { return BRect(0,0,_width-1,_height-1); };
|
||||
|
||||
//! Returns the number of bytes in each row, including padding
|
||||
int32 BytesPerRow(void) { return _bytesperrow; };
|
||||
|
||||
//! Returns the pixel color depth
|
||||
uint8 BitsPerPixel(void) { return _bpp; }
|
||||
|
||||
//! Returns the color space of the bitmap
|
||||
color_space ColorSpace(void) { return _space; }
|
||||
|
||||
//! Returns the width of the bitmap
|
||||
int32 Width(void) const { return _width; }
|
||||
|
||||
//! Returns the height of the bitmap
|
||||
int32 Height(void) const { return _height; }
|
||||
|
||||
//! Returns whether the bitmap is valid
|
||||
bool InitCheck(void) { return _initialized; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Internal function used by the BitmapManager.
|
||||
void _SetArea(area_id ID) { _area=ID; }
|
||||
|
||||
//! Internal function used by the BitmapManager.
|
||||
void _SetBuffer(void *ptr) { _buffer=(uint8*)ptr; }
|
||||
|
||||
/*!
|
||||
\brief Internal function used by subclasses
|
||||
|
||||
Subclasses should call this so the buffer can automagically
|
||||
be allocated on the heap.
|
||||
*/
|
||||
void _AllocateBuffer(void) { if(_buffer!=NULL) delete _buffer; _buffer=new uint8[BitsLength()]; }
|
||||
|
||||
/*!
|
||||
\brief Internal function used by subclasses
|
||||
|
||||
Subclasses should call this to free the internal buffer.
|
||||
*/
|
||||
void _FreeBuffer(void) { if(_buffer!=NULL) { delete _buffer; _buffer=NULL; } }
|
||||
|
||||
void _HandleSpace(color_space space, int32 bytesperline=-1);
|
||||
|
||||
bool _initialized;
|
||||
area_id _area;
|
||||
uint8 *_buffer;
|
||||
|
||||
int32 _width,_height;
|
||||
int32 _bytesperrow;
|
||||
color_space _space;
|
||||
int32 _flags;
|
||||
int _bpp;
|
||||
};
|
||||
|
||||
#endif
|
115
src/servers/app/server/ServerCursor.cpp
Normal file
115
src/servers/app/server/ServerCursor.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: ServerCursor.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Glorified ServerBitmap used for cursor work.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include "ServerCursor.h"
|
||||
|
||||
ServerCursor::ServerCursor(BRect r, color_space cspace, int32 flags, BPoint hotspot, int32 bytesperrow=-1, screen_id screen=B_MAIN_SCREEN_ID)
|
||||
: ServerBitmap(r,cspace,flags,bytesperrow,screen)
|
||||
{
|
||||
_hotspot=hotspot;
|
||||
_hotspot.ConstrainTo(Bounds());
|
||||
|
||||
_AllocateBuffer();
|
||||
}
|
||||
|
||||
ServerCursor::ServerCursor(int8 *data)
|
||||
: ServerBitmap(BRect(0,0,15,15),B_RGBA32,0,64)
|
||||
{
|
||||
// 68-byte array used in R5 for holding cursors.
|
||||
// This API has serious problems and should be deprecated(but supported) in R2
|
||||
|
||||
// Now that we have all the setup, we're going to map (for now) the cursor
|
||||
// to RGBA32. Eventually, there will be support for 16 and 8-bit depths
|
||||
if(data)
|
||||
{
|
||||
_initialized=true;
|
||||
uint32 black=0xFF000000,
|
||||
white=0xFFFFFFFF,
|
||||
*bmppos;
|
||||
uint16 *cursorpos, *maskpos,cursorflip, maskflip,
|
||||
cursorval, maskval,powval;
|
||||
uint8 i,j;
|
||||
|
||||
cursorpos=(uint16*)(data+4);
|
||||
maskpos=(uint16*)(data+36);
|
||||
|
||||
_AllocateBuffer();
|
||||
|
||||
// for each row in the cursor data
|
||||
for(j=0;j<16;j++)
|
||||
{
|
||||
bmppos=(uint32*)(_buffer+ (j*64) );
|
||||
|
||||
// On intel, our bytes end up swapped, so we must swap them back
|
||||
cursorflip=(cursorpos[j] & 0xFF) << 8;
|
||||
cursorflip |= (cursorpos[j] & 0xFF00) >> 8;
|
||||
maskflip=(maskpos[j] & 0xFF) << 8;
|
||||
maskflip |= (maskpos[j] & 0xFF00) >> 8;
|
||||
|
||||
// for each column in each row of cursor data
|
||||
for(i=0;i<16;i++)
|
||||
{
|
||||
// Get the values and dump them to the bitmap
|
||||
powval=((15-i) * (15-i));
|
||||
cursorval=cursorflip & powval;
|
||||
maskval=maskflip & powval;
|
||||
bmppos[i]=((cursorval!=0)?black:white) & ((maskval>0)?0xFFFFFFFF:0x00FFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_width=0;
|
||||
_height=0;
|
||||
_bytesperrow=0;
|
||||
_space=B_NO_COLOR_SPACE;
|
||||
}
|
||||
}
|
||||
|
||||
ServerCursor::ServerCursor(const ServerCursor *cursor)
|
||||
: ServerBitmap(cursor)
|
||||
{
|
||||
_AllocateBuffer();
|
||||
_initialized=true;
|
||||
|
||||
if(cursor)
|
||||
{
|
||||
if(cursor->_buffer)
|
||||
memcpy(_buffer, cursor->_buffer, BitsLength());
|
||||
_hotspot=cursor->_hotspot;
|
||||
}
|
||||
}
|
||||
|
||||
ServerCursor::~ServerCursor(void)
|
||||
{
|
||||
_FreeBuffer();
|
||||
}
|
||||
|
||||
void ServerCursor::SetHotSpot(BPoint pt)
|
||||
{
|
||||
_hotspot=pt;
|
||||
_hotspot.ConstrainTo(Bounds());
|
||||
}
|
48
src/servers/app/server/ServerCursor.h
Normal file
48
src/servers/app/server/ServerCursor.h
Normal file
@ -0,0 +1,48 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: ServerCursor.h
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Glorified ServerBitmap used for cursor work.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef SERVERCURSOR_H_
|
||||
#define SERVERCURSOR_H_
|
||||
|
||||
#include <Point.h>
|
||||
#include "ServerBitmap.h"
|
||||
|
||||
class ServerCursor : public ServerBitmap
|
||||
{
|
||||
public:
|
||||
ServerCursor(BRect r, color_space cspace, int32 flags, BPoint hotspot, int32 bytesperrow=-1, screen_id screen=B_MAIN_SCREEN_ID);
|
||||
ServerCursor(int8 *data);
|
||||
ServerCursor(const ServerCursor *cursor);
|
||||
~ServerCursor(void);
|
||||
|
||||
//! Returns the cursor's hot spot
|
||||
BPoint GetHotSpot(void);
|
||||
void SetHotSpot(BPoint pt);
|
||||
private:
|
||||
BPoint _hotspot;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user