* Removed headers/private/servers/app - everything is in src/servers/app now.
* Removed DisplaySupport.h, wasn't needed anymore. * Removed private color set functions from InterfaceDefs.cpp - we might want something similar, but definitely not like that. * Minor cleanup, added some missing licenses. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16831 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
38a6ea1d98
commit
16ed1e1d15
@ -318,6 +318,22 @@ enum {
|
||||
AS_LAST_CODE
|
||||
};
|
||||
|
||||
// Cursor types, currently they are all private besides the first two
|
||||
enum cursor_which {
|
||||
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
|
||||
};
|
||||
|
||||
// bitmap allocation types
|
||||
enum {
|
||||
kAllocator,
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <AppDefs.h>
|
||||
#include <Cursor.h>
|
||||
|
||||
#include <CursorSet.h>
|
||||
#include <AppServerLink.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
|
@ -18,7 +18,6 @@ if $(RUN_WITHOUT_APP_SERVER) != 0 {
|
||||
}
|
||||
|
||||
UsePrivateHeaders shared app interface kernel ;
|
||||
UsePrivateHeaders [ FDirName servers app ] ;
|
||||
UseHeaders $(TARGET_PRIVATE_KERNEL_HEADERS) : true ;
|
||||
|
||||
SetSubDirSupportedPlatforms haiku libbe_test ;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku, Inc.
|
||||
* Copyright 2001-2006, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -17,11 +17,10 @@
|
||||
#include <Roster.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <Screen.h>
|
||||
#include <String.h>
|
||||
#include <TextView.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
// TODO: remove this header
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <AppServerLink.h>
|
||||
@ -30,7 +29,6 @@
|
||||
#include <input_globals.h>
|
||||
#include <ServerProtocol.h>
|
||||
#include <WidthBuffer.h>
|
||||
#include <ColorSet.h> // for private system colors stuff
|
||||
#include <ColorTools.h>
|
||||
|
||||
#include "moreUTF8.h"
|
||||
@ -862,7 +860,7 @@ count_decorators(void)
|
||||
|
||||
int32 code;
|
||||
int32 count = -1;
|
||||
if (link.FlushWithReply(code) == B_OK)
|
||||
if (link.FlushWithReply(code) == B_OK && code == B_OK)
|
||||
link.Read<int32>(&count);
|
||||
|
||||
return count;
|
||||
@ -882,9 +880,9 @@ get_decorator(void)
|
||||
|
||||
int32 code;
|
||||
int32 index = -1;
|
||||
if (link.FlushWithReply(code) == B_OK)
|
||||
if (link.FlushWithReply(code) == B_OK && code == B_OK)
|
||||
link.Read<int32>(&index);
|
||||
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
@ -899,22 +897,19 @@ status_t
|
||||
get_decorator_name(const int32 &index, BString &name)
|
||||
{
|
||||
BPrivate::AppServerLink link;
|
||||
int32 code;
|
||||
|
||||
link.StartMessage(AS_GET_DECORATOR_NAME);
|
||||
link.Attach<int32>(index);
|
||||
|
||||
if (link.FlushWithReply(code) == B_OK)
|
||||
{
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == B_OK) {
|
||||
char *string;
|
||||
if(link.ReadString(&string)==B_OK)
|
||||
{
|
||||
name=string;
|
||||
delete [] string;
|
||||
if (link.ReadString(&string) == B_OK) {
|
||||
name = string;
|
||||
free(string);
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -943,50 +938,18 @@ get_decorator_preview(const int32 &index, BBitmap *bitmap)
|
||||
status_t
|
||||
set_decorator(const int32 &index)
|
||||
{
|
||||
if(index < 0)
|
||||
if (index < 0)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
|
||||
link.StartMessage(AS_SET_DECORATOR);
|
||||
link.Attach<int32>(index);
|
||||
link.Flush();
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Private function to get the system's GUI colors as a set
|
||||
\param colors The recipient color set
|
||||
*/
|
||||
void
|
||||
get_system_colors(ColorSet *colors)
|
||||
{
|
||||
if (!colors)
|
||||
return;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_UI_COLORS);
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == B_OK)
|
||||
link.Read<ColorSet>(colors);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Private function to set the system's GUI colors all at once
|
||||
\param colors The color set to use
|
||||
*/
|
||||
void
|
||||
set_system_colors(const ColorSet &colors)
|
||||
{
|
||||
BPrivate::AppServerLink link;
|
||||
|
||||
link.StartMessage(AS_SET_UI_COLORS);
|
||||
link.Attach<ColorSet>(colors);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
// These methods were marked with "Danger, will Robinson!" in
|
||||
|
@ -25,7 +25,7 @@ if ! $(HAIKU_COMPATIBLE) {
|
||||
|
||||
SetSubDirSupportedPlatforms haiku libbe_test ;
|
||||
|
||||
UsePrivateHeaders shared app interface input [ FDirName servers app ] ;
|
||||
UsePrivateHeaders shared app interface input ;
|
||||
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) BTextView ] ;
|
||||
|
||||
|
39
src/servers/app/BitmapManager.h
Normal file
39
src/servers/app/BitmapManager.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
*/
|
||||
#ifndef BITMAP_MANAGER_H
|
||||
#define BITMAP_MANAGER_H
|
||||
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <List.h>
|
||||
#include <Locker.h>
|
||||
#include <OS.h>
|
||||
#include <Rect.h>
|
||||
|
||||
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 */
|
85
src/servers/app/ColorSet.h
Normal file
85
src/servers/app/ColorSet.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
*/
|
||||
#ifndef COLOR_SET_H
|
||||
#define COLOR_SET_H
|
||||
|
||||
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Locker.h>
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
/*!
|
||||
\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
|
@ -7,10 +7,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "CursorSet.h"
|
||||
#include "ServerCursor.h"
|
||||
|
||||
#include <AppServerLink.h>
|
||||
#include <CursorSet.h>
|
||||
#include <PortLink.h>
|
||||
#include <ServerCursor.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
#include <OS.h>
|
||||
|
43
src/servers/app/CursorSet.h
Normal file
43
src/servers/app/CursorSet.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
*/
|
||||
#ifndef CURSOR_SET_H
|
||||
#define CURSOR_SET_H
|
||||
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <Cursor.h>
|
||||
#include <Message.h>
|
||||
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
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
|
168
src/servers/app/Decorator.h
Normal file
168
src/servers/app/Decorator.h
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
#ifndef _DECORATOR_H_
|
||||
#define _DECORATOR_H_
|
||||
|
||||
|
||||
#include <Rect.h>
|
||||
#include <Region.h>
|
||||
#include <String.h>
|
||||
#include <Window.h>
|
||||
|
||||
#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_ */
|
200
src/servers/app/DrawState.h
Normal file
200
src/servers/app/DrawState.h
Normal file
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Adi Oanca <adioanca@mymail.ro>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef _DRAW_STATE_H_
|
||||
#define _DRAW_STATE_H_
|
||||
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Point.h>
|
||||
#include <View.h> // 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_ */
|
169
src/servers/app/DrawingEngine.h
Normal file
169
src/servers/app/DrawingEngine.h
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Gabe Yoder <gyoder@stny.rr.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
#ifndef DRAWING_ENGINE_H_
|
||||
#define DRAWING_ENGINE_H_
|
||||
|
||||
|
||||
#include <Accelerant.h>
|
||||
#include <Font.h>
|
||||
#include <Locker.h>
|
||||
#include <Point.h>
|
||||
|
||||
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_
|
217
src/servers/app/FontFamily.h
Normal file
217
src/servers/app/FontFamily.h
Normal file
@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef FONT_FAMILY_H_
|
||||
#define FONT_FAMILY_H_
|
||||
|
||||
|
||||
#include <Font.h>
|
||||
#include <Locker.h>
|
||||
#include <Node.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Rect.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <ft2build.h>
|
||||
#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<FontStyle> fStyles;
|
||||
uint16 fID;
|
||||
uint16 fNextID;
|
||||
uint32 fFlags;
|
||||
};
|
||||
|
||||
#endif /* FONT_FAMILY_H_ */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -10,10 +10,10 @@
|
||||
/** Manages font families and styles */
|
||||
|
||||
|
||||
#include <FontFamily.h>
|
||||
#include <FontManager.h>
|
||||
#include <ServerConfig.h>
|
||||
#include <ServerFont.h>
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "ServerConfig.h"
|
||||
#include "ServerFont.h"
|
||||
|
||||
#include <Autolock.h>
|
||||
#include <Directory.h>
|
||||
|
113
src/servers/app/FontManager.h
Normal file
113
src/servers/app/FontManager.h
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef FONT_MANAGER_H
|
||||
#define FONT_MANAGER_H
|
||||
|
||||
|
||||
#include "HashTable.h"
|
||||
|
||||
#include <Looper.h>
|
||||
#include <ObjectList.h>
|
||||
|
||||
#include <ft2build.h>
|
||||
#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<font_directory> fDirectories;
|
||||
BObjectList<font_mapping> fMappings;
|
||||
BObjectList<FontFamily> fFamilies;
|
||||
HashTable fStyleHashTable;
|
||||
ServerFont* fDefaultPlainFont;
|
||||
ServerFont* fDefaultBoldFont;
|
||||
ServerFont* fDefaultFixedFont;
|
||||
bool fScanned;
|
||||
int32 fNextID;
|
||||
};
|
||||
|
||||
extern FT_Library gFreeTypeLibrary;
|
||||
extern FontManager *gFontManager;
|
||||
|
||||
#endif /* FONT_MANAGER_H */
|
48
src/servers/app/HashTable.h
Normal file
48
src/servers/app/HashTable.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 <SupportDefs.h>
|
||||
|
||||
|
||||
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 */
|
@ -3,7 +3,7 @@ SubDir HAIKU_TOP src servers app ;
|
||||
AddResources app_server : app_server.rdef ;
|
||||
|
||||
UseLibraryHeaders png zlib ;
|
||||
UsePrivateHeaders app graphics input interface kernel shared [ FDirName servers app ] ;
|
||||
UsePrivateHeaders app graphics input interface kernel shared ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ;
|
||||
UseFreeTypeHeaders ;
|
||||
|
196
src/servers/app/PatternHandler.h
Normal file
196
src/servers/app/PatternHandler.h
Normal file
@ -0,0 +1,196 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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 <bpmagic@columbus.rr.com>
|
||||
// Stephan Aßmus <superstippi@gmx.de>
|
||||
// Description: Class for easy calculation and use of patterns
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef PATTERNHANDLER_H
|
||||
#define PATTERNHANDLER_H
|
||||
|
||||
#include <string.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#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
|
58
src/servers/app/RGBColor.h
Normal file
58
src/servers/app/RGBColor.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
*/
|
||||
#ifndef RGB_COLOR_H
|
||||
#define RGB_COLOR_H
|
||||
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
|
||||
|
||||
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
|
55
src/servers/app/ReferenceCounting.h
Normal file
55
src/servers/app/ReferenceCounting.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef REFERENCE_COUNTING_H
|
||||
#define REFERENCE_COUNTING_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
/*!
|
||||
\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 */
|
33
src/servers/app/RenderingBuffer.h
Normal file
33
src/servers/app/RenderingBuffer.h
Normal file
@ -0,0 +1,33 @@
|
||||
// RenderingBuffer.h
|
||||
|
||||
#ifndef RENDERING_BUFFER_H
|
||||
#define RENDERING_BUFFER_H
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Rect.h>
|
||||
|
||||
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
|
@ -16,24 +16,9 @@
|
||||
\brief Counterpart to BApplication within the app_server
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <AppDefs.h>
|
||||
#include <Autolock.h>
|
||||
#include <List.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <Shape.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <ColorSet.h>
|
||||
#include <FontPrivate.h>
|
||||
#include <MessengerPrivate.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
#include "AppServer.h"
|
||||
#include "BitmapManager.h"
|
||||
#include "ColorSet.h"
|
||||
#include "CursorManager.h"
|
||||
#include "CursorSet.h"
|
||||
#include "Desktop.h"
|
||||
@ -57,8 +42,23 @@
|
||||
#include "SystemPalette.h"
|
||||
#include "WindowLayer.h"
|
||||
|
||||
//#define DEBUG_SERVERAPP
|
||||
#include <AppDefs.h>
|
||||
#include <Autolock.h>
|
||||
#include <List.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <Shape.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <FontPrivate.h>
|
||||
#include <MessengerPrivate.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
|
||||
|
||||
//#define DEBUG_SERVERAPP
|
||||
#ifdef DEBUG_SERVERAPP
|
||||
# define STRACE(x) printf x
|
||||
#else
|
||||
|
150
src/servers/app/ServerBitmap.h
Normal file
150
src/servers/app/ServerBitmap.h
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
*/
|
||||
#ifndef SERVER_BITMAP_H
|
||||
#define SERVER_BITMAP_H
|
||||
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Rect.h>
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
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
|
76
src/servers/app/ServerConfig.h
Normal file
76
src/servers/app/ServerConfig.h
Normal file
@ -0,0 +1,76 @@
|
||||
#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 */
|
72
src/servers/app/ServerCursor.h
Normal file
72
src/servers/app/ServerCursor.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef SERVER_CURSOR_H
|
||||
#define SERVER_CURSOR_H
|
||||
|
||||
|
||||
#include "ServerBitmap.h"
|
||||
|
||||
#include <Point.h>
|
||||
#include <String.h>
|
||||
|
||||
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
|
173
src/servers/app/ServerFont.h
Normal file
173
src/servers/app/ServerFont.h
Normal file
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Jérôme Duval, jerome.duval@free.fr
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef SERVER_FONT_H
|
||||
#define SERVER_FONT_H
|
||||
|
||||
|
||||
#include <Font.h>
|
||||
#include <Rect.h>
|
||||
|
||||
#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 */
|
@ -1,3 +1,13 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Marc Flerackers (mflerackers@androme.be)
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
*/
|
||||
|
||||
|
||||
#include "DrawingEngine.h"
|
||||
#include "ServerBitmap.h"
|
||||
#include "ServerPicture.h"
|
||||
@ -5,7 +15,6 @@
|
||||
#include "ViewLayer.h"
|
||||
#include "WindowLayer.h"
|
||||
|
||||
#include <ServerBitmap.h>
|
||||
#include <ServerProtocol.h>
|
||||
#include <TPicture.h>
|
||||
|
||||
|
@ -1,122 +1,108 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: SystemPalette.cpp
|
||||
// Authors: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Stefano Ceccherini <burton666@libero.it>
|
||||
// Description: Methods to initialize and get the system color_map.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
*/
|
||||
|
||||
//! Methods to initialize and get the system color_map.
|
||||
|
||||
|
||||
#include "SystemPalette.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <SystemPalette.h>
|
||||
|
||||
const static rgb_color kSystemPalette[] = {
|
||||
{ 0, 0, 0, 255 }, { 8, 8, 8, 255 }, { 16, 16, 16, 255 },
|
||||
{ 24, 24, 24, 255 }, { 32, 32, 32, 255 }, { 40, 40, 40, 255 },
|
||||
{ 48, 48, 48, 255 }, { 56, 56, 56, 255 }, { 64, 64, 64, 255 },
|
||||
{ 72, 72, 72, 255 }, { 80, 80, 80, 255 }, { 88, 88, 88, 255 },
|
||||
{ 96, 96, 96, 255 }, { 104, 104, 104, 255 }, { 112, 112, 112, 255 },
|
||||
{ 120, 120, 120, 255 }, { 128, 128, 128, 255 }, { 136, 136, 136, 255 },
|
||||
{ 144, 144, 144, 255 }, { 152, 152, 152, 255 }, { 160, 160, 160, 255 },
|
||||
{ 168, 168, 168, 255 }, { 176, 176, 176, 255 }, { 184, 184, 184, 255 },
|
||||
{ 192, 192, 192, 255 }, { 200, 200, 200, 255 }, { 208, 208, 208, 255 },
|
||||
{ 216, 216, 216, 255 }, { 224, 224, 224, 255 }, { 232, 232, 232, 255 },
|
||||
{ 240, 240, 240, 255 }, { 248, 248, 248, 255 }, { 0, 0, 255, 255 },
|
||||
{ 0, 0, 229, 255 }, { 0, 0, 204, 255 }, { 0, 0, 179, 255 },
|
||||
{ 0, 0, 154, 255 }, { 0, 0, 129, 255 }, { 0, 0, 105, 255 },
|
||||
{ 0, 0, 80, 255 }, { 0, 0, 55, 255 }, { 0, 0, 30, 255 },
|
||||
{ 255, 0, 0, 255 }, { 228, 0, 0, 255 }, { 203, 0, 0, 255 },
|
||||
{ 178, 0, 0, 255 }, { 153, 0, 0, 255 }, { 128, 0, 0, 255 },
|
||||
{ 105, 0, 0, 255 }, { 80, 0, 0, 255 }, { 55, 0, 0, 255 },
|
||||
{ 30, 0, 0, 255 }, { 0, 255, 0, 255 }, { 0, 228, 0, 255 },
|
||||
{ 0, 203, 0, 255 }, { 0, 178, 0, 255 }, { 0, 153, 0, 255 },
|
||||
{ 0, 128, 0, 255 }, { 0, 105, 0, 255 }, { 0, 80, 0, 255 },
|
||||
{ 0, 55, 0, 255 }, { 0, 30, 0, 255 }, { 0, 152, 51, 255 },
|
||||
{ 255, 255, 255, 255 }, { 203, 255, 255, 255 }, { 203, 255, 203, 255 },
|
||||
{ 203, 255, 152, 255 }, { 203, 255, 102, 255 }, { 203, 255, 51, 255 },
|
||||
{ 203, 255, 0, 255 }, { 152, 255, 255, 255 }, { 152, 255, 203, 255 },
|
||||
{ 152, 255, 152, 255 }, { 152, 255, 102, 255 }, { 152, 255, 51, 255 },
|
||||
{ 152, 255, 0, 255 }, { 102, 255, 255, 255 }, { 102, 255, 203, 255 },
|
||||
{ 102, 255, 152, 255 }, { 102, 255, 102, 255 }, { 102, 255, 51, 255 },
|
||||
{ 102, 255, 0, 255 }, { 51, 255, 255, 255 }, { 51, 255, 203, 255 },
|
||||
{ 51, 255, 152, 255 }, { 51, 255, 102, 255 }, { 51, 255, 51, 255 },
|
||||
{ 51, 255, 0, 255 }, { 255, 152, 255, 255 }, { 255, 152, 203, 255 },
|
||||
{ 255, 152, 152, 255 }, { 255, 152, 102, 255 }, { 255, 152, 51, 255 },
|
||||
{ 255, 152, 0, 255 }, { 0, 102, 255, 255 }, { 0, 102, 203, 255 },
|
||||
{ 203, 203, 255, 255 }, { 203, 203, 203, 255 }, { 203, 203, 152, 255 },
|
||||
{ 203, 203, 102, 255 }, { 203, 203, 51, 255 }, { 203, 203, 0, 255 },
|
||||
{ 152, 203, 255, 255 }, { 152, 203, 203, 255 }, { 152, 203, 152, 255 },
|
||||
{ 152, 203, 102, 255 }, { 152, 203, 51, 255 }, { 152, 203, 0, 255 },
|
||||
{ 102, 203, 255, 255 }, { 102, 203, 203, 255 }, { 102, 203, 152, 255 },
|
||||
{ 102, 203, 102, 255 }, { 102, 203, 51, 255 }, { 102, 203, 0, 255 },
|
||||
{ 51, 203, 255, 255 }, { 51, 203, 203, 255 }, { 51, 203, 152, 255 },
|
||||
{ 51, 203, 102, 255 }, { 51, 203, 51, 255 }, { 51, 203, 0, 255 },
|
||||
{ 255, 102, 255, 255 }, { 255, 102, 203, 255 }, { 255, 102, 152, 255 },
|
||||
{ 255, 102, 102, 255 }, { 255, 102, 51, 255 }, { 255, 102, 0, 255 },
|
||||
{ 0, 102, 152, 255 }, { 0, 102, 102, 255 }, { 203, 152, 255, 255 },
|
||||
{ 203, 152, 203, 255 }, { 203, 152, 152, 255 }, { 203, 152, 102, 255 },
|
||||
{ 203, 152, 51, 255 }, { 203, 152, 0, 255 }, { 152, 152, 255, 255 },
|
||||
{ 152, 152, 203, 255 }, { 152, 152, 152, 255 }, { 152, 152, 102, 255 },
|
||||
{ 152, 152, 51, 255 }, { 152, 152, 0, 255 }, { 102, 152, 255, 255 },
|
||||
{ 102, 152, 203, 255 }, { 102, 152, 152, 255 }, { 102, 152, 102, 255 },
|
||||
{ 102, 152, 51, 255 }, { 102, 152, 0, 255 }, { 51, 152, 255, 255 },
|
||||
{ 51, 152, 203, 255 }, { 51, 152, 152, 255 }, { 51, 152, 102, 255 },
|
||||
{ 51, 152, 51, 255 }, { 51, 152, 0, 255 }, { 230, 134, 0, 255 },
|
||||
{ 255, 51, 203, 255 }, { 255, 51, 152, 255 }, { 255, 51, 102, 255 },
|
||||
{ 255, 51, 51, 255 }, { 255, 51, 0, 255 }, { 0, 102, 51, 255 },
|
||||
{ 0, 102, 0, 255 }, { 203, 102, 255, 255 }, { 203, 102, 203, 255 },
|
||||
{ 203, 102, 152, 255 }, { 203, 102, 102, 255 }, { 203, 102, 51, 255 },
|
||||
{ 203, 102, 0, 255 }, { 152, 102, 255, 255 }, { 152, 102, 203, 255 },
|
||||
{ 152, 102, 152, 255 }, { 152, 102, 102, 255 }, { 152, 102, 51, 255 },
|
||||
{ 152, 102, 0, 255 }, { 102, 102, 255, 255 }, { 102, 102, 203, 255 },
|
||||
{ 102, 102, 152, 255 }, { 102, 102, 102, 255 }, { 102, 102, 51, 255 },
|
||||
{ 102, 102, 0, 255 }, { 51, 102, 255, 255 }, { 51, 102, 203, 255 },
|
||||
{ 51, 102, 152, 255 }, { 51, 102, 102, 255 }, { 51, 102, 51, 255 },
|
||||
{ 51, 102, 0, 255 }, { 255, 0, 255, 255 }, { 255, 0, 203, 255 },
|
||||
{ 255, 0, 152, 255 }, { 255, 0, 102, 255 }, { 255, 0, 51, 255 },
|
||||
{ 255, 175, 19, 255 }, { 0, 51, 255, 255 }, { 0, 51, 203, 255 },
|
||||
{ 203, 51, 255, 255 }, { 203, 51, 203, 255 }, { 203, 51, 152, 255 },
|
||||
{ 203, 51, 102, 255 }, { 203, 51, 51, 255 }, { 203, 51, 0, 255 },
|
||||
{ 152, 51, 255, 255 }, { 152, 51, 203, 255 }, { 152, 51, 152, 255 },
|
||||
{ 152, 51, 102, 255 }, { 152, 51, 51, 255 }, { 152, 51, 0, 255 },
|
||||
{ 102, 51, 255, 255 }, { 102, 51, 203, 255 }, { 102, 51, 152, 255 },
|
||||
{ 102, 51, 102, 255 }, { 102, 51, 51, 255 }, { 102, 51, 0, 255 },
|
||||
{ 51, 51, 255, 255 }, { 51, 51, 203, 255 }, { 51, 51, 152, 255 },
|
||||
{ 51, 51, 102, 255 }, { 51, 51, 51, 255 }, { 51, 51, 0, 255 },
|
||||
{ 255, 203, 102, 255 }, { 255, 203, 152, 255 }, { 255, 203, 203, 255 },
|
||||
{ 255, 203, 255, 255 }, { 0, 51, 152, 255 }, { 0, 51, 102, 255 },
|
||||
{ 0, 51, 51, 255 }, { 0, 51, 0, 255 }, { 203, 0, 255, 255 },
|
||||
{ 203, 0, 203, 255 }, { 203, 0, 152, 255 }, { 203, 0, 102, 255 },
|
||||
{ 203, 0, 51, 255 }, { 255, 227, 70, 255 }, { 152, 0, 255, 255 },
|
||||
{ 152, 0, 203, 255 }, { 152, 0, 152, 255 }, { 152, 0, 102, 255 },
|
||||
{ 152, 0, 51, 255 }, { 152, 0, 0, 255 }, { 102, 0, 255, 255 },
|
||||
{ 102, 0, 203, 255 }, { 102, 0, 152, 255 }, { 102, 0, 102, 255 },
|
||||
{ 102, 0, 51, 255 }, { 102, 0, 0, 255 }, { 51, 0, 255, 255 },
|
||||
{ 51, 0, 203, 255 }, { 51, 0, 152, 255 }, { 51, 0, 102, 255 },
|
||||
{ 51, 0, 51, 255 }, { 51, 0, 0, 255 }, { 255, 203, 51, 255 },
|
||||
{ 255, 203, 0, 255 }, { 255, 255, 0, 255 }, { 255, 255, 51, 255 },
|
||||
{ 255, 255, 102, 255 }, { 255, 255, 152, 255 }, { 255, 255, 203, 255 },
|
||||
{ 255, 255, 255, 0 } // B_TRANSPARENT_MAGIC_CMAP8
|
||||
{ 0, 0, 0, 255 }, { 8, 8, 8, 255 }, { 16, 16, 16, 255 },
|
||||
{ 24, 24, 24, 255 }, { 32, 32, 32, 255 }, { 40, 40, 40, 255 },
|
||||
{ 48, 48, 48, 255 }, { 56, 56, 56, 255 }, { 64, 64, 64, 255 },
|
||||
{ 72, 72, 72, 255 }, { 80, 80, 80, 255 }, { 88, 88, 88, 255 },
|
||||
{ 96, 96, 96, 255 }, { 104, 104, 104, 255 }, { 112, 112, 112, 255 },
|
||||
{ 120, 120, 120, 255 }, { 128, 128, 128, 255 }, { 136, 136, 136, 255 },
|
||||
{ 144, 144, 144, 255 }, { 152, 152, 152, 255 }, { 160, 160, 160, 255 },
|
||||
{ 168, 168, 168, 255 }, { 176, 176, 176, 255 }, { 184, 184, 184, 255 },
|
||||
{ 192, 192, 192, 255 }, { 200, 200, 200, 255 }, { 208, 208, 208, 255 },
|
||||
{ 216, 216, 216, 255 }, { 224, 224, 224, 255 }, { 232, 232, 232, 255 },
|
||||
{ 240, 240, 240, 255 }, { 248, 248, 248, 255 }, { 0, 0, 255, 255 },
|
||||
{ 0, 0, 229, 255 }, { 0, 0, 204, 255 }, { 0, 0, 179, 255 },
|
||||
{ 0, 0, 154, 255 }, { 0, 0, 129, 255 }, { 0, 0, 105, 255 },
|
||||
{ 0, 0, 80, 255 }, { 0, 0, 55, 255 }, { 0, 0, 30, 255 },
|
||||
{ 255, 0, 0, 255 }, { 228, 0, 0, 255 }, { 203, 0, 0, 255 },
|
||||
{ 178, 0, 0, 255 }, { 153, 0, 0, 255 }, { 128, 0, 0, 255 },
|
||||
{ 105, 0, 0, 255 }, { 80, 0, 0, 255 }, { 55, 0, 0, 255 },
|
||||
{ 30, 0, 0, 255 }, { 0, 255, 0, 255 }, { 0, 228, 0, 255 },
|
||||
{ 0, 203, 0, 255 }, { 0, 178, 0, 255 }, { 0, 153, 0, 255 },
|
||||
{ 0, 128, 0, 255 }, { 0, 105, 0, 255 }, { 0, 80, 0, 255 },
|
||||
{ 0, 55, 0, 255 }, { 0, 30, 0, 255 }, { 0, 152, 51, 255 },
|
||||
{ 255, 255, 255, 255 }, { 203, 255, 255, 255 }, { 203, 255, 203, 255 },
|
||||
{ 203, 255, 152, 255 }, { 203, 255, 102, 255 }, { 203, 255, 51, 255 },
|
||||
{ 203, 255, 0, 255 }, { 152, 255, 255, 255 }, { 152, 255, 203, 255 },
|
||||
{ 152, 255, 152, 255 }, { 152, 255, 102, 255 }, { 152, 255, 51, 255 },
|
||||
{ 152, 255, 0, 255 }, { 102, 255, 255, 255 }, { 102, 255, 203, 255 },
|
||||
{ 102, 255, 152, 255 }, { 102, 255, 102, 255 }, { 102, 255, 51, 255 },
|
||||
{ 102, 255, 0, 255 }, { 51, 255, 255, 255 }, { 51, 255, 203, 255 },
|
||||
{ 51, 255, 152, 255 }, { 51, 255, 102, 255 }, { 51, 255, 51, 255 },
|
||||
{ 51, 255, 0, 255 }, { 255, 152, 255, 255 }, { 255, 152, 203, 255 },
|
||||
{ 255, 152, 152, 255 }, { 255, 152, 102, 255 }, { 255, 152, 51, 255 },
|
||||
{ 255, 152, 0, 255 }, { 0, 102, 255, 255 }, { 0, 102, 203, 255 },
|
||||
{ 203, 203, 255, 255 }, { 203, 203, 203, 255 }, { 203, 203, 152, 255 },
|
||||
{ 203, 203, 102, 255 }, { 203, 203, 51, 255 }, { 203, 203, 0, 255 },
|
||||
{ 152, 203, 255, 255 }, { 152, 203, 203, 255 }, { 152, 203, 152, 255 },
|
||||
{ 152, 203, 102, 255 }, { 152, 203, 51, 255 }, { 152, 203, 0, 255 },
|
||||
{ 102, 203, 255, 255 }, { 102, 203, 203, 255 }, { 102, 203, 152, 255 },
|
||||
{ 102, 203, 102, 255 }, { 102, 203, 51, 255 }, { 102, 203, 0, 255 },
|
||||
{ 51, 203, 255, 255 }, { 51, 203, 203, 255 }, { 51, 203, 152, 255 },
|
||||
{ 51, 203, 102, 255 }, { 51, 203, 51, 255 }, { 51, 203, 0, 255 },
|
||||
{ 255, 102, 255, 255 }, { 255, 102, 203, 255 }, { 255, 102, 152, 255 },
|
||||
{ 255, 102, 102, 255 }, { 255, 102, 51, 255 }, { 255, 102, 0, 255 },
|
||||
{ 0, 102, 152, 255 }, { 0, 102, 102, 255 }, { 203, 152, 255, 255 },
|
||||
{ 203, 152, 203, 255 }, { 203, 152, 152, 255 }, { 203, 152, 102, 255 },
|
||||
{ 203, 152, 51, 255 }, { 203, 152, 0, 255 }, { 152, 152, 255, 255 },
|
||||
{ 152, 152, 203, 255 }, { 152, 152, 152, 255 }, { 152, 152, 102, 255 },
|
||||
{ 152, 152, 51, 255 }, { 152, 152, 0, 255 }, { 102, 152, 255, 255 },
|
||||
{ 102, 152, 203, 255 }, { 102, 152, 152, 255 }, { 102, 152, 102, 255 },
|
||||
{ 102, 152, 51, 255 }, { 102, 152, 0, 255 }, { 51, 152, 255, 255 },
|
||||
{ 51, 152, 203, 255 }, { 51, 152, 152, 255 }, { 51, 152, 102, 255 },
|
||||
{ 51, 152, 51, 255 }, { 51, 152, 0, 255 }, { 230, 134, 0, 255 },
|
||||
{ 255, 51, 203, 255 }, { 255, 51, 152, 255 }, { 255, 51, 102, 255 },
|
||||
{ 255, 51, 51, 255 }, { 255, 51, 0, 255 }, { 0, 102, 51, 255 },
|
||||
{ 0, 102, 0, 255 }, { 203, 102, 255, 255 }, { 203, 102, 203, 255 },
|
||||
{ 203, 102, 152, 255 }, { 203, 102, 102, 255 }, { 203, 102, 51, 255 },
|
||||
{ 203, 102, 0, 255 }, { 152, 102, 255, 255 }, { 152, 102, 203, 255 },
|
||||
{ 152, 102, 152, 255 }, { 152, 102, 102, 255 }, { 152, 102, 51, 255 },
|
||||
{ 152, 102, 0, 255 }, { 102, 102, 255, 255 }, { 102, 102, 203, 255 },
|
||||
{ 102, 102, 152, 255 }, { 102, 102, 102, 255 }, { 102, 102, 51, 255 },
|
||||
{ 102, 102, 0, 255 }, { 51, 102, 255, 255 }, { 51, 102, 203, 255 },
|
||||
{ 51, 102, 152, 255 }, { 51, 102, 102, 255 }, { 51, 102, 51, 255 },
|
||||
{ 51, 102, 0, 255 }, { 255, 0, 255, 255 }, { 255, 0, 203, 255 },
|
||||
{ 255, 0, 152, 255 }, { 255, 0, 102, 255 }, { 255, 0, 51, 255 },
|
||||
{ 255, 175, 19, 255 }, { 0, 51, 255, 255 }, { 0, 51, 203, 255 },
|
||||
{ 203, 51, 255, 255 }, { 203, 51, 203, 255 }, { 203, 51, 152, 255 },
|
||||
{ 203, 51, 102, 255 }, { 203, 51, 51, 255 }, { 203, 51, 0, 255 },
|
||||
{ 152, 51, 255, 255 }, { 152, 51, 203, 255 }, { 152, 51, 152, 255 },
|
||||
{ 152, 51, 102, 255 }, { 152, 51, 51, 255 }, { 152, 51, 0, 255 },
|
||||
{ 102, 51, 255, 255 }, { 102, 51, 203, 255 }, { 102, 51, 152, 255 },
|
||||
{ 102, 51, 102, 255 }, { 102, 51, 51, 255 }, { 102, 51, 0, 255 },
|
||||
{ 51, 51, 255, 255 }, { 51, 51, 203, 255 }, { 51, 51, 152, 255 },
|
||||
{ 51, 51, 102, 255 }, { 51, 51, 51, 255 }, { 51, 51, 0, 255 },
|
||||
{ 255, 203, 102, 255 }, { 255, 203, 152, 255 }, { 255, 203, 203, 255 },
|
||||
{ 255, 203, 255, 255 }, { 0, 51, 152, 255 }, { 0, 51, 102, 255 },
|
||||
{ 0, 51, 51, 255 }, { 0, 51, 0, 255 }, { 203, 0, 255, 255 },
|
||||
{ 203, 0, 203, 255 }, { 203, 0, 152, 255 }, { 203, 0, 102, 255 },
|
||||
{ 203, 0, 51, 255 }, { 255, 227, 70, 255 }, { 152, 0, 255, 255 },
|
||||
{ 152, 0, 203, 255 }, { 152, 0, 152, 255 }, { 152, 0, 102, 255 },
|
||||
{ 152, 0, 51, 255 }, { 152, 0, 0, 255 }, { 102, 0, 255, 255 },
|
||||
{ 102, 0, 203, 255 }, { 102, 0, 152, 255 }, { 102, 0, 102, 255 },
|
||||
{ 102, 0, 51, 255 }, { 102, 0, 0, 255 }, { 51, 0, 255, 255 },
|
||||
{ 51, 0, 203, 255 }, { 51, 0, 152, 255 }, { 51, 0, 102, 255 },
|
||||
{ 51, 0, 51, 255 }, { 51, 0, 0, 255 }, { 255, 203, 51, 255 },
|
||||
{ 255, 203, 0, 255 }, { 255, 255, 0, 255 }, { 255, 255, 51, 255 },
|
||||
{ 255, 255, 102, 255 }, { 255, 255, 152, 255 }, { 255, 255, 203, 255 },
|
||||
{ 255, 255, 255, 0 } // B_TRANSPARENT_MAGIC_CMAP8
|
||||
};
|
||||
|
||||
|
||||
@ -139,8 +125,7 @@ static color_map sColorMap;
|
||||
\param blue2 Blue component of the second color.
|
||||
\return The distance between the given colors.
|
||||
*/
|
||||
static inline
|
||||
unsigned
|
||||
static inline uint32
|
||||
color_distance(uint8 red1, uint8 green1, uint8 blue1,
|
||||
uint8 red2, uint8 green2, uint8 blue2)
|
||||
{
|
||||
|
37
src/servers/app/SystemPalette.h
Normal file
37
src/servers/app/SystemPalette.h
Normal file
@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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 <bpmagic@columbus.rr.com>
|
||||
// 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 <GraphicsDefs.h>
|
||||
|
||||
extern void InitializeColorMap();
|
||||
extern const rgb_color *SystemPalette();
|
||||
extern const color_map *SystemColorMap();
|
||||
|
||||
#endif
|
@ -16,7 +16,6 @@
|
||||
#include "WindowLayer.h"
|
||||
#include "Workspace.h"
|
||||
|
||||
#include <ColorSet.h>
|
||||
#include <WindowPrivate.h>
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
SubDir HAIKU_TOP src servers app drawing ;
|
||||
|
||||
UseLibraryHeaders agg ;
|
||||
UsePrivateHeaders app graphics interface shared [ FDirName servers app ] ;
|
||||
UsePrivateHeaders app graphics interface shared ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ;
|
||||
|
@ -4,7 +4,8 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UseLibraryHeaders agg ;
|
||||
UsePrivateHeaders app interface shared [ FDirName servers app ] ;
|
||||
UsePrivateHeaders app interface shared ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter drawing_modes ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter font_support ] ;
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2005, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
|
||||
* Copyright 2005-2006, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* API to the Anti-Grain Geometry based "Painter" drawing backend. Manages
|
||||
* rendering pipe-lines for stroke, fills, bitmap and text rendering.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Copyright 2005, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
|
||||
* Copyright 2005-2006, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* API to the Anti-Grain Geometry based "Painter" drawing backend. Manages
|
||||
* rendering pipe-lines for stroke, fills, bitmap and text rendering.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PAINTER_H
|
||||
#define PAINTER_H
|
||||
|
||||
#include <Font.h>
|
||||
#include <Rect.h>
|
||||
#include <FontManager.h>
|
||||
#include <ServerFont.h>
|
||||
#include "FontManager.h"
|
||||
#include "RGBColor.h"
|
||||
#include "ServerFont.h"
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
#include "RGBColor.h"
|
||||
#include <Font.h>
|
||||
#include <Rect.h>
|
||||
|
||||
|
||||
class AGGTextRenderer;
|
||||
class BBitmap;
|
||||
|
@ -1,17 +1,14 @@
|
||||
// AGGTextRenderer.cpp
|
||||
/*
|
||||
* Copyright 2005-2006, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <ByteOrder.h>
|
||||
#include <Entry.h>
|
||||
#include <FontManager.h>
|
||||
#include <Message.h>
|
||||
#include <ServerFont.h>
|
||||
#include <UTF8.h>
|
||||
#include "AGGTextRenderer.h"
|
||||
|
||||
#include "FontManager.h"
|
||||
#include "moreUTF8.h"
|
||||
#include "ServerFont.h"
|
||||
|
||||
#include <agg_basics.h>
|
||||
#include <agg_bounding_rect.h>
|
||||
@ -19,8 +16,16 @@
|
||||
#include <agg_conv_transform.h>
|
||||
#include <agg_trans_affine.h>
|
||||
|
||||
#include "AGGTextRenderer.h"
|
||||
#include "moreUTF8.h"
|
||||
#include <Bitmap.h>
|
||||
#include <ByteOrder.h>
|
||||
#include <Entry.h>
|
||||
#include <Message.h>
|
||||
#include <UTF8.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FLIP_Y false
|
||||
|
||||
|
@ -1,18 +1,20 @@
|
||||
// AGGTextRenderer.h
|
||||
|
||||
/*
|
||||
* Copyright 2005-2006, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef AGG_TEXT_RENDERER_H
|
||||
#define AGG_TEXT_RENDERER_H
|
||||
|
||||
#include "agg_font_freetype.h"
|
||||
#include "defines.h"
|
||||
|
||||
#include "ServerFont.h"
|
||||
#include "Transformable.h"
|
||||
|
||||
#include <agg_conv_curve.h>
|
||||
#include <agg_conv_contour.h>
|
||||
#include <agg_scanline_u.h>
|
||||
|
||||
#include "agg_font_freetype.h"
|
||||
#include "defines.h"
|
||||
|
||||
#include "Transformable.h"
|
||||
|
||||
class ServerFont;
|
||||
|
||||
class AGGTextRenderer {
|
||||
public:
|
||||
|
@ -16,17 +16,18 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// modified to use family and style id as glyph cache lookup
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "agg_font_freetype.h"
|
||||
#include "agg_bitset_iterator.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
|
||||
#include <ServerFont.h>
|
||||
#include <FontFamily.h>
|
||||
#include "ServerFont.h"
|
||||
#include "FontFamily.h"
|
||||
|
||||
namespace agg
|
||||
{
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
namespace agg {
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// This code implements the AUTODIN II polynomial
|
||||
|
@ -6,7 +6,7 @@ SetSubDirSupportedPlatforms libbe_test ;
|
||||
if $(TARGET_PLATFORM) = libbe_test {
|
||||
|
||||
UseLibraryHeaders agg png zlib ;
|
||||
UsePrivateHeaders app graphics input interface kernel shared [ FDirName servers app ] ;
|
||||
UsePrivateHeaders app graphics input interface kernel shared ;
|
||||
|
||||
local appServerDir = [ FDirName $(HAIKU_TOP) src servers app ] ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user