The server has begun...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2340 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,220 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: RGBColor.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Color encapsulation class for the app_server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
#include "RGBColor.h"
|
||||
|
||||
RGBColor::RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=255)
|
||||
{
|
||||
SetColor(r,g,b,a);
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(int r, int g, int b, int a=255)
|
||||
{
|
||||
SetColor(r,g,b,a);
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(rgb_color col)
|
||||
{
|
||||
SetColor(col);
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(uint16 col)
|
||||
{
|
||||
SetColor(col);
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(uint8 col)
|
||||
{
|
||||
SetColor(col);
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(const RGBColor &col)
|
||||
{
|
||||
color32=col.color32;
|
||||
color16=col.color16;
|
||||
color8=col.color8;
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(void)
|
||||
{
|
||||
SetColor(0,0,0,0);
|
||||
}
|
||||
|
||||
uint8 RGBColor::GetColor8(void)
|
||||
{
|
||||
return color8;
|
||||
}
|
||||
|
||||
uint16 RGBColor::GetColor16(void)
|
||||
{
|
||||
return color16;
|
||||
}
|
||||
|
||||
rgb_color RGBColor::GetColor32(void)
|
||||
{
|
||||
return color32;
|
||||
}
|
||||
|
||||
void RGBColor::SetColor(uint8 r, uint8 g, uint8 b, uint8 a=255)
|
||||
{
|
||||
color32.red=r;
|
||||
color32.green=g;
|
||||
color32.blue=b;
|
||||
color32.alpha=a;
|
||||
}
|
||||
|
||||
void RGBColor::SetColor(int r, int g, int b, int a=255)
|
||||
{
|
||||
color32.red=(uint8)r;
|
||||
color32.green=(uint8)g;
|
||||
color32.blue=(uint8)b;
|
||||
color32.alpha=(uint8)a;
|
||||
}
|
||||
|
||||
void RGBColor::SetColor(uint16 col16)
|
||||
{
|
||||
color16=col16;
|
||||
|
||||
// TODO: convert and set the 32-bit and 8-bit values
|
||||
}
|
||||
|
||||
void RGBColor::SetColor(uint8 col8)
|
||||
{
|
||||
// Pared-down version from what is used in the app_server to
|
||||
// eliminate some dependencies
|
||||
color8=col8;
|
||||
|
||||
// TODO: convert and set the 32-bit and 16-bit values
|
||||
}
|
||||
|
||||
void RGBColor::SetColor(const rgb_color &color)
|
||||
{
|
||||
// Pared-down version from what is used in the app_server to
|
||||
// eliminate some dependencies
|
||||
color32=color;
|
||||
|
||||
|
||||
// TODO: convert and set the 16-bit and 8-bit values
|
||||
}
|
||||
|
||||
void RGBColor::SetColor(const RGBColor &col)
|
||||
{
|
||||
color32=col.color32;
|
||||
color16=col.color16;
|
||||
color8=col.color8;
|
||||
}
|
||||
|
||||
|
||||
RGBColor & RGBColor::operator=(const RGBColor &col)
|
||||
{
|
||||
color32=col.color32;
|
||||
color16=col.color16;
|
||||
color8=col.color8;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RGBColor & RGBColor::operator=(const rgb_color &col)
|
||||
{
|
||||
color32=col;
|
||||
|
||||
// TODO: convert and set the 16-bit and 8-bit values
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! \brief Returns a color blended between the object's value and
|
||||
another color.
|
||||
|
||||
\param The other color to be blended with.
|
||||
\param A weighted percentage of the second color to use. 0 <= value <= 1.0
|
||||
\return The blended color
|
||||
*/
|
||||
RGBColor RGBColor::MakeBlendColor(RGBColor color, float position)
|
||||
{
|
||||
rgb_color col=color32;
|
||||
rgb_color col2=color.color32;
|
||||
|
||||
rgb_color newcol={0,0,0,0};
|
||||
float mod=0;
|
||||
int16 delta;
|
||||
if(position<0 || position>1)
|
||||
return newcol;
|
||||
|
||||
delta=int16(col2.red)-int16(col.red);
|
||||
mod=col.red + (position * delta);
|
||||
newcol.red=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.red=255;
|
||||
if(mod<0 )
|
||||
newcol.red=0;
|
||||
|
||||
delta=int16(col2.green)-int16(col.green);
|
||||
mod=col.green + (position * delta);
|
||||
newcol.green=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.green=255;
|
||||
if(mod<0 )
|
||||
newcol.green=0;
|
||||
|
||||
delta=int16(col2.blue)-int16(col.blue);
|
||||
mod=col.blue + (position * delta);
|
||||
newcol.blue=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.blue=255;
|
||||
if(mod<0 )
|
||||
newcol.blue=0;
|
||||
|
||||
delta=int8(col2.alpha)-int8(col.alpha);
|
||||
mod=col.alpha + (position * delta);
|
||||
newcol.alpha=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.alpha=255;
|
||||
if(mod<0 )
|
||||
newcol.alpha=0;
|
||||
|
||||
return RGBColor(newcol);
|
||||
}
|
||||
|
||||
void RGBColor::PrintToStream(void)
|
||||
{
|
||||
printf("RGBColor (%u,%u,%u,%u)\n", color32.red,color32.green,color32.blue,color32.alpha);
|
||||
}
|
||||
|
||||
bool RGBColor::operator==(const rgb_color &col)
|
||||
{
|
||||
return (color32.red==col.red && color32.green==col.green
|
||||
&& color32.blue==col.blue)?true:false;
|
||||
}
|
||||
|
||||
bool RGBColor::operator==(const RGBColor &col)
|
||||
{
|
||||
return (color32.red==col.color32.red && color32.green==col.color32.green
|
||||
&& color32.blue==col.color32.blue)?true:false;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: RGBColor.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Color encapsulation class for the app_server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef RGBCOLOR_H_
|
||||
#define RGBCOLOR_H_
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
|
||||
/*!
|
||||
\class RGBColor
|
||||
\brief A color class to encapsulate color space ugliness
|
||||
|
||||
RGBColors can be used to perform tasks much more difficult using rgb_colors. This
|
||||
class is limited to the app_server because of the access to the system palette for
|
||||
looking up the 32-bit value to each color index.
|
||||
*/
|
||||
|
||||
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(void);
|
||||
|
||||
void PrintToStream(void);
|
||||
|
||||
uint8 GetColor8(void);
|
||||
uint16 GetColor16(void);
|
||||
rgb_color GetColor32(void);
|
||||
|
||||
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(rgb_color color);
|
||||
void SetColor(const RGBColor &col);
|
||||
|
||||
RGBColor MakeBlendColor(RGBColor color, float position);
|
||||
|
||||
RGBColor & operator=(const RGBColor &col);
|
||||
RGBColor & operator=(const rgb_color &col);
|
||||
bool operator==(const rgb_color &col);
|
||||
bool operator==(const RGBColor &col);
|
||||
protected:
|
||||
rgb_color color32;
|
||||
uint16 color16;
|
||||
uint8 color8;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef _APPSERVER_CONFIG_H
|
||||
#define _APPSERVER_CONFIG_H
|
||||
|
||||
// The ViewDriver is a BView/BWindow combination. Plenty of functionality,
|
||||
// but dog-slow.
|
||||
#define VIEWDRIVER 0
|
||||
|
||||
// The ScreenDriver utilizes a BWindowScreen to directly access the video
|
||||
// hardware.
|
||||
#define SCREENDRIVER 1
|
||||
|
||||
// The SecondDriver allows the server to make use of a second video card while
|
||||
// still running as a regular BeOS application. You could say it's training
|
||||
// wheels for the HWDriver
|
||||
#define SECONDDRIVER 2
|
||||
|
||||
// The HWDriver is the real thing - loads all the graphics hardware and
|
||||
// literally takes over the system as the app_server is supposed to. This
|
||||
// one can be used only when the app_server is running as *the* app_server
|
||||
// and not in testing mode like the other drivers are for.
|
||||
#define HWDRIVER 3
|
||||
|
||||
// Display driver to be used by the server.
|
||||
#define DISPLAYDRIVER VIEWDRIVER
|
||||
|
||||
// Server port names. The input port is the port which is used to receive
|
||||
// input messages from the Input Server. The other is the "main" port for
|
||||
// the server and is utilized mostly by BApplication objects.
|
||||
#define SERVER_PORT_NAME "OBappserver"
|
||||
#define SERVER_INPUT_PORT "OBinputport"
|
||||
|
||||
// Directory for all app_server-related settings.
|
||||
#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"
|
||||
|
||||
// folder used to keep saved color sets for the UI - tab color, etc.
|
||||
#define COLOR_SET_DIR "/boot/home/config/settings/color_sets/"
|
||||
|
||||
// name of the file containing the current UI color settings
|
||||
#define COLOR_SETTINGS_NAME "system_colors"
|
||||
|
||||
// Folder for additional window decorators
|
||||
#define DECORATORS_DIR "/boot/home/config/add-ons/decorators/"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
#ifndef _APPSERVER_PROTOCOL_
|
||||
#define _APPSERVER_PROTOCOL_
|
||||
|
||||
#define CREATE_APP 'drca'
|
||||
#define DELETE_APP 'drda'
|
||||
#define QUIT_APP 'srqa'
|
||||
|
||||
#define SET_SERVER_PORT 'srsp'
|
||||
|
||||
#define CREATE_WINDOW 'drcw'
|
||||
#define DELETE_WINDOW 'drdw'
|
||||
#define SHOW_WINDOW 'drsw'
|
||||
#define HIDE_WINDOW 'drhw'
|
||||
#define QUIT_WINDOW 'srqw'
|
||||
|
||||
// Used for quick replies from the app_server
|
||||
#define SERVER_TRUE 'svtr'
|
||||
#define SERVER_FALSE 'svfl'
|
||||
|
||||
// Font-related server communications
|
||||
#define QUERY_FONTS_CHANGED 'qfch'
|
||||
#define UPDATED_CLIENT_FONTLIST 'ucfl'
|
||||
#define GET_FAMILY_ID 'fmid'
|
||||
#define GET_STYLE_ID 'stid'
|
||||
#define GET_STYLE_FOR_FACE 'stff'
|
||||
|
||||
// This will be modified. Currently a kludge for the input server until
|
||||
// BScreens are implemented by the IK Taeam
|
||||
#define GET_SCREEN_MODE 'gsmd'
|
||||
|
||||
#define SET_UI_COLORS 'suic'
|
||||
#define GET_UI_COLOR 'guic'
|
||||
#define SET_DECORATOR 'sdec'
|
||||
#define GET_DECORATOR 'gdec'
|
||||
|
||||
#define SET_CURSOR_DATA 'sscd'
|
||||
#define SET_CURSOR_BCURSOR 'sscb'
|
||||
#define SET_CURSOR_BBITMAP 'sscB'
|
||||
#define SHOW_CURSOR 'srsc'
|
||||
#define HIDE_CURSOR 'srhc'
|
||||
#define OBSCURE_CURSOR 'sroc'
|
||||
|
||||
#define GFX_COUNT_WORKSPACES 'gcws'
|
||||
#define GFX_SET_WORKSPACE_COUNT 'ggwc'
|
||||
#define GFX_CURRENT_WORKSPACE 'ggcw'
|
||||
#define GFX_ACTIVATE_WORKSPACE 'gaws'
|
||||
#define GFX_GET_SYSTEM_COLORS 'gsyc'
|
||||
#define GFX_SET_SYSTEM_COLORS 'gsyc'
|
||||
#define GFX_SET_SCREEN_MODE 'gssm'
|
||||
#define GFX_GET_SCROLLBAR_INFO 'ggsi'
|
||||
#define GFX_SET_SCROLLBAR_INFO 'gssi'
|
||||
#define GFX_IDLE_TIME 'gidt'
|
||||
#define GFX_SELECT_PRINTER_PANEL 'gspp'
|
||||
#define GFX_ADD_PRINTER_PANEL 'gapp'
|
||||
#define GFX_RUN_BE_ABOUT 'grba'
|
||||
#define GFX_SET_FOCUS_FOLLOWS_MOUSE 'gsfm'
|
||||
#define GFX_FOCUS_FOLLOWS_MOUSE 'gffm'
|
||||
|
||||
#define GFX_SET_HIGH_COLOR 'gshc'
|
||||
#define GFX_SET_LOW_COLOR 'gslc'
|
||||
#define GFX_SET_VIEW_COLOR 'gsvc'
|
||||
|
||||
#define GFX_STROKE_ARC 'gsar'
|
||||
#define GFX_STROKE_BEZIER 'gsbz'
|
||||
#define GFX_STROKE_ELLIPSE 'gsel'
|
||||
#define GFX_STROKE_LINE 'gsln'
|
||||
#define GFX_STROKE_POLYGON 'gspy'
|
||||
#define GFX_STROKE_RECT 'gsrc'
|
||||
#define GFX_STROKE_ROUNDRECT 'gsrr'
|
||||
#define GFX_STROKE_SHAPE 'gssh'
|
||||
#define GFX_STROKE_TRIANGLE 'gstr'
|
||||
|
||||
#define GFX_FILL_ARC 'gfar'
|
||||
#define GFX_FILL_BEZIER 'gfbz'
|
||||
#define GFX_FILL_ELLIPSE 'gfel'
|
||||
#define GFX_FILL_POLYGON 'gfpy'
|
||||
#define GFX_FILL_RECT 'gfrc'
|
||||
#define GFX_FILL_REGION 'gfrg'
|
||||
#define GFX_FILL_ROUNDRECT 'gfrr'
|
||||
#define GFX_FILL_SHAPE 'gfsh'
|
||||
#define GFX_FILL_TRIANGLE 'gftr'
|
||||
|
||||
#define GFX_MOVEPENBY 'gmpb'
|
||||
#define GFX_MOVEPENTO 'gmpt'
|
||||
#define GFX_SETPENSIZE 'gsps'
|
||||
|
||||
#define GFX_DRAW_STRING 'gdst'
|
||||
#define GFX_SET_FONT 'gsft'
|
||||
#define GFX_SET_FONT_SIZE 'gsfs'
|
||||
|
||||
#define GFX_FLUSH 'gfsh'
|
||||
#define GFX_SYNC 'gsyn'
|
||||
|
||||
#define LAYER_CREATE 'lycr'
|
||||
#define LAYER_DELETE 'lydl'
|
||||
#define LAYER_ADD_CHILD 'lyac'
|
||||
#define LAYER_REMOVE_CHILD 'lyrc'
|
||||
#define LAYER_REMOVE_SELF 'lyrs'
|
||||
#define LAYER_SHOW 'lysh'
|
||||
#define LAYER_HIDE 'lyhd'
|
||||
#define LAYER_MOVE 'lymv'
|
||||
#define LAYER_RESIZE 'lyre'
|
||||
#define LAYER_INVALIDATE 'lyin'
|
||||
#define LAYER_DRAW 'lydr'
|
||||
|
||||
#define BEGIN_RECT_TRACKING 'rtbg'
|
||||
#define END_RECT_TRACKING 'rten'
|
||||
|
||||
#define VIEW_GET_TOKEN 'vgtk'
|
||||
#define VIEW_ADD 'vadd'
|
||||
#define VIEW_REMOVE 'vrem'
|
||||
#endif
|
||||
@@ -0,0 +1,351 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: SystemPalette.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: One global function to generate the palette which is
|
||||
// the default BeOS System palette and the variable to go with it
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
#include "SystemPalette.h"
|
||||
|
||||
rgb_color system_palette[256];
|
||||
|
||||
void GenerateSystemPalette(rgb_color *palette)
|
||||
{
|
||||
int i,j,index=0;
|
||||
int indexvals1[]={ 255,229,204,179,154,129,105,80,55,30 },
|
||||
indexvals2[]={ 255,203,152,102,51,0 };
|
||||
// ff, cb, 98, 66, 33
|
||||
rgb_color *currentcol;
|
||||
|
||||
// Grays 0,0,0 -> 248,248,248 by 8's
|
||||
for(i=0; i<=248; i+=8,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=i;
|
||||
currentcol->green=i;
|
||||
currentcol->blue=i;
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
// Blues, following indexvals1
|
||||
for(i=0; i<10; i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=0;
|
||||
currentcol->green=0;
|
||||
currentcol->blue=indexvals1[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
// Reds, following indexvals1 - 1
|
||||
for(i=0; i<10; i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=indexvals1[i] - 1;
|
||||
currentcol->green=0;
|
||||
currentcol->blue=0;
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
// Greens, following indexvals1 - 1
|
||||
for(i=0; i<10; i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=0;
|
||||
currentcol->green=indexvals1[i] - 1;
|
||||
currentcol->blue=0;
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=152;
|
||||
currentcol->blue=51;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=255;
|
||||
currentcol->green=255;
|
||||
currentcol->blue=255;
|
||||
index++;
|
||||
|
||||
for(j=1;j<5;j++)
|
||||
{
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=indexvals2[j];
|
||||
currentcol->green=255;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<4;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=255;
|
||||
currentcol->green=152;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=255;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=51;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=255;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=0;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=255;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=203;
|
||||
index++;
|
||||
|
||||
// Mostly array runs from here on out
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=203;
|
||||
currentcol->green=203;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=152;
|
||||
currentcol->green=255;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=102;
|
||||
currentcol->green=255;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=51;
|
||||
currentcol->green=255;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=255;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=152;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=102;
|
||||
index++;
|
||||
|
||||
// knocks out 4 assignment loops at once :)
|
||||
for(j=1;j<5;j++)
|
||||
{
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=indexvals2[j];
|
||||
currentcol->green=152;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
}
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=230;
|
||||
currentcol->green=134;
|
||||
currentcol->blue=0;
|
||||
index++;
|
||||
|
||||
for(i=1;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=255;
|
||||
currentcol->green=51;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=51;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=102;
|
||||
currentcol->blue=0;
|
||||
index++;
|
||||
|
||||
for(j=1;j<5;j++)
|
||||
{
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=indexvals2[j];
|
||||
currentcol->green=102;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=255;
|
||||
currentcol->green=0;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=255;
|
||||
currentcol->green=175;
|
||||
currentcol->blue=19;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=51;
|
||||
currentcol->blue=255;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=0;
|
||||
currentcol->green=51;
|
||||
currentcol->blue=203;
|
||||
index++;
|
||||
|
||||
for(j=1;j<5;j++)
|
||||
{
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=indexvals2[j];
|
||||
currentcol->green=51;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=3;i>=0;i--,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=255;
|
||||
currentcol->green=203;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
for(i=2;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=0;
|
||||
currentcol->green=51;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
for(i=0;i<5;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=203;
|
||||
currentcol->green=0;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=255;
|
||||
currentcol->green=227;
|
||||
currentcol->blue=70;
|
||||
index++;
|
||||
|
||||
for(j=2;j<6;j++)
|
||||
{
|
||||
for(i=0;i<6;i++,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=indexvals2[j];
|
||||
currentcol->green=0;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
}
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=255;
|
||||
currentcol->green=203;
|
||||
currentcol->blue=51;
|
||||
index++;
|
||||
|
||||
currentcol+=sizeof(rgb_color);
|
||||
currentcol->red=255;
|
||||
currentcol->green=203;
|
||||
currentcol->blue=0;
|
||||
index++;
|
||||
|
||||
for(i=5;i<=0;i--,index++)
|
||||
{
|
||||
currentcol=&(palette[index]);
|
||||
currentcol->red=255;
|
||||
currentcol->green=255;
|
||||
currentcol->blue=indexvals2[i];
|
||||
currentcol->alpha=255;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: SystemPalette.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// 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>
|
||||
|
||||
void GenerateSystemPalette(rgb_color *palette);
|
||||
extern rgb_color system_palette[];
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user