From 16c7939643337a75a72e044259f4c1418b6cfac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 18 Mar 2006 16:49:24 +0000 Subject: [PATCH] Somehow svn messed up my local copy and didn't let me commit this before (needed to checkout private headers again). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16832 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/servers/app/BitmapManager.h | 39 ---- headers/private/servers/app/ColorSet.h | 85 ------- headers/private/servers/app/CursorSet.h | 57 ----- headers/private/servers/app/Decorator.h | 168 -------------- headers/private/servers/app/DisplaySupport.h | 161 ------------- headers/private/servers/app/DrawState.h | 200 ---------------- headers/private/servers/app/DrawingEngine.h | 169 -------------- headers/private/servers/app/FontFamily.h | 217 ------------------ headers/private/servers/app/FontManager.h | 113 --------- headers/private/servers/app/HashTable.h | 48 ---- headers/private/servers/app/PatternHandler.h | 196 ---------------- headers/private/servers/app/RGBColor.h | 58 ----- .../private/servers/app/ReferenceCounting.h | 55 ----- headers/private/servers/app/RenderingBuffer.h | 33 --- headers/private/servers/app/ServerBitmap.h | 150 ------------ headers/private/servers/app/ServerConfig.h | 76 ------ headers/private/servers/app/ServerCursor.h | 72 ------ headers/private/servers/app/ServerFont.h | 173 -------------- headers/private/servers/app/SystemPalette.h | 37 --- 19 files changed, 2107 deletions(-) delete mode 100644 headers/private/servers/app/BitmapManager.h delete mode 100644 headers/private/servers/app/ColorSet.h delete mode 100644 headers/private/servers/app/CursorSet.h delete mode 100644 headers/private/servers/app/Decorator.h delete mode 100644 headers/private/servers/app/DisplaySupport.h delete mode 100644 headers/private/servers/app/DrawState.h delete mode 100644 headers/private/servers/app/DrawingEngine.h delete mode 100644 headers/private/servers/app/FontFamily.h delete mode 100644 headers/private/servers/app/FontManager.h delete mode 100644 headers/private/servers/app/HashTable.h delete mode 100644 headers/private/servers/app/PatternHandler.h delete mode 100644 headers/private/servers/app/RGBColor.h delete mode 100644 headers/private/servers/app/ReferenceCounting.h delete mode 100644 headers/private/servers/app/RenderingBuffer.h delete mode 100644 headers/private/servers/app/ServerBitmap.h delete mode 100644 headers/private/servers/app/ServerConfig.h delete mode 100644 headers/private/servers/app/ServerCursor.h delete mode 100644 headers/private/servers/app/ServerFont.h delete mode 100644 headers/private/servers/app/SystemPalette.h diff --git a/headers/private/servers/app/BitmapManager.h b/headers/private/servers/app/BitmapManager.h deleted file mode 100644 index 74ed2ba983..0000000000 --- a/headers/private/servers/app/BitmapManager.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - */ -#ifndef BITMAP_MANAGER_H -#define BITMAP_MANAGER_H - - -#include -#include -#include -#include -#include - -class ClientMemoryAllocator; -class ServerBitmap; - -class BitmapManager { - public: - BitmapManager(); - virtual ~BitmapManager(); - - ServerBitmap* CreateBitmap(ClientMemoryAllocator* allocator, BRect bounds, - color_space space, int32 flags, int32 bytesPerRow = -1, - screen_id screen = B_MAIN_SCREEN_ID, - int8* _allocationType = NULL); - void DeleteBitmap(ServerBitmap* bitmap); - - protected: - BList fBitmapList; - BLocker fLock; -}; - -extern BitmapManager *gBitmapManager; - -#endif /* BITMAP_MANAGER_H */ diff --git a/headers/private/servers/app/ColorSet.h b/headers/private/servers/app/ColorSet.h deleted file mode 100644 index 8fe8a72fdd..0000000000 --- a/headers/private/servers/app/ColorSet.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - */ -#ifndef COLOR_SET_H -#define COLOR_SET_H - - -#include -#include -#include -#include - - -/*! - \class ColorSet ColorSet.h - \brief Encapsulates GUI system colors -*/ -class ColorSet : public BLocker { - public: - ColorSet(); - ColorSet(const ColorSet &cs); - ColorSet & operator=(const ColorSet &cs); - - void SetColors(const ColorSet &cs); - void PrintToStream(void) const; - - bool ConvertToMessage(BMessage *msg) const; - bool ConvertFromMessage(const BMessage *msg); - - void SetToDefaults(void); - - rgb_color StringToColor(const char *string); - rgb_color AttributeToColor(int32 which); - - status_t SetColor(const char *string, rgb_color value); - - static status_t LoadColorSet(const char *path, ColorSet *set); - static status_t SaveColorSet(const char *path, const ColorSet &set); - - rgb_color panel_background, - panel_text, - - document_background, - document_text, - - control_background, - control_text, - control_highlight, - control_border, - - tooltip_background, - tooltip_text, - - menu_background, - menu_selected_background, - menu_text, - menu_selected_text, - menu_selected_border, - - keyboard_navigation_base, - keyboard_navigation_pulse, - - success, - failure, - shine, - shadow, - window_tab, - - // Not all of these guys do exist in InterfaceDefs.h, - // but we keep them as part of the color set anyway - - // they're important nonetheless - window_tab_text, - inactive_window_tab, - inactive_window_tab_text; - - private: - rgb_color *StringToMember(const char *string); - void PrintMember(const rgb_color &color) const; -}; - -#endif // COLOR_SET_H diff --git a/headers/private/servers/app/CursorSet.h b/headers/private/servers/app/CursorSet.h deleted file mode 100644 index d79a30354c..0000000000 --- a/headers/private/servers/app/CursorSet.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - */ -#ifndef CURSOR_SET_H -#define CURSOR_SET_H - - -#include -#include -#include - - -typedef enum { - B_CURSOR_DEFAULT = 1, - B_CURSOR_TEXT, - B_CURSOR_MOVE, - B_CURSOR_DRAG, - B_CURSOR_RESIZE, - B_CURSOR_RESIZE_NWSE, - B_CURSOR_RESIZE_NESW, - B_CURSOR_RESIZE_NS, - B_CURSOR_RESIZE_EW, - B_CURSOR_OTHER, - B_CURSOR_APP, - B_CURSOR_INVALID -} cursor_which; - -class ServerCursor; - - -/*! - \brief Class to manage system cursor sets -*/ -class CursorSet : public BMessage { - public: - CursorSet(const char *name); - - status_t Save(const char *path,int32 saveflags=0); - status_t Load(const char *path); - status_t AddCursor(cursor_which which,const BBitmap *cursor, const BPoint &hotspot); - status_t AddCursor(cursor_which which, uint8 *data); - void RemoveCursor(cursor_which which); - status_t FindCursor(cursor_which which, BBitmap **cursor, BPoint *hotspot); - status_t FindCursor(cursor_which which, ServerCursor **cursor); - void SetName(const char *name); - const char *GetName(void); - - private: - const char *_CursorWhichToString(cursor_which which); - BBitmap *_CursorDataToBitmap(uint8 *data); -}; - -#endif // CURSOR_SET_H diff --git a/headers/private/servers/app/Decorator.h b/headers/private/servers/app/Decorator.h deleted file mode 100644 index 0f8c0c3ec3..0000000000 --- a/headers/private/servers/app/Decorator.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Stephan Aßmus - */ -#ifndef _DECORATOR_H_ -#define _DECORATOR_H_ - - -#include -#include -#include -#include - -#include "ColorSet.h" -#include "DrawState.h" - -class DesktopSettings; -class DrawingEngine; -class ServerFont; -class BRegion; - - -typedef enum { - DEC_NONE = 0, - DEC_ZOOM, - DEC_CLOSE, - DEC_MINIMIZE, - DEC_TAB, - DEC_DRAG, - DEC_MOVETOBACK, - DEC_SLIDETAB, - - DEC_RESIZE, - CLICK_RESIZE_L, - CLICK_RESIZE_T, - CLICK_RESIZE_R, - CLICK_RESIZE_B, - CLICK_RESIZE_LT, - CLICK_RESIZE_RT, - CLICK_RESIZE_LB, - CLICK_RESIZE_RB -} click_type; - -class Decorator { - public: - Decorator(DesktopSettings& settings, BRect rect, - window_look look, uint32 flags); - virtual ~Decorator(); - - void SetColors(const ColorSet &cset); - void SetDriver(DrawingEngine *driver); - void SetFont(ServerFont *font); - - virtual void SetLook(DesktopSettings& settings, - window_look look, BRegion* updateRegion = NULL); - virtual void SetFlags(uint32 flags, BRegion* updateRegion = NULL); - - void SetClose(bool pressed); - void SetMinimize(bool pressed); - void SetZoom(bool pressed); - - virtual void SetTitle(const char* string, BRegion* updateRegion = NULL); - - window_look Look() const; - uint32 Flags() const; - - const char* Title() const; - - // we need to know its border(frame). WinBorder's _frame rect - // must expand to include Decorator borders. Otherwise we can't - // draw the border. We also add TabRect because I feel we'll need it - BRect BorderRect() const; - BRect TabRect() const; - - bool GetClose(); - bool GetMinimize(); - bool GetZoom(); - - virtual void GetSizeLimits(int32* minWidth, int32* minHeight, - int32* maxWidth, int32* maxHeight) const; - - void SetFocus(bool focussed); - bool IsFocus() - { return fIsFocused; }; - ColorSet Colors() - { return (_colors) ? *_colors : ColorSet(); } - - virtual void GetFootprint(BRegion *region); - - virtual click_type Clicked(BPoint pt, int32 buttons, - int32 modifiers); - - void MoveBy(float x, float y); - virtual void MoveBy(BPoint pt); - void ResizeBy(float x, float y, BRegion* dirty); - virtual void ResizeBy(BPoint pt, BRegion* dirty) = 0; - - virtual void SetTabLocation(float location) {} - virtual float TabLocation() const - { return 0.0; } - - virtual void Draw(BRect r); - virtual void Draw(); - virtual void DrawClose(); - virtual void DrawFrame(); - virtual void DrawMinimize(); - virtual void DrawTab(); - virtual void DrawTitle(); - virtual void DrawZoom(); - - protected: - int32 _ClipTitle(float width); - - /*! - \brief Returns the number of characters in the title - \return The title character count - */ - int32 _TitleWidth() const - { return fTitle.CountChars(); } - - virtual void _DoLayout(); - - virtual void _DrawFrame(BRect r); - virtual void _DrawTab(BRect r); - - virtual void _DrawClose(BRect r); - virtual void _DrawTitle(BRect r); - virtual void _DrawZoom(BRect r); - virtual void _DrawMinimize(BRect r); - - virtual void _SetFocus(); - virtual void _SetColors(); - - ColorSet* _colors; - DrawingEngine* _driver; - DrawState fDrawState; - - window_look fLook; - uint32 fFlags; - - BRect _zoomrect; - BRect _closerect; - BRect _minimizerect; - BRect _tabrect; - BRect _frame; - BRect _resizerect; - BRect _borderrect; - - private: - bool fClosePressed; - bool fZoomPressed; - bool fMinimizePressed; - - bool fIsFocused; - - BString fTitle; -}; - -// add-on stuff -typedef float get_version(void); -typedef Decorator* create_decorator(DesktopSettings& desktopSettings, BRect rect, - window_look look, uint32 flags); - -#endif /* _DECORATOR_H_ */ diff --git a/headers/private/servers/app/DisplaySupport.h b/headers/private/servers/app/DisplaySupport.h deleted file mode 100644 index 267d22f094..0000000000 --- a/headers/private/servers/app/DisplaySupport.h +++ /dev/null @@ -1,161 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, Haiku, Inc. -// -// 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: DisplaySupport.h -// Author: DarkWyrm -// Gabe Yoder -// Description: Support classes for the DisplayDriver class -// -//------------------------------------------------------------------------------ -#ifndef DDRIVER_SUPPORT_H_ -#define DDRIVER_SUPPORT_H_ - -#include -#include -#include "ServerBitmap.h" - -class BezierCurve -{ -public: - BezierCurve(BPoint* pts); - ~BezierCurve(); - BPoint* GetPointArray(); - BList points; - BRect Frame(void) const { return fFrame; } -private: - void GenerateFrame(BPoint *pts); - int GeneratePoints(int startPos); - BPoint* pointArray; - BRect fFrame; -}; - -struct integer_rect -{ - int32 x; - int32 y; - int32 w; - int32 h; -}; - -struct integer_scaling_info -{ - int32 k; -}; - -static inline void BRect_to_integer_rect(BRect source_rect, integer_rect &dest_rect) -{ - dest_rect.x = (int32)source_rect.left; - dest_rect.y = (int32)source_rect.top; - dest_rect.w = (int32)(source_rect.right - source_rect.left) + 1; - dest_rect.h = (int32)(source_rect.bottom - source_rect.top) + 1; -} - -static inline integer_rect BRect_to_integer_rect(BRect source_rect) -{ - integer_rect dest_rect; - dest_rect.x = (int32)source_rect.left; - dest_rect.y = (int32)source_rect.top; - dest_rect.w = (int32)(source_rect.right - source_rect.left) + 1; - dest_rect.h = (int32)(source_rect.bottom - source_rect.top) + 1; - return dest_rect; -} - -class Blitter -{ -public: - Blitter(); - void draw_8_to_8(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - void draw_8_to_16(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - void draw_8_to_32(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - - void draw_16_to_8(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - void draw_16_to_16(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - void draw_16_to_32(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - - void draw_32_to_8(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - void draw_32_to_16(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - void draw_32_to_32(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - - void draw_none(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor) {} - void Draw(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - - void Select(int32 source_bits_per_pixel, int32 dest_bits_per_pixel); - - drawing_mode GetDrawMode() const { return mode; } - void SetDrawMode(drawing_mode draw_mode) { mode = draw_mode; } - -private: - void (Blitter::*DrawFunc)(uint8 *src, uint8 *dst, int32 width, int32 xscale_position, int32 xscale_factor); - drawing_mode mode; -}; - -class LineCalc -{ -public: - LineCalc(); - LineCalc(const BPoint &pta, const BPoint &ptb); - void SetPoints(const BPoint &pta, const BPoint &ptb); - float GetX(float y); - float GetY(float x); - float Slope(void) { return slope; } - float Offset(void) { return offset; } - float MinX() { return minx; } - float MinY() { return miny; } - float MaxX() { return maxx; } - float MaxY() { return maxy; } - void Swap(LineCalc &from); - bool ClipToRect(const BRect &rect); - BPoint GetStart() { return start; } - BPoint GetEnd() { return end; } -private: - float slope; - float offset; - BPoint start, end; - float minx; - float miny; - float maxx; - float maxy; -}; - -/*! - \class FBBitmap DisplayDriver.h - \brief Class used for easily passing around information about the framebuffer -*/ -class FBBitmap : public ServerBitmap -{ -public: - FBBitmap(void) : ServerBitmap(BRect(0,0,0,0),B_NO_COLOR_SPACE,0) { } - ~FBBitmap(void) { } - void SetBytesPerRow(const int32 &bpr) { fBytesPerRow=bpr; } - void SetSpace(const color_space &space) { fSpace=space; } - - // WARNING: - for some reason ServerBitmap adds 1 to the width and height. We do that also. - void SetSize(const int32 &w, const int32 &h) { fWidth=w+1; fHeight=h+1; } - void SetBuffer(void *ptr) { fBuffer=(uint8*)ptr; } - void SetBitsPerPixel(color_space space,int32 bytesperline) { _HandleSpace(space,bytesperline); } - void ShallowCopy(const FBBitmap *from) - { - ServerBitmap::ShallowCopy((ServerBitmap*)from); - SetBuffer(from->Bits()); - } -}; - -#endif diff --git a/headers/private/servers/app/DrawState.h b/headers/private/servers/app/DrawState.h deleted file mode 100644 index ad81ba0936..0000000000 --- a/headers/private/servers/app/DrawState.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Adi Oanca - * Stephan Aßmus - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef _DRAW_STATE_H_ -#define _DRAW_STATE_H_ - - -#include -#include -#include -#include // for B_FONT_ALL - -#include "RGBColor.h" -#include "FontManager.h" -#include "ServerFont.h" -#include "PatternHandler.h" - -class BRegion; - -namespace BPrivate { - class LinkReceiver; - class LinkSender; -}; - - -class DrawState { - public: - DrawState(); - DrawState(const DrawState& from); - virtual ~DrawState(); - - DrawState& operator=(const DrawState& from); - - DrawState* PushState(); - DrawState* PopState(); - DrawState* PreviousState() const { return fPreviousState; } - - void ReadFontFromLink(BPrivate::LinkReceiver& link); - // NOTE: ReadFromLink() does not read Font state!! - // It was separate in ServerWindow, and I didn't - // want to change it without knowing implications. - void ReadFromLink(BPrivate::LinkReceiver& link); - void WriteToLink(BPrivate::LinkSender& link) const; - - // coordinate transformation - void SetOrigin(const BPoint& origin); - void OffsetOrigin(const BPoint& offset); - const BPoint& Origin() const - { return fOrigin; } - - void SetScale(float scale); - float Scale() const - { return fScale; } - - // coordinate transformations - void Transform(float* x, float* y) const; - void InverseTransform(float* x, float* y) const; - - void Transform(BPoint* point) const; - void Transform(BRect* rect) const; - void Transform(BRegion* region) const; - - void InverseTransform(BPoint* point) const; - - // additional clipping as requested by client - void SetClippingRegion(const BRegion* region); - const BRegion* ClippingRegion() const - { return fClippingRegion; } -/* inline int32 CountClippingRects() const - { return fClippingRegion ? fClippingRegion.CountRects() : 0; } - inline BRect ClippingRectAt(int32 index) const;*/ - - // color - void SetHighColor(const RGBColor& color); - const RGBColor& HighColor() const - { return fHighColor; } - - void SetLowColor(const RGBColor& color); - const RGBColor& LowColor() const - { return fLowColor; } - - void SetPattern(const Pattern& pattern); - const Pattern& GetPattern() const - { return fPattern; } - - // drawing/blending mode - void SetDrawingMode(drawing_mode mode); - drawing_mode GetDrawingMode() const - { return fDrawingMode; } - - void SetBlendingMode(source_alpha srcMode, - alpha_function fncMode); - source_alpha AlphaSrcMode() const - { return fAlphaSrcMode; } - alpha_function AlphaFncMode() const - { return fAlphaFncMode; } - - // pen - void SetPenLocation(const BPoint& location); - const BPoint& PenLocation() const; - - void SetPenSize(float size); - float PenSize() const; - - // font - void SetFont(const ServerFont& font, - uint32 flags = B_FONT_ALL); - const ServerFont& Font() const - { return fFont; } - - // overrides aliasing flag contained in SeverFont::Flags()) - void SetForceFontAliasing(bool aliasing); - bool ForceFontAliasing() const - { return fFontAliasing; } - - // postscript style settings - void SetLineCapMode(cap_mode mode); - cap_mode LineCapMode() const - { return fLineCapMode; } - - void SetLineJoinMode(join_mode mode); - join_mode LineJoinMode() const - { return fLineJoinMode; } - - void SetMiterLimit(float limit); - float MiterLimit() const - { return fMiterLimit; } - - // convenience functions - void PrintToStream() const; - - void SetSubPixelPrecise(bool precise); - bool SubPixelPrecise() const - { return fSubPixelPrecise; } - - protected: - BPoint fOrigin; - float fScale; - - BRegion* fClippingRegion; - - RGBColor fHighColor; - RGBColor fLowColor; - Pattern fPattern; - - drawing_mode fDrawingMode; - source_alpha fAlphaSrcMode; - alpha_function fAlphaFncMode; - - BPoint fPenLocation; - float fPenSize; - - ServerFont fFont; - // overrides font aliasing flag - bool fFontAliasing; - - // This is not part of the normal state stack. - // Layer will update it in PushState/PopState. - // A BView can have a flag "B_SUBPIXEL_PRECISE", - // I never knew what it does on R5, but I can use - // it in Painter to actually draw stuff with - // sub-pixel coordinates. It means - // StrokeLine(BPoint(10, 5), BPoint(20, 9)); - // will look different from - // StrokeLine(BPoint(10.3, 5.8), BPoint(20.6, 9.5)); - bool fSubPixelPrecise; - - cap_mode fLineCapMode; - join_mode fLineJoinMode; - float fMiterLimit; - // "internal", used to calculate the size - // of the font (again) when the scale changes - float fUnscaledFontSize; - - DrawState* fPreviousState; -}; - - -// inline implementations - -/* -// ClippingRectAt -BRect -DrawState::ClippingRectAt(int32 index) const -{ - BRect r; - if (fClippingRegion) { - r = fClippingRegion.RectAt(index); - } - return r; -}*/ - -#endif /* _DRAW_STATE_H_ */ diff --git a/headers/private/servers/app/DrawingEngine.h b/headers/private/servers/app/DrawingEngine.h deleted file mode 100644 index 48dc29b814..0000000000 --- a/headers/private/servers/app/DrawingEngine.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2001-2005, Haiku, Inc. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Gabe Yoder - * Stephan Aßmus - */ -#ifndef DRAWING_ENGINE_H_ -#define DRAWING_ENGINE_H_ - - -#include -#include -#include -#include - -class BPoint; -class BRect; -class BRegion; - -class DrawState; -class HWInterface; -class Painter; -class RGBColor; -class ServerBitmap; -class ServerCursor; -class ServerFont; - -typedef struct { - BPoint pt1; - BPoint pt2; - rgb_color color; - -} LineArrayData; - -class DrawingEngine { -public: - DrawingEngine(HWInterface* interface = NULL); - virtual ~DrawingEngine(); - - // when implementing, be sure to call the inherited version - status_t Initialize(); - void Shutdown(); - - // locking - bool Lock(); - void Unlock(); - - bool WriteLock(); - void WriteUnlock(); - - // for "changing" hardware - void Update(); - - void SetHWInterface(HWInterface* interface); - - // for screen shots - bool DumpToFile(const char *path); - ServerBitmap* DumpToBitmap(); - status_t ReadBitmap(ServerBitmap *bitmap, bool drawCursor, - BRect bounds); - - // clipping for all drawing functions, passing a NULL region - // will remove any clipping (drawing allowed everywhere) - void ConstrainClippingRegion(const BRegion* region); - - // drawing functions - void CopyRegion(/*const*/ BRegion* region, - int32 xOffset, int32 yOffset); - - void InvertRect(BRect r); - - void DrawBitmap(ServerBitmap *bitmap, - const BRect &source, const BRect &dest, - const DrawState *d); - // drawing primitives - - void DrawArc(BRect r, const float &angle, - const float &span, - const DrawState *d, - bool filled); - - void DrawBezier(BPoint *pts, const DrawState *d, - bool filled); - - void DrawEllipse(BRect r, const DrawState *d, - bool filled); - - void DrawPolygon(BPoint *ptlist, int32 numpts, - BRect bounds, const DrawState *d, - bool filled, bool closed); - - // this version used by Decorator - void StrokeRect(BRect r, const RGBColor &color); - void FillRect(BRect r, const RGBColor &color); - - void StrokeRect(BRect r, const DrawState *d); - void FillRect(BRect r, const DrawState *d); - - // for debugging purposes? -// void StrokeRegion(BRegion &r, const DrawState *d); - - void FillRegion(BRegion &r, const DrawState *d); - void FillRegion(BRegion &r, const RGBColor& color); - - void DrawRoundRect(BRect r, float xrad, - float yrad, const DrawState *d, - bool filled); - - void DrawShape(const BRect &bounds, - int32 opcount, const uint32 *oplist, - int32 ptcount, const BPoint *ptlist, - const DrawState *d, bool filled); - - void DrawTriangle(BPoint *pts, const BRect &bounds, - const DrawState *d, bool filled); - - // this version used by Decorator - void StrokeLine(const BPoint &start, - const BPoint &end, const RGBColor &color); - - void StrokeLine(const BPoint &start, - const BPoint &end, DrawState *d); - - void StrokeLineArray(int32 numlines, - const LineArrayData *data, - const DrawState *d); - - // this version used by Decorator - void StrokePoint(const BPoint &pt, - const RGBColor &color); - - void StrokePoint(const BPoint &pt, - DrawState *d); - - // -------- text related calls - - // DrawState is NOT const because this call updates the pen position in the passed DrawState - BPoint DrawString(const char* string, int32 length, - const BPoint& pt, DrawState* d, - escapement_delta* delta = NULL); - - float StringWidth(const char* string, int32 length, - const DrawState* d, - escapement_delta* delta = NULL); - - float StringWidth(const char* string, - int32 length, const ServerFont& font, - escapement_delta* delta = NULL); - - float StringHeight(const char* string, - int32 length, const DrawState* d); - - private: - BRect _CopyRect(BRect r, int32 xOffset, - int32 yOffset) const; - - void _CopyRect(uint8* bits, uint32 width, - uint32 height, uint32 bytesPerRow, - int32 xOffset, int32 yOffset) const; - - Painter* fPainter; - HWInterface* fGraphicsCard; - uint32 fAvailableHWAccleration; -}; - -#endif // DRAWING_ENGINE_H_ diff --git a/headers/private/servers/app/FontFamily.h b/headers/private/servers/app/FontFamily.h deleted file mode 100644 index b513a9c73f..0000000000 --- a/headers/private/servers/app/FontFamily.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef FONT_FAMILY_H_ -#define FONT_FAMILY_H_ - - -#include -#include -#include -#include -#include -#include - -#include -#include FT_FREETYPE_H -#include "ReferenceCounting.h" -#include "HashTable.h" - - -struct node_ref; -class FontFamily; -class ServerFont; - -enum font_format { - FONT_TRUETYPE = 0, - FONT_TYPE_1, - FONT_OPENTYPE, - FONT_BDF, - FONT_CFF, - FONT_CID, - FONT_PCF, - FONT_PFR, - FONT_SFNT, - FONT_TYPE_42, - FONT_WINFONT, -}; - - -class FontKey : public Hashable { - public: - FontKey(uint16 familyID, uint16 styleID) - : fHash(familyID | (styleID << 16UL)) - { - } - - virtual uint32 Hash() const - { return fHash; } - virtual bool CompareTo(Hashable& other) const - { return fHash == other.Hash(); } - - private: - uint32 fHash; -}; - - -/*! - \class FontStyle FontFamily.h - \brief Object used to represent a font style - - FontStyle objects help abstract a lot of the font engine details while - still offering plenty of information the style in question. -*/ -class FontStyle : public ReferenceCounting, public Hashable/*, public BLocker*/ { - public: - FontStyle(node_ref& nodeRef, const char* path, FT_Face face); - virtual ~FontStyle(); - - virtual uint32 Hash() const; - virtual bool CompareTo(Hashable& other) const; - - const node_ref& NodeRef() const { return fNodeRef; } - - bool Lock(); - void Unlock(); - -/*! - \fn bool FontStyle::IsFixedWidth(void) - \brief Determines whether the font's character width is fixed - \return true if fixed, false if not -*/ - bool IsFixedWidth() const - { return fFreeTypeFace->face_flags & FT_FACE_FLAG_FIXED_WIDTH; } -/*! - \fn bool FontStyle::IsScalable(void) - \brief Determines whether the font can be scaled to any size - \return true if scalable, false if not -*/ - bool IsScalable() const - { return fFreeTypeFace->face_flags & FT_FACE_FLAG_SCALABLE; } -/*! - \fn bool FontStyle::HasKerning(void) - \brief Determines whether the font has kerning information - \return true if kerning info is available, false if not -*/ - bool HasKerning() const - { return fFreeTypeFace->face_flags & FT_FACE_FLAG_KERNING; } -/*! - \fn bool FontStyle::HasTuned(void) - \brief Determines whether the font contains strikes - \return true if it has strikes included, false if not -*/ - bool HasTuned() const - { return fFreeTypeFace->num_fixed_sizes > 0; } -/*! - \fn bool FontStyle::TunedCount(void) - \brief Returns the number of strikes the style contains - \return The number of strikes the style contains -*/ - int32 TunedCount() const - { return fFreeTypeFace->num_fixed_sizes; } -/*! - \fn bool FontStyle::GlyphCount(void) - \brief Returns the number of glyphs in the style - \return The number of glyphs the style contains -*/ - uint16 GlyphCount() const - { return fFreeTypeFace->num_glyphs; } -/*! - \fn bool FontStyle::CharMapCount(void) - \brief Returns the number of character maps the style contains - \return The number of character maps the style contains -*/ - uint16 CharMapCount() const - { return fFreeTypeFace->num_charmaps; } - - const char* Name() const - { return fName.String(); } - FontFamily* Family() const - { return fFamily; } - uint16 ID() const - { return fID; } - uint32 Flags() const; - - uint16 Face() const - { return fFace; } - uint16 PreservedFace(uint16) const; - - const char* Path() const; - void GetHeight(float size, font_height &heigth) const; - font_direction Direction() const - { return B_FONT_LEFT_TO_RIGHT; } - font_file_format FileFormat() const - { return B_TRUETYPE_WINDOWS; } - - FT_Face FreeTypeFace() const - { return fFreeTypeFace; } - - status_t UpdateFace(FT_Face face); - -// TODO: Re-enable when I understand how the FT2 Cache system changed from -// 2.1.4 to 2.1.8 -// int16 ConvertToUnicode(uint16 c); - - private: - friend class FontFamily; - uint16 _TranslateStyleToFace(const char *name) const; - void _SetFontFamily(FontFamily* family, uint16 id); - - private: - FT_Face fFreeTypeFace; - BString fName; - BString fPath; - node_ref fNodeRef; - - FontFamily* fFamily; - uint16 fID; - - BRect fBounds; - - font_height fHeight; - uint16 fFace; -}; - -/*! - \class FontFamily FontFamily.h - \brief Class representing a collection of similar styles - - FontFamily objects bring together many styles of the same face, such as - Arial Roman, Arial Italic, Arial Bold, etc. -*/ -class FontFamily { - public: - FontFamily(const char* name, uint16 id); - virtual ~FontFamily(); - - const char* Name() const; - - bool AddStyle(FontStyle* style); - bool RemoveStyle(FontStyle* style); - - FontStyle* GetStyle(const char* style) const; - FontStyle* GetStyleMatchingFace(uint16 face) const; - FontStyle* GetStyleByID(uint16 face) const; - - uint16 ID() const - { return fID; } - uint32 Flags(); - - bool HasStyle(const char* style) const; - int32 CountStyles() const; - FontStyle* StyleAt(int32 index) const; - - private: - BString fName; - BObjectList fStyles; - uint16 fID; - uint16 fNextID; - uint32 fFlags; -}; - -#endif /* FONT_FAMILY_H_ */ diff --git a/headers/private/servers/app/FontManager.h b/headers/private/servers/app/FontManager.h deleted file mode 100644 index 1cd34d7487..0000000000 --- a/headers/private/servers/app/FontManager.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef FONT_MANAGER_H -#define FONT_MANAGER_H - - -#include "HashTable.h" - -#include -#include - -#include -#include FT_FREETYPE_H - -class BPath; - -class FontFamily; -class FontStyle; -class ServerFont; - - -/*! - \class FontManager FontManager.h - \brief Manager for the largest part of the font subsystem -*/ -class FontManager : public BLooper { - public: - FontManager(); - virtual ~FontManager(); - - status_t InitCheck() { return fInitStatus; } - void SaveRecentFontMappings(); - - virtual void MessageReceived(BMessage* message); - - int32 CheckRevision(uid_t user); - int32 CountFamilies(); - - int32 CountStyles(const char *family); - FontFamily* FamilyAt(int32 index) const; - - FontFamily *GetFamily(uint16 familyID) const; - FontFamily *GetFamily(const char *name); - - FontStyle *GetStyleByIndex(const char *family, int32 index); - FontStyle *GetStyle(const char *family, const char *style, uint16 familyID = 0xffff, - uint16 styleID = 0xffff, uint16 face = 0); - FontStyle *GetStyle(const char *family, uint16 styleID); - FontStyle *GetStyle(uint16 familyID, uint16 styleID) const; - FontStyle* FindStyleMatchingFace(uint16 face) const; - - void RemoveStyle(FontStyle* style); - // this call must not be used by anything else than class FontStyle - - const ServerFont* DefaultPlainFont() const; - const ServerFont* DefaultBoldFont() const; - const ServerFont* DefaultFixedFont() const; - - void AttachUser(uid_t userID); - void DetachUser(uid_t userID); - - private: - struct font_directory; - struct font_mapping; - - void _AddDefaultMapping(const char* family, const char* style, const char* path); - bool _LoadRecentFontMappings(); - status_t _AddMappedFont(const char* family, const char* style = NULL); - FontStyle* _GetDefaultStyle(const char* familyName, const char* styleName, - const char* fallbackFamily, const char* fallbackStyle, - uint16 fallbackFace); - status_t _SetDefaultFonts(); - void _AddSystemPaths(); - font_directory* _FindDirectory(node_ref& nodeRef); - void _RemoveDirectory(font_directory* directory); - status_t _CreateDirectories(const char* path); - status_t _AddPath(const char* path); - status_t _AddPath(BEntry& entry, font_directory** _newDirectory = NULL); - - void _RemoveStyle(font_directory& directory, FontStyle* style); - void _RemoveStyle(dev_t device, uint64 directory, uint64 node); - FontFamily* _FindFamily(const char* family) const; - - void _ScanFontsIfNecessary(); - void _ScanFonts(); - status_t _ScanFontDirectory(font_directory& directory); - status_t _AddFont(font_directory& directory, BEntry& entry); - - FT_CharMap _GetSupportedCharmap(const FT_Face &face); - - private: - status_t fInitStatus; - BObjectList fDirectories; - BObjectList fMappings; - BObjectList fFamilies; - HashTable fStyleHashTable; - ServerFont* fDefaultPlainFont; - ServerFont* fDefaultBoldFont; - ServerFont* fDefaultFixedFont; - bool fScanned; - int32 fNextID; -}; - -extern FT_Library gFreeTypeLibrary; -extern FontManager *gFontManager; - -#endif /* FONT_MANAGER_H */ diff --git a/headers/private/servers/app/HashTable.h b/headers/private/servers/app/HashTable.h deleted file mode 100644 index 6c50f77699..0000000000 --- a/headers/private/servers/app/HashTable.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef _HASH_TABLE_H_ -#define _HASH_TABLE_H_ - - -#include - - -class Hashable { - public: - virtual uint32 Hash() const = 0; - virtual bool CompareTo(Hashable& hashable) const = 0; -}; - -class HashTable { - public: - HashTable(bool owning = false, int32 capacity = 100, float loadFactor = 0.75); - ~HashTable(); - - void MakeEmpty(bool deleteValues = true); - bool IsEmpty() const { return fCount == 0; } - bool ContainsKey(Hashable& key) const { return _GetHashEntry(key) != NULL; } - int32 CountItems() const { return fCount; } - - Hashable *GetValue(Hashable& key) const; - - bool AddItem(Hashable* value); - Hashable *RemoveItem(Hashable& key); - - protected: - struct entry; - - bool _Rehash(); - entry *_GetHashEntry(Hashable& key) const; - - entry** fTable; - int32 fCapacity, fCount, fThreshold; - float fLoadFactor; - bool fOwning; -}; - -#endif /* HASHTABLE_H */ diff --git a/headers/private/servers/app/PatternHandler.h b/headers/private/servers/app/PatternHandler.h deleted file mode 100644 index 3167d78668..0000000000 --- a/headers/private/servers/app/PatternHandler.h +++ /dev/null @@ -1,196 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// 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: PatternHandler.h -// Author: DarkWyrm -// Stephan Aßmus -// Description: Class for easy calculation and use of patterns -// -//------------------------------------------------------------------------------ -#ifndef PATTERNHANDLER_H -#define PATTERNHANDLER_H - -#include -#include -#include "RGBColor.h" - -class Pattern { - public: - - Pattern(void) {} - - Pattern(const uint64& p) - { fPattern.type64 = p; } - - Pattern(const int8* p) - { fPattern.type64 = *((const uint64*)p); } - - Pattern(const Pattern& src) - { fPattern.type64 = src.fPattern.type64; } - - Pattern(const pattern& src) - { fPattern.type64 = *(uint64*)src.data; } - - inline const int8* GetInt8(void) const - { return fPattern.type8; } - - inline uint64 GetInt64(void) const - { return fPattern.type64; } - - inline void Set(const int8* p) - { fPattern.type64 = *((const uint64*)p); } - - inline void Set(const uint64& p) - { fPattern.type64 = p; } - - Pattern& operator=(const Pattern& from) - { fPattern.type64 = from.fPattern.type64; return *this; } - - Pattern& operator=(const int64 &from) - { fPattern.type64 = from; return *this; } - - Pattern& operator=(const pattern &from) - { memcpy(&fPattern.type64, &from, sizeof(pattern)); return *this; } - - bool operator==(const Pattern& other) const - { return fPattern.type64 == other.fPattern.type64; } - - bool operator==(const pattern& other) const - { return fPattern.type64 == *(uint64*)other.data; } - - private: - - typedef union - { - uint64 type64; - int8 type8[8]; - } pattern_union; - - pattern_union fPattern; -}; - -extern const Pattern kSolidHigh; -extern const Pattern kSolidLow; -extern const Pattern kMixedColors; - -/*! - \brief Class for easy calculation and use of patterns - - PatternHandlers are designed specifically for DisplayDriver subclasses. - Pattern support can be easily added by setting the pattern to use via - SetTarget, and then merely retrieving the value for the coordinates - specified. -*/ -class PatternHandler { - public: - PatternHandler(void); - PatternHandler(const int8* p); - PatternHandler(const uint64& p); - PatternHandler(const Pattern& p); - PatternHandler(const PatternHandler& other); - virtual ~PatternHandler(void); - - void SetPattern(const int8* p); - void SetPattern(const uint64& p); - void SetPattern(const Pattern& p); - void SetPattern(const pattern& p); - - void SetColors(const RGBColor& high, const RGBColor& low); - void SetHighColor(const RGBColor& color); - void SetLowColor(const RGBColor& color); - - void SetColors(const rgb_color& high, const rgb_color& low); - void SetHighColor(const rgb_color& color); - void SetLowColor(const rgb_color& color); - - - RGBColor HighColor() const - { return fHighColor; } - RGBColor LowColor() const - { return fLowColor; } - - RGBColor ColorAt(const BPoint& pt) const; - RGBColor ColorAt(float x, float y) const; - inline RGBColor ColorAt(int x, int y) const; - // TODO: any ideas for a better name of the rgb_color version of this function? - inline rgb_color R5ColorAt(int x, int y) const; - - bool IsHighColor(const BPoint& pt) const; - inline bool IsHighColor(int x, int y) const; - inline bool IsSolidHigh() const - { return fPattern == B_SOLID_HIGH; } - inline bool IsSolidLow() const - { return fPattern == B_SOLID_LOW; } - inline bool IsSolid() const - { return IsSolidHigh() || IsSolidLow(); } - - const pattern* GetR5Pattern(void) const - { return (const pattern*)fPattern.GetInt8(); } - const Pattern& GetPattern(void) const - { return fPattern; } - private: - Pattern fPattern; - RGBColor fHighColor; - RGBColor fLowColor; -}; - -/*! - \brief Obtains the color in the pattern at the specified coordinates - \param x X coordinate to get the color for - \param y Y coordinate to get the color for - \return Color for the coordinates -*/ -inline RGBColor -PatternHandler::ColorAt(int x, int y) const -{ - return IsHighColor(x, y) ? fHighColor : fLowColor; -} - -/*! - \brief Obtains the color in the pattern at the specified coordinates - \param x X coordinate to get the color for - \param y Y coordinate to get the color for - \return Color for the coordinates -*/ -inline rgb_color -PatternHandler::R5ColorAt(int x, int y) const -{ - return IsHighColor(x, y) ? fHighColor.GetColor32() : fLowColor.GetColor32(); -} - -/*! - \brief Obtains the value of the pattern at the specified coordinates - \param pt Coordinates to get the value for - \return Value for the coordinates - true if high, false if low. -*/ -inline bool -PatternHandler::IsHighColor(int x, int y) const -{ - // TODO: Does this work correctly for - // negative coordinates?!? - const int8* ptr = fPattern.GetInt8(); - int32 value = ptr[y % 8] & (1 << (7 - (x % 8)) ); - - return (value == 0) ? false : true; - -} - -#endif diff --git a/headers/private/servers/app/RGBColor.h b/headers/private/servers/app/RGBColor.h deleted file mode 100644 index 240757e2ae..0000000000 --- a/headers/private/servers/app/RGBColor.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - */ -#ifndef RGB_COLOR_H -#define RGB_COLOR_H - - -#include - - -class RGBColor { - public: - RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=255); - RGBColor(int r, int g, int b, int a=255); - RGBColor(const rgb_color &col); - RGBColor(uint16 col); - RGBColor(uint8 col); - RGBColor(const RGBColor &col); - RGBColor(); - - uint8 GetColor8() const; - uint16 GetColor15() const; - uint16 GetColor16() const; - rgb_color GetColor32() const; - - void SetColor(uint8 r, uint8 g, uint8 b, uint8 a=255); - void SetColor(int r, int g, int b, int a=255); - void SetColor(uint16 color16); - void SetColor(uint8 color8); - void SetColor(const rgb_color &color); - void SetColor(const RGBColor &col); - - const RGBColor & operator=(const RGBColor &col); - const RGBColor & operator=(const rgb_color &col); - bool operator==(const rgb_color &col) const; - bool operator==(const RGBColor &col) const; - - bool IsTransparentMagic() const; - - void PrintToStream() const; - - protected: - rgb_color fColor32; - - // caching - mutable uint16 fColor16; - mutable uint16 fColor15; - mutable uint8 fColor8; - mutable bool fUpdate8; - mutable bool fUpdate15; - mutable bool fUpdate16; -}; - -#endif // RGB_COLOR_H diff --git a/headers/private/servers/app/ReferenceCounting.h b/headers/private/servers/app/ReferenceCounting.h deleted file mode 100644 index 2b8f5435cc..0000000000 --- a/headers/private/servers/app/ReferenceCounting.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef REFERENCE_COUNTING_H -#define REFERENCE_COUNTING_H - - -#include - - -/*! - \class ReferenceCounting ReferenceCounting.h - \brief Base class for reference counting objects - - ReferenceCounting objects track dependencies upon a particular object. In this way, - it is possible to ensure that a shared resource is not deleted if something else - needs it. How the dependency tracking is done largely depends on the child class. -*/ -class ReferenceCounting { - public: - ReferenceCounting() - : fReferenceCount(1) {} - virtual ~ReferenceCounting() {} - - inline void Acquire(); - inline bool Release(); - - private: - int32 fReferenceCount; -}; - - -inline void -ReferenceCounting::Acquire() -{ - atomic_add(&fReferenceCount, 1); -} - -inline bool -ReferenceCounting::Release() -{ - if (atomic_add(&fReferenceCount, -1) == 1) { - delete this; - return true; - } - - return false; -} - -#endif /* REFERENCE_COUNTING_H */ diff --git a/headers/private/servers/app/RenderingBuffer.h b/headers/private/servers/app/RenderingBuffer.h deleted file mode 100644 index c1c706fe4f..0000000000 --- a/headers/private/servers/app/RenderingBuffer.h +++ /dev/null @@ -1,33 +0,0 @@ -// RenderingBuffer.h - -#ifndef RENDERING_BUFFER_H -#define RENDERING_BUFFER_H - -#include -#include - -class RenderingBuffer { - public: - RenderingBuffer() {} - virtual ~RenderingBuffer() {} - - virtual status_t InitCheck() const = 0; - - virtual color_space ColorSpace() const = 0; - virtual void* Bits() const = 0; - virtual uint32 BytesPerRow() const = 0; - // the *count* of the pixels per line - virtual uint32 Width() const = 0; - // the *count* of lines - virtual uint32 Height() const = 0; - - inline uint32 BitsLength() const - { return Height() * BytesPerRow(); } - - inline BRect Bounds() const - { return BRect(0.0, 0.0, - Width() - 1, - Height() - 1); } -}; - -#endif // RENDERING_BUFFER_H diff --git a/headers/private/servers/app/ServerBitmap.h b/headers/private/servers/app/ServerBitmap.h deleted file mode 100644 index 51606a42f8..0000000000 --- a/headers/private/servers/app/ServerBitmap.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - */ -#ifndef SERVER_BITMAP_H -#define SERVER_BITMAP_H - - -#include -#include -#include - - -class BitmapManager; -class ClientMemoryAllocator; - -/*! - \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: - inline bool IsValid() const - { return fInitialized; } - - void Acquire(); - - inline uint8* Bits() const - { return fBuffer; } - inline uint32 BitsLength() const - { return (uint32)(fBytesPerRow * fHeight); } - - inline BRect Bounds() const - { return BRect(0, 0, fWidth - 1, fHeight - 1); } - inline int32 Width() const - { return fWidth; } - inline int32 Height() const - { return fHeight; } - - inline int32 BytesPerRow() const - { return fBytesPerRow; } - inline uint8 BitsPerPixel() const - { return fBitsPerPixel; } - inline color_space ColorSpace() const - { return fSpace; } - - //! Returns the identifier token for the bitmap - inline int32 Token() const - { return fToken; } - - inline void* AllocationCookie() const - { return fAllocationCookie; } - - area_id Area() const; - uint32 AreaOffset() const; - - //! Does a shallow copy of the bitmap passed to it - inline void ShallowCopy(const ServerBitmap *from); - - status_t ImportBits(const void *bits, int32 bitsLength, - int32 bytesPerRow, color_space colorSpace); - status_t ImportBits(const void *bits, int32 bitsLength, - int32 bytesPerRow, color_space colorSpace, - BPoint from, BPoint to, int32 width, - int32 height); - - void PrintToStream(); - -protected: - friend class BitmapManager; - friend class PicturePlayer; - - ServerBitmap(BRect rect, - color_space space, - int32 flags, - int32 bytesPerRow = -1, - screen_id screen = B_MAIN_SCREEN_ID); - ServerBitmap(const ServerBitmap* bmp); - virtual ~ServerBitmap(); - - //! used by the BitmapManager -// inline void _SetBuffer(void *ptr) -// { fBuffer = (uint8*)ptr; } - - bool _Release(); - - void _AllocateBuffer(); - - void _HandleSpace(color_space space, - int32 bytesperline = -1); - - bool fInitialized; - ClientMemoryAllocator* fAllocator; - void* fAllocationCookie; - uint8* fBuffer; - int32 fReferenceCount; - - int32 fWidth; - int32 fHeight; - int32 fBytesPerRow; - color_space fSpace; - int32 fFlags; - int fBitsPerPixel; - int32 fToken; -}; - -class UtilityBitmap : public ServerBitmap { - public: - UtilityBitmap(BRect rect, - color_space space, - int32 flags, - int32 bytesperline = -1, - screen_id screen = B_MAIN_SCREEN_ID); - UtilityBitmap(const ServerBitmap* bmp); - - UtilityBitmap(const uint8* alreadyPaddedData, - uint32 width, - uint32 height, - color_space format); - - - virtual ~UtilityBitmap(); -}; - -// ShallowCopy -void -ServerBitmap::ShallowCopy(const ServerBitmap* from) -{ - if (!from) - return; - - fInitialized = from->fInitialized; - fBuffer = from->fBuffer; - fWidth = from->fWidth; - fHeight = from->fHeight; - fBytesPerRow = from->fBytesPerRow; - fSpace = from->fSpace; - fFlags = from->fFlags; - fBitsPerPixel = from->fBitsPerPixel; - fToken = from->fToken; -} - -#endif // SERVER_BITMAP_H diff --git a/headers/private/servers/app/ServerConfig.h b/headers/private/servers/app/ServerConfig.h deleted file mode 100644 index 99da638dbe..0000000000 --- a/headers/private/servers/app/ServerConfig.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _APPSERVER_CONFIG_H -#define _APPSERVER_CONFIG_H - -// This is defined to place the server in test mode, which modifies certain things like -// system keyboard shortcuts. Note that it is possible, though senseless, to place it in -// regular mode and still use a display driver which depends on the R5 app_server -#ifndef TEST_MODE - #define TEST_MODE 0 -#endif - -// Uncomment this if the DisplayDriver should only rely on drawing functions implemented -// in software even though hardware-accelerated functions are available -// NOTE: everything is software right now (since DisplayDriverPainter) -//#define DISABLE_HARDWARE_ACCELERATION - -// Define this for a quick hack to test some of the drawing functions -//#define DISPLAYDRIVER_TEST_HACK - -// Define this if you want the display driver to emulate the input server. -#if TEST_MODE -# define ENABLE_INPUT_SERVER_EMULATION -#endif - -// This is the application signature of our app_server when running as a -// regular application. When running as the app_server, this is not used. -#define SERVER_SIGNATURE "application/x-vnd.haiku-app-server" - -// ToDo: use find_directory() instead of absolute path names! -// Directory for all app_server-related settings. Must include ending slash. -#define SERVER_SETTINGS_DIR "/boot/home/config/settings/app_server/" - -// Flattened list of usable fonts maintained by the server. The file is a -// flattened BMessage which is used for caching the names when obtained -// by the various font functions. -#define SERVER_FONT_LIST "/boot/home/config/settings/app_server/fontlist" - -// Flattened list of BMessages containing data for each workspace -#define WORKSPACE_DATA_LIST "/boot/home/config/settings/app_server/workspace_settings" - -// folder used to keep saved color sets for the UI - tab color, etc. -#define COLOR_SET_DIR "/boot/home/config/settings/color_sets/" - -// folder used to keep saved cursor sets for the system -#define CURSOR_SET_DIR "/boot/home/config/settings/cursor_sets/" - -// name of the file containing the current UI color settings -#define COLOR_SETTINGS_NAME "system_colors" - -// name of the file containing the current system cursor settings -#define CURSOR_SETTINGS_NAME "system_cursors" - -// name of the file containing the config data for the desktop -#define WORKSPACE_SETTINGS_NAME "workspace_data" - -// Folder for additional window decorators -#define DECORATORS_DIR "/boot/home/config/add-ons/decorators/" - -// These definitions provide the server something to use for default -// system fonts. -# define DEFAULT_PLAIN_FONT_FAMILY "Bitstream Vera Sans" -# define FALLBACK_PLAIN_FONT_FAMILY "Swis721 BT" -# define DEFAULT_PLAIN_FONT_STYLE "Roman" -# define DEFAULT_PLAIN_FONT_SIZE 12.0f -# define DEFAULT_BOLD_FONT_FAMILY "Bitstream Vera Sans" -# define FALLBACK_BOLD_FONT_FAMILY "Swis721 BT" -# define DEFAULT_BOLD_FONT_STYLE "Bold" -# define DEFAULT_BOLD_FONT_SIZE 12.0f -# define DEFAULT_FIXED_FONT_FAMILY "Bitstream Vera Sans Mono" -# define FALLBACK_FIXED_FONT_FAMILY "Courier10 BT" -# define DEFAULT_FIXED_FONT_STYLE "Roman" -# define DEFAULT_FIXED_FONT_SIZE 12.0f -// This is the port capacity for all monitoring objects - ServerApps -// and ServerWindows -#define DEFAULT_MONITOR_PORT_SIZE 30 - -#endif /* _APPSERVER_CONFIG_H */ diff --git a/headers/private/servers/app/ServerCursor.h b/headers/private/servers/app/ServerCursor.h deleted file mode 100644 index 3977321a82..0000000000 --- a/headers/private/servers/app/ServerCursor.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Stephan Aßmus - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef SERVER_CURSOR_H -#define SERVER_CURSOR_H - - -#include "ServerBitmap.h" - -#include -#include - -class ServerApp; -class CursorManager; - - -class ServerCursor : public ServerBitmap { - public: - ServerCursor(BRect r, color_space space, - int32 flags, BPoint hotspot, - int32 bytesperrow = -1, - screen_id screen = B_MAIN_SCREEN_ID); - ServerCursor(const uint8* cursorDataFromR5); - ServerCursor(const uint8* alreadyPaddedData, - uint32 width, uint32 height, - color_space format); - ServerCursor(const ServerCursor* cursor); - - virtual ~ServerCursor(); - - //! Returns the cursor's hot spot - void SetHotSpot(BPoint pt); - BPoint GetHotSpot() const - { return fHotSpot; } - - void SetOwningTeam(team_id tid) - { fOwningTeam = tid; } - team_id OwningTeam() const - { return fOwningTeam; } - - int32 Token() const - { return fToken; } - - void Acquire() - { atomic_add(&fReferenceCount, 1); } - bool Release(); - - void SetPendingViewCursor(bool pending); - - void AttachedToManager(CursorManager* manager); - - const uint8* CursorData() const - { return fCursorData; } - - private: - friend class CursorManager; - - BPoint fHotSpot; - team_id fOwningTeam; - int32 fReferenceCount; - uint8* fCursorData; - CursorManager* fManager; - vint32 fPendingViewCursor; -}; - -#endif // SERVER_CURSOR_H diff --git a/headers/private/servers/app/ServerFont.h b/headers/private/servers/app/ServerFont.h deleted file mode 100644 index 55bf13bb01..0000000000 --- a/headers/private/servers/app/ServerFont.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2001-2005, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Jérôme Duval, jerome.duval@free.fr - * Axel Dörfler, axeld@pinc-software.de - */ -#ifndef SERVER_FONT_H -#define SERVER_FONT_H - - -#include -#include - -#include "FontFamily.h" - -class BShape; -class BString; - - -class ServerFont { - public: - ServerFont(); - ServerFont(FontStyle& style, - float size = 12.0, - float fRotation = 0.0, - float fShear = 90.0, - uint16 flags = 0, - uint8 spacing = B_CHAR_SPACING); - ServerFont(const ServerFont& font); - virtual ~ServerFont(); - - ServerFont &operator=(const ServerFont& font); - - font_direction Direction() const - { return fDirection; } - uint32 Encoding() const - { return fEncoding; } - edge_info Edges() const - { return fEdges; } - uint32 Flags() const - { return fFlags; } - uint32 Spacing() const - { return fSpacing; } - float Shear() const - { return fShear; } - float Rotation() const - { return fRotation; } - float Size() const - { return fSize; } - uint16 Face() const - { return fFace; } - uint32 CountGlyphs() - { return fStyle->GlyphCount(); } - int32 CountTuned(); - - font_file_format FileFormat(); - - const char* Style() const; - const char* Family() const; - const char* Path() const - { return fStyle->Path(); } - - void SetStyle(FontStyle* style); - status_t SetFamilyAndStyle(uint16 familyID, - uint16 styleID); - status_t SetFamilyAndStyle(uint32 fontID); - - uint16 StyleID() const - { return fStyle->ID(); } - uint16 FamilyID() const - { return fStyle->Family()->ID(); } - uint32 GetFamilyAndStyle() const; - - void SetDirection(font_direction dir) - { fDirection = dir; } - void SetEdges(edge_info info) - { fEdges = info; } - void SetEncoding(uint32 encoding) - { fEncoding = encoding; } - void SetFlags(uint32 value) - { fFlags = value; } - void SetSpacing(uint32 value) - { fSpacing = value; } - void SetShear(float value) - { fShear = value; } - void SetSize(float value) - { fSize = value; } - void SetRotation(float value) - { fRotation = value; } - void SetFace(uint32 face); - - bool IsFixedWidth() const - { return fStyle->IsFixedWidth(); } - bool IsScalable() const - { return fStyle->IsScalable(); } - bool HasKerning() const - { return fStyle->HasKerning(); } - bool HasTuned() const - { return fStyle->HasTuned(); } - int32 TunedCount() const - { return fStyle->TunedCount(); } - uint16 GlyphCount() const - { return fStyle->GlyphCount(); } - uint16 CharMapCount() const - { return fStyle->CharMapCount(); } - - - FT_Face GetTransformedFace(bool rotate, bool shear) const; - void PutTransformedFace(FT_Face face) const; - - status_t GetGlyphShapes(const char charArray[], - int32 numChars, BShape *shapeArray[]) const; - - status_t GetHasGlyphs(const char charArray[], - int32 numChars, bool hasArray[]) const; - - status_t GetEdges(const char charArray[], - int32 numChars, edge_info edgeArray[]) const; - - status_t GetEscapements(const char charArray[], - int32 numChars, escapement_delta delta, - BPoint escapementArray[], - BPoint offsetArray[]) const; - - status_t GetEscapements(const char charArray[], - int32 numChars, escapement_delta delta, - float widthArray[]) const; - - status_t GetBoundingBoxesAsString(const char charArray[], - int32 numChars, BRect rectArray[], - bool stringEscapement, font_metric_mode mode, - escapement_delta delta); - - status_t GetBoundingBoxesForStrings(char *charArray[], - int32 lengthArray[], int32 numStrings, - BRect rectArray[], font_metric_mode mode, - escapement_delta deltaArray[]); - - float StringWidth(const char *string, int32 numChars) const; - - bool Lock() const { return fStyle->Lock(); } - void Unlock() const { fStyle->Unlock(); } - - FT_Face GetFTFace() const - { return fStyle->FreeTypeFace(); }; - - BRect BoundingBox(); - void GetHeight(font_height& height) const; - - void TruncateString(BString* inOut, - uint32 mode, - float width) const; - -protected: - friend class FontStyle; - - FontStyle* fStyle; - edge_info fEdges; - float fSize; - float fRotation; - float fShear; - BRect fBounds; - uint32 fFlags; - uint32 fSpacing; - font_direction fDirection; - uint16 fFace; - uint32 fEncoding; -}; - -#endif /* SERVER_FONT_H */ diff --git a/headers/private/servers/app/SystemPalette.h b/headers/private/servers/app/SystemPalette.h deleted file mode 100644 index 967d8b1376..0000000000 --- a/headers/private/servers/app/SystemPalette.h +++ /dev/null @@ -1,37 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, Haiku, Inc. -// -// 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: SystemPalette.h -// Author: DarkWyrm -// Description: One global function to generate the palette which is -// the default BeOS System palette and the variable to go with it -// -//------------------------------------------------------------------------------ -#ifndef _SYSTEM_PALETTE_H_ -#define _SYSTEM_PALETTE_H_ - -#include - -extern void InitializeColorMap(); -extern const rgb_color *SystemPalette(); -extern const color_map *SystemColorMap(); - -#endif