本文整理汇总了C++中COLOR函数的典型用法代码示例。如果您正苦于以下问题:C++ COLOR函数的具体用法?C++ COLOR怎么用?C++ COLOR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COLOR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Paint
void Devildog::Paint(MATRIX3X2 matView)
{
int width = m_BmpDevildogPtr->GetWidth()/6;
int height = m_BmpDevildogPtr->GetHeight()/4;
RECT clip;
clip.left = width * m_MoveTick;
clip.right = clip.left + width;
clip.top = height * m_StartLine;
clip.bottom = clip.top + height;
MATRIX3X2 matDirection, matPos;
if(m_Direction == 1) matPos.SetAsTranslate(m_Pos);
else matPos.SetAsTranslate(m_Pos.x + width, m_Pos.y);
matDirection.SetAsScale(m_Direction,1);
GAME_ENGINE->SetTransformMatrix(matDirection * matPos * matView);
GAME_ENGINE->DrawBitmap(m_BmpDevildogPtr,0,0,clip);
GAME_ENGINE->SetColor(COLOR(255,0,0,125));
}
开发者ID:Kwintenvdb,项目名称:Willow-Game-Remake,代码行数:24,代码来源:Devildog.cpp
示例2: session_get_line
void session_get_line(t_client *client)
{
char *conf;
if (!client->session->conf.file)
{
if (file_exists(client->session->host))
conf = client->session->host;
else
conf = "default";
client->session->conf.file = fopen(conf, "r");
VERBOSE(printf("\033[%d;1m<%03d> - conf : %s\033[m\n",
COLOR(client->session->id), client->session->id, conf));
}
if (!fgets(client->session->conf.line, BUF_SIZE, client->session->conf.file))
{
fclose(client->session->conf.file);
client->session->conf.file = 0;
session_get_line(client);
}
else if (client->session->conf.line[strlen(client->session->conf.line) - 1]
== '\n')
client->session->conf.line[strlen(client->session->conf.line) - 1] = 0;
}
开发者ID:episeclab,项目名称:advanced-csrf,代码行数:24,代码来源:session.c
示例3: f
/*
y = f(x) + g(x);
*/
// === EXCEPTION 1 =============================================================
// Macros is not bad for concatenation and stringification
enum Color { Color_Red, Color_Green, Color_Blue };
static const struct {
enum Color color;
const char *name;
} colors[] = {
#define COLOR(color) { Color_ ## color, #color }
COLOR(Red), COLOR(Green), COLOR(Blue)
};
// === EXCEPTION 2 =============================================================
// Macros is not bad for yield a compile-time constants
#define ADD_M(a, b) ((a) + (b))
static inline int add_f(int a, int b) {
return a + b;
}
/* === OTHER EXCEPTIONS ========================================================
* Macros is not bad for:
*
* 3. implement type-generic functions
开发者ID:liuhangyu,项目名称:notbad,代码行数:30,代码来源:pre00.c
示例4: c_str
//.........这里部分代码省略.........
case mnemocode::fnstcw : return "fnstcw";
case mnemocode::fldcw : return "fldcw";
case mnemocode::fclex : return "fclex";
case mnemocode::fnclex : return "fnclex";
case mnemocode::fsave : return "fsave";
case mnemocode::fnsave : return "fnsave";
case mnemocode::frstor : return "frstor";
case mnemocode::fstenv : return "fstenv";
case mnemocode::fnstenv : return "fnstenv";
case mnemocode::fldenv : return "fldenv";
case mnemocode::ffree : return "ffree";
case mnemocode::ffreep : return "ffreep";
case mnemocode::fdecstp : return "fdecstp";
case mnemocode::fincstp : return "fincstp";
case mnemocode::fld : return "fld";
case mnemocode::fst : return "fst";
case mnemocode::fstp : return "fstp";
case mnemocode::fxch : return "fxch";
case mnemocode::fcmovb : return "fcmovb";
case mnemocode::fcmove : return "fcmove";
case mnemocode::fcmovbe : return "fcmovbe";
case mnemocode::fcmovu : return "fcmovu";
case mnemocode::fcmovnb : return "fcmovnb";
case mnemocode::fcmovne : return "fcmovne";
case mnemocode::fcmovnbe : return "fcmovnbe";
case mnemocode::fcmovnu : return "fcmovnu";
case mnemocode::fldz : return "fldz";
case mnemocode::fld1 : return "fld1";
case mnemocode::fldpi : return "fldpi";
case mnemocode::fldl2e : return "fldl2e";
case mnemocode::fldl2t : return "fldl2t";
case mnemocode::fldlg2 : return "fldlg2";
case mnemocode::fldln2 : return "fldln2";
case mnemocode::fild : return "fild";
case mnemocode::fist : return "fist";
case mnemocode::fistp : return "fistp";
case mnemocode::fisttp : return "fisttp";
case mnemocode::fbld : return "fbld";
case mnemocode::fbstp : return "fbstp";
case mnemocode::fcom : return "fcom";
case mnemocode::fcomi : return "fcomi";
case mnemocode::fcomip : return "fcomip";
case mnemocode::fcomp : return "fcomp";
case mnemocode::fcompp : return "fcompp";
case mnemocode::ficom : return "ficom";
case mnemocode::ficomp : return "ficomp";
case mnemocode::ftst : return "ftst";
case mnemocode::fucom : return "fucom";
case mnemocode::fucomi : return "fucomi";
case mnemocode::fucomip : return "fucomip";
case mnemocode::fucomp : return "fucomp";
case mnemocode::fucompp : return "fucompp";
case mnemocode::fxam : return "fxam";
case mnemocode::fabs : return "fabs";
case mnemocode::fadd : return "fadd";
case mnemocode::faddp : return "faddp";
case mnemocode::fchs : return "fchs";
case mnemocode::fdiv : return "fdiv";
case mnemocode::fdivp : return "fdivp";
case mnemocode::fdivr : return "fdivr";
case mnemocode::fdivrp : return "fdivrp";
case mnemocode::fmul : return "fmul";
case mnemocode::fmulp : return "fmulp";
case mnemocode::frndint : return "frndint";
case mnemocode::fsqrt : return "fsqrt";
case mnemocode::fsub : return "fsub";
case mnemocode::fsubp : return "fsubp";
case mnemocode::fsubr : return "fsubr";
case mnemocode::fsubrp : return "fsubrp";
case mnemocode::fiadd : return "fiadd";
case mnemocode::fidiv : return "fidiv";
case mnemocode::fidivr : return "fidivr";
case mnemocode::fimul : return "fimul";
case mnemocode::fisub : return "fisub";
case mnemocode::fisubr : return "fisubr";
case mnemocode::fcos : return "fcos";
case mnemocode::fpatan : return "fpatan";
case mnemocode::fptan : return "fptan";
case mnemocode::fsin : return "fsin";
case mnemocode::fsincos : return "fsincos";
case mnemocode::f2xm1 : return "f2xm1";
case mnemocode::fscale : return "fscale";
case mnemocode::fyl2x : return "fyl2x";
case mnemocode::fyl2xp1 : return "fyl2xp1";
case mnemocode::fnop : return "fnop";
case mnemocode::fprem : return "fprem";
case mnemocode::fprem1 : return "fprem1";
case mnemocode::fxtract : return "fxtract";
case mnemocode::trunc : return "trunc";
case mnemocode::sp_inc : return COLOR(3, "sp_inc");
case mnemocode::sp_dec : return COLOR(3, "sp_dec");
case mnemocode::bra : return COLOR(2, "bra" );
case mnemocode::ket : return COLOR(2, "ket" );
case mnemocode::endl : return COLOR(4, "endl" );
case mnemocode::alloca_ : return COLOR(7, "alloca");
case mnemocode::call : return COLOR(1, "call" );
case mnemocode::ret : return COLOR(1, "ret" );
case mnemocode::sahf : return "sahf";
}
}
开发者ID:tomilov,项目名称:insituc,代码行数:101,代码来源:mnemocodes.hpp
示例5: grey
inline COLOR grey(double g) { return COLOR(g,g,g); }
开发者ID:QuLogic,项目名称:jot-lib,代码行数:1,代码来源:colors.hpp
示例6: color_ub
//! \brief create a COLOR from unsigned bytes r, g, b
inline COLOR color_ub(unsigned char r, unsigned char g, unsigned char b) {
return COLOR(r/255.0, g/255.0, b/255.0);
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:4,代码来源:colors.hpp
示例7: get_var_color
// Given a Config variable name and a default COLOR value,
// return the corresponding COLOR if the variable is defined,
// otherwise return the default value:
inline CCOLOR get_var_color(const string& var_name, CCOLOR& default_val) {
string col_str = Config::get_var_str(var_name, color_to_str(default_val));
double r, g, b;
sscanf(col_str.c_str(), "%lf%lf%lf", &r, &g, &b);
return COLOR(r,g,b);
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:9,代码来源:colors.hpp
示例8:
CAMERA::CAMERA(void){
color=COLOR(0,0,0,0);
min=0.001f,max=1000,fovh=angle2rad(60),fovv=angle2rad(60.0f*0.75f);
}
开发者ID:ponycalypsenow,项目名称:oldies,代码行数:4,代码来源:render.cpp
示例9: main
void main() {
while (1) {
COLOR(RND());
draw_circle(RND() & 0xff, RND() & 0xff, (RND() & 0x1f) + 16);
}
}
开发者ID:rfotino,项目名称:consolite-compiler,代码行数:6,代码来源:circles.c
示例10: _tnl_Color4fv
static void
_tnl_Color4fv( const GLfloat *v )
{
GET_IMMEDIATE;
COLOR( IM, v[0], v[1], v[2], v[3] );
}
开发者ID:carriercomm,项目名称:finx,代码行数:6,代码来源:t_imm_api.c
示例11: _tnl_Color4f
static void
_tnl_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{
GET_IMMEDIATE;
COLOR( IM, red, green, blue, alpha );
}
开发者ID:carriercomm,项目名称:finx,代码行数:6,代码来源:t_imm_api.c
示例12: _tnl_Color3f
static void
_tnl_Color3f( GLfloat red, GLfloat green, GLfloat blue )
{
GET_IMMEDIATE;
COLOR( IM, red, green, blue, 1.0 );
}
开发者ID:carriercomm,项目名称:finx,代码行数:6,代码来源:t_imm_api.c
示例13: config_string_cb
//.........这里部分代码省略.........
case '1':
config.modifier = Mod1Mask;
return 1;
case '2':
config.modifier = Mod2Mask;
return 1;
case '3':
config.modifier = Mod3Mask;
return 1;
/*
case '4':
config.modifier = Mod4Mask;
return 1;
*/
case '5':
config.modifier = Mod5Mask;
return 1;
}
}
config.modifier = Mod4Mask;
return 1;
}
if (!strcmp(cur_key, "wheel_up_cmd")) {
DLOG("wheel_up_cmd = %.*s\n", len, val);
FREE(config.wheel_up_cmd);
sasprintf(&config.wheel_up_cmd, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "wheel_down_cmd")) {
DLOG("wheel_down_cmd = %.*s\n", len, val);
FREE(config.wheel_down_cmd);
sasprintf(&config.wheel_down_cmd, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "position")) {
DLOG("position = %.*s\n", len, val);
config.position = (len == 3 && !strncmp((const char *)val, "top", strlen("top")) ? POS_TOP : POS_BOT);
return 1;
}
if (!strcmp(cur_key, "status_command")) {
DLOG("command = %.*s\n", len, val);
sasprintf(&config.command, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "font")) {
DLOG("font = %.*s\n", len, val);
sasprintf(&config.fontname, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "outputs")) {
DLOG("+output %.*s\n", len, val);
int new_num_outputs = config.num_outputs + 1;
config.outputs = srealloc(config.outputs, sizeof(char *) * new_num_outputs);
sasprintf(&config.outputs[config.num_outputs], "%.*s", len, val);
config.num_outputs = new_num_outputs;
return 1;
}
if (!strcmp(cur_key, "tray_output")) {
DLOG("tray_output %.*s\n", len, val);
FREE(config.tray_output);
sasprintf(&config.tray_output, "%.*s", len, val);
return 1;
}
#define COLOR(json_name, struct_name) \
do { \
if (!strcmp(cur_key, #json_name)) { \
DLOG(#json_name " = " #struct_name " = %.*s\n", len, val); \
sasprintf(&(config.colors.struct_name), "%.*s", len, val); \
return 1; \
} \
} while (0)
COLOR(statusline, bar_fg);
COLOR(background, bar_bg);
COLOR(separator, sep_fg);
COLOR(focused_workspace_border, focus_ws_border);
COLOR(focused_workspace_bg, focus_ws_bg);
COLOR(focused_workspace_text, focus_ws_fg);
COLOR(active_workspace_border, active_ws_border);
COLOR(active_workspace_bg, active_ws_bg);
COLOR(active_workspace_text, active_ws_fg);
COLOR(inactive_workspace_border, inactive_ws_border);
COLOR(inactive_workspace_bg, inactive_ws_bg);
COLOR(inactive_workspace_text, inactive_ws_fg);
COLOR(urgent_workspace_border, urgent_ws_border);
COLOR(urgent_workspace_bg, urgent_ws_bg);
COLOR(urgent_workspace_text, urgent_ws_fg);
printf("got unexpected string %.*s for cur_key = %s\n", len, val, cur_key);
return 0;
}
开发者ID:smrt28,项目名称:i3,代码行数:101,代码来源:config.c
示例14: switch
//------------------------------------------------------------------------------
// ゲームの初期化
//------------------------------------------------------------------------------
// 引数
// なし
// 戻り値
// なし
//------------------------------------------------------------------------------
void CGame::Init(void)
{
gamePhase = PHASE_3;
gamePhaseCnt = 0;
gameEndCount = 0;
CSoundAL::Play(CSoundAL::BGM_GAME);
//地形生成
Ground = nullptr;
Ground = CMeshGround::Create(VECTOR3(0.0f,0.0f,0.0f),VECTOR2(FIELD_PANEL_SIZE,FIELD_PANEL_SIZE),VECTOR2(0,0),1.5f);
Ground->SetTex(CTexture::Texture(TEX_FIELD));
// 空生成
Sky = nullptr;
Sky = CMeshSphere::Create(VECTOR3(0.0f,0.0f,0.0f),VECTOR2(16.0f,8.0f),RADIUS_SKY);
Sky->SetTex(CTexture::Texture(TEX_SKY));
// 境界線生成
CylinderArea = nullptr;
CylinderArea = CBattleAreaCylinder::Create(VECTOR3(0.0f,0.0f,0.0f),HEIGHT_WALL,VECTOR2(64.0f,1.0f),RADIUS_AREA_BATTLE,VECTOR2(1,-0.5f));
CylinderArea->SetTex(CTexture::Texture(TEX_WALL));
CylinderArea->SetAlpha(0.5f);
Player = new CPlayer*[PLAYER_MAX];
// プレイヤー生成
for (int i = 0; i < PLAYER_MAX; i++)
{
if (i % 2 == 1)
Player[i] = CPlayer::Create(CModel::RINCHAN,PLAYER_POSITION_LIST[i],i);
else
Player[i] = CPlayer::Create(CModel::YOUJO,PLAYER_POSITION_LIST[i],i);
Player[i]->SetTex(CTexture::Texture(TEX_YOUJO_RED + i));
Player[i]->SetDestRot(PLAYER_ROTATION_LIST[i]);
Player[i]->SetRot(PLAYER_ROTATION_LIST[i]);
Player[i]->setBarrelTex(TEX_YOUJO_RED + i);
if (i == CManager::netData.charNum)
{
Player[i]->SetPlayerFlag(true);
Player[i]->CreateBallistic();
}
}
//プレイヤーカメラ生成
CPlayerCamera::Create(Player[CManager::netData.charNum],35.0f);
// 【テスト】各プレイヤーの色をセット
for(int i = 0; i < PLAYER_MAX; i++)
{
switch(i)
{
// 赤
case 0:
Player[i]->SetPlayerColor(RED(0.5f));
break;
// 青
case 1:
Player[i]->SetPlayerColor(BLUE(0.5f));
break;
// 水
case 2:
Player[i]->SetPlayerColor(CYAN(0.5f));
break;
// 橙
case 3:
Player[i]->SetPlayerColor(COLOR(1.0f, 0.7f, 0.0f, 0.5f));
break;
// 白
case 4:
Player[i]->SetPlayerColor(WHITE(0.5f));
break;
// P
case 5:
Player[i]->SetPlayerColor(YELLOW(0.5f));
break;
default:
break;
}
}
// プレイヤーの入力を止める
for (int i = 0; i < PLAYER_MAX; i++){
Player[i]->SetInputFlag(false);
}
//.........这里部分代码省略.........
开发者ID:AT13ANo5,项目名称:GLProject,代码行数:101,代码来源:Game.cpp
示例15: InitMenu
void InitMenu()
{
/* Reset variables */
TabIndex = TAB_ABOUT;
Background = NULL;
/* Initialize paths */
sprintf(SaveStatePath, "%ssavedata/", pl_psp_get_app_directory());
sprintf(ScreenshotPath, "%sscreenshot/", pl_psp_get_app_directory());
sprintf(GamePath, "%s", pl_psp_get_app_directory());
if (!pl_file_exists(SaveStatePath))
pl_file_mkdir_recursive(SaveStatePath);
/* Initialize options */
LoadOptions();
InitEmulator();
/* Load the background image */
pl_file_path background;
snprintf(background, sizeof(background) - 1, "%sbackground.png",
pl_psp_get_app_directory());
Background = pspImageLoadPng(background);
//Background = pspImageLoadPng("background.png");
/* Init NoSaveState icon image */
NoSaveIcon = pspImageCreate(136, 114, PSP_IMAGE_16BPP);
pspImageClear(NoSaveIcon, RGB(0x0c,0,0x3f));
/* Initialize state menu */
int i;
pl_menu_item *item;
for (i = 0; i < 10; i++)
{
item = pl_menu_append_item(&SaveStateGallery.Menu, i, NULL);
pl_menu_set_item_help_text(item, EmptySlotText);
}
/* Initialize menus */
pl_menu_create(&SystemUiMenu.Menu, SystemMenuDef);
pl_menu_create(&OptionUiMenu.Menu, OptionMenuDef);
pl_menu_create(&ControlUiMenu.Menu, ControlMenuDef);
/* Load default configuration */
LoadButtonConfig();
/* Initialize UI components */
UiMetric.Background = Background;
UiMetric.Font = &PspStockFont;
UiMetric.Left = 16;
UiMetric.Top = 48;
UiMetric.Right = 944;
UiMetric.Bottom = 500;
UiMetric.OkButton = (!Options.ControlMode) ? PSP_CTRL_CROSS : PSP_CTRL_CIRCLE;
UiMetric.CancelButton = (!Options.ControlMode) ? PSP_CTRL_CIRCLE : PSP_CTRL_CROSS;
UiMetric.ScrollbarColor = PSP_COLOR_GRAY;
UiMetric.ScrollbarBgColor = 0x44ffffff;
UiMetric.ScrollbarWidth = 10;
UiMetric.TextColor = PSP_COLOR_GRAY;
UiMetric.SelectedColor = PSP_COLOR_YELLOW;
UiMetric.SelectedBgColor = COLOR(0xff,0xff,0xff,0x44);
UiMetric.StatusBarColor = PSP_COLOR_WHITE;
UiMetric.BrowserFileColor = PSP_COLOR_GRAY;
UiMetric.BrowserDirectoryColor = PSP_COLOR_YELLOW;
UiMetric.GalleryIconsPerRow = 5;
UiMetric.GalleryIconMarginWidth = 8;
UiMetric.MenuItemMargin = 20;
UiMetric.MenuSelOptionBg = PSP_COLOR_BLACK;
UiMetric.MenuOptionBoxColor = PSP_COLOR_GRAY;
UiMetric.MenuOptionBoxBg = COLOR(0, 0, 33, 0xBB);
UiMetric.MenuDecorColor = PSP_COLOR_YELLOW;
UiMetric.DialogFogColor = COLOR(0, 0, 0, 88);
UiMetric.TitlePadding = 4;
UiMetric.TitleColor = PSP_COLOR_WHITE;
UiMetric.MenuFps = 30;
UiMetric.TabBgColor = COLOR(0x74,0x74,0xbe,0xff);
UiMetric.BrowserScreenshotPath = ScreenshotPath;
UiMetric.BrowserScreenshotDelay = 30;
}
开发者ID:Meradrin,项目名称:Genesis-Plus-GX,代码行数:81,代码来源:menu.c
示例16: game_do
static void game_do(game_t *p_game)
{
item_t turn = p_game->starting_color;
int eval = 0;
bool_t selected = FALSE;
p_game->selected_x = -1;
p_game->selected_y = -1;
while (1)
{
fe_point_t where;
move_t move;
if (abs(eval) > 1000)
{
game_won(p_game, eval);
eval = 0;
}
if (turn == p_game->computer_color)
{
game_minimax(p_game, p_game->p_playfield, turn,
0, 1, &move);
playfield_do_move(p_game->p_playfield, p_game, move.sx, move.sy, move.dx, move.dy);
turn = (turn == PF_BLACK) ? PF_WHITE : PF_BLACK;
eval = game_eval_playfield(p_game, p_game->p_playfield, turn);
game_draw_status(p_game, turn);
continue;
}
if (fe_get_stylus(&where) == TRUE)
{
uint8_t field_x = where.x / BRICK_WIDTH;
uint8_t field_y = where.y / BRICK_HEIGHT;
item_t item = playfield_get_item(p_game->p_playfield, field_x, field_y);
rnd += field_x ^ rnd;
/* Select something */
if (COLOR(item) == turn)
{
/* Within field, correct color */
game_draw_one_pos(p_game, p_game->selected_x, p_game->selected_y, 0);
game_draw_one_pos(p_game, field_x, field_y, 1);
selected = TRUE;
p_game->selected_x = field_x;
p_game->selected_y = field_y;
}
else if (selected && item == PF_EMPTY)
{
/* Destination - move to! */
if (playfield_can_move(p_game->p_playfield, p_game->selected_x, p_game->selected_y, field_x, field_y))
{
playfield_do_move(p_game->p_playfield, p_game, p_game->selected_x, p_game->selected_y, field_x, field_y);
turn = (turn == PF_BLACK) ? PF_WHITE : PF_BLACK;
}
game_draw_status(p_game, turn);
selected = FALSE;
eval = game_eval_playfield(p_game, p_game->p_playfield, turn);
}
else
{
/* Pressed outside the playfield */
game_draw_one_pos(p_game, p_game->selected_x, p_game->selected_y, 0);
selected = FALSE;
/* Handle the buttons */
if (IN_RECT(where.x, where.y,
RESTART_BUTTON_X, RESTART_BUTTON_Y, 34, 13))
{
p_game->restart = 1;
game_won(p_game, 0);
p_game->restart = 0;
}
if (IN_RECT(where.x, where.y,
HUMAN_BUTTON_X, HUMAN_BUTTON_Y, 13, 13))
p_game->computer_color = PF_INVALID;
else if (IN_RECT(where.x, where.y,
BLACK_BUTTON_X, BLACK_BUTTON_Y, 13, 13))
p_game->computer_color = PF_BLACK;
else if (IN_RECT(where.x, where.y,
WHITE_BUTTON_X, WHITE_BUTTON_Y, 13, 13))
p_game->computer_color = PF_WHITE;
game_draw_status(p_game, turn);
}
}
if ( fe_get_buttons() == FE_EVENT_EXIT)
break;
}
}
开发者ID:SimonKagstrom,项目名称:old-projects,代码行数:91,代码来源:main.c
示例17: print_label
void print_label(int n)
{
ft_printf(C_256 "%d " RESET_ANSI, COLOR(n), n);
}
开发者ID:pmclaugh,项目名称:push_swap,代码行数:4,代码来源:prints.c
示例18: main
//.........这里部分代码省略.........
* Enter each curve point as a coordinate pair using the plotdata
* insertion operator "<<" ( or use the "point" function instead).
*/
for (int i = -180 ; i <= 180; i++)
{
double y_value = i / 180.0 + cos(DEG_TO_RAD * i);
x << i;
y << y_value;
/* "<<" inserts a new value into the plot data.
* You could instead use the point function, with
* point(x, y, x_value, y_value); if you prefer.
*/
}
/* Graph drawn in blue colour (Each data point is joined to
* the preceding and following points, forming the curve.).
*/
plot(x, y, BLUE);
/**********************************************/
/* Plot function y = sin(x) between 0 and 360 */
x = plotdata(0.0, 360.0);
y = sin(x * DEG_TO_RAD);
/* Give the function name to be printed as the window label */
plot(x, y, CRIMSON, "sin(x)");
/*****************************************************************/
/* Plot user-defined unary function f(x) = sinc between -6 and 6 */
x = plotdata(-6.0, 6.0);
f(x) = sinc; /* sinc is defined at the bottom of this file. */
plot(x, f(x), "sinc(x)");
/*****************************************************************/
/* Plot user-defined binary function y = tanLessThan(x, max) */
/* Read tanLessThan code to see how values > max are not plotted */
x = plotdata(-270.0, 270.0);
f2(x) = tanLessThan;
/* Do not plot y values greater than 20 */
plot(x, f2(x, 20), "tan(x)", REDRED);
/*********************************************************************/
/* Plot 2 functions on same graph (could be any number of functions) */
/* Define Y as two functions */
clear(x); /* Re-use old X, but change its range to -75..245 degrees */
x << plotdata(-80.0, 255.0);
y = f2(x, 3); /* First function */
breakplot(x, y); /* Break the plot between functions */
/* You could also use x << NOPLOT; y << NOPLOT; instead.*/
/* Define second function (2cos(2x)) on same range "point-by-point" */
for(int i = -80; i <= 255; i++)
{
x << i;
y << 2 * cos(2 * i * DEG_TO_RAD);
}
plot(x, y, "tan(x) and 2cos(2x)", BLUEBLUE);
/***********************************************************
* You can also use the << operator to insert data at the end
* of already entered plot data in order to draw 2 or more
* functions.
*
* Use NOPLOT to separate different function data in both X
* and Y, but be careful of the order of insertion! Each NOPLOT
* in X must correspond to a NOPLOT in Y.
*
* Koolplot does not plot NOPLOT values.
*/
x = plotdata(-315.0, 45.0);
y = sin(x * DEG_TO_RAD);
plotdata z = cos(x * DEG_TO_RAD);
plotdata p = sin(2 * (x - 45) * DEG_TO_RAD);
plotdata q = cos(2 * x * DEG_TO_RAD);
setColor(x, y, CRIMSON); // Will also break the plot
x << plotdata(-315.0, 45.0);
y << z;
setColor(x, y, DARKORANGE );
x << plotdata(-315.0, 45.0);
y << p;
setColor(x, y, BLUEBLUE );
x << plotdata(-315.0, 45.0);
y << q;
// Default plot colour is green
plot(x, y, COLOR(0,160,0),
" sin(x) -green-, cos(x) -red-, sin(2x - 45) -orange-, cos(2x) -blue-");
/*************************************************/
return 0;
}
开发者ID:mosinski,项目名称:Projekty-C,代码行数:101,代码来源:kplot.c
示例19: fromRGBA32
void fromRGBA32(Comp32 rgba) {
RGBA32 tmp;
tmp.rgba = COLOR(rgba);
fromRGBA8(tmp.r, tmp.g, tmp.b, tmp.a);
}
开发者ID:AxioDL,项目名称:zeus,代码行数:5,代码来源:CColor.hpp
示例20: fill_profile_color
void fill_profile_color()
{
#define COLOR(x, y, z) QVector<QColor>() << x << y << z;
profile_color[SAC_1] = COLOR(FUNGREEN1, BLACK1_LOW_TRANS, FUNGREEN1);
profile_color[SAC_2] = COLOR(APPLE1, BLACK1_LOW_TRANS, APPLE1);
profile_color[SAC_3] = COLOR(ATLANTIS1, BLACK1_LOW_TRANS, ATLANTIS1);
profile_color[SAC_4] = COLOR(ATLANTIS2, BLACK1_LOW_TRANS, ATLANTIS2);
profile_color[SAC_5] = COLOR(EARLSGREEN1, BLACK1_LOW_TRANS, EARLSGREEN1);
profile_color[SAC_6] = COLOR(HOKEYPOKEY1, BLACK1_LOW_TRANS, HOKEYPOKEY1);
profile_color[SAC_7] = COLOR(TUSCANY1, BLACK1_LOW_TRANS, TUSCANY1);
profile_color[SAC_8] = COLOR(CINNABAR1, BLACK1_LOW_TRANS, CINNABAR1);
profile_color[SAC_9] = COLOR(REDORANGE1, BLACK1_LOW_TRANS, REDORANGE1);
profile_color[VELO_STABLE] = COLOR(CAMARONE1, BLACK1_LOW_TRANS, CAMARONE1);
profile_color[VELO_SLOW] = COLOR(LIMENADE1, BLACK1_LOW_TRANS, LIMENADE1);
profile_color[VELO_MODERATE] = COLOR(RIOGRANDE1, BLACK1_LOW_TRANS, RIOGRANDE1);
profile_color[VELO_FAST] = COLOR(PIRATEGOLD1, BLACK1_LOW_TRANS, PIRATEGOLD1);
profile_color[VELO_CRAZY] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
profile_color[PO2] = COLOR(APPLE1, BLACK1_LOW_TRANS, APPLE1);
profile_color[PO2_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
profile_color[PN2] = COLOR(BLACK1_LOW_TRANS, BLACK1_LOW_TRANS, BLACK1_LOW_TRANS);
profile_color[PN2_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
profile_color[PHE] = COLOR(PEANUT, BLACK1_LOW_TRANS, PEANUT);
profile_color[PHE_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
profile_color[PP_LINES] = COLOR(BLACK1_HIGH_TRANS, BLACK1_LOW_TRANS, BLACK1_HIGH_TRANS);
profile_color[TEXT_BACKGROUND] = COLOR(CONCRETE1_LOWER_TRANS, WHITE1, CONCRETE1_LOWER_TRANS);
profile_color[ALERT_BG] = COLOR(BROOM1_LOWER_TRANS, BLACK1_LOW_TRANS, BROOM1_LOWER_TRANS);
profile_color[ALERT_FG] = COLOR(BLACK1_LOW_TRANS, WHITE1, BLACK1_LOW_TRANS);
profile_color[EVENTS] = COLOR(REDORANGE1, BLACK1_LOW_TRANS, REDORANGE1);
profile_color[SAMPLE_DEEP] = COLOR(QColor(Qt::red).darker(), BLACK1, PERSIANRED1);
profile_color[SAMPLE_SHALLOW] = COLOR(QColor(Qt::red).lighter(), BLACK1_LOW_TRANS, PERSIANRED1);
profile_color[SMOOTHED] = COLOR(REDORANGE1_HIGH_TRANS, BLACK1_LOW_TRANS, REDORANGE1_HIGH_TRANS);
profile_color[MINUTE] = COLOR(MEDIUMREDVIOLET1_HIGHER_TRANS, BLACK1_LOW_TRANS, MEDIUMREDVIOLET1_HIGHER_TRANS);
profile_color[TIME_GRID] = COLOR(WHITE1, BLACK1_HIGH_TRANS, TUNDORA1_MED_TRANS);
profile_color[TIME_TEXT] = COLOR(FORESTGREEN1, BLACK1, FORESTGREEN1);
profile_color[DEPTH_GRID] = COLOR(WHITE1, BLACK1_HIGH_TRANS, TUNDORA1_MED_TRANS);
profile_color[MEAN_DEPTH] = COLOR(REDORANGE1_MED_TRANS, BLACK1_LOW_TRANS, REDORANGE1_MED_TRANS);
profile_color[DEPTH_BOTTOM] = COLOR(GOVERNORBAY1_MED_TRANS, BLACK1_HIGH_TRANS, GOVERNORBAY1_MED_TRANS);
profile_color[DEPTH_TOP] = COLOR(MERCURY1_MED_TRANS, WHITE1_MED_TRANS, MERCURY1_MED_TRANS);
profile_color[TEMP_TEXT] = COLOR(GOVERNORBAY2, BLACK1_LOW_TRANS, GOVERNORBAY2);
profile_color[TEMP_PLOT] = COLOR(ROYALBLUE2_LOW_TRANS, BLACK1_LOW_TRANS, ROYALBLUE2_LOW_TRANS);
profile_color[SAC_DEFAULT] = COLOR(WHITE1, BLACK1_LOW_TRANS, FORESTGREEN1);
profile_color[BOUNDING_BOX] = COLOR(WHITE1, BLACK1_LOW_TRANS, TUNDORA1_MED_TRANS);
profile_color[PRESSURE_TEXT] = COLOR(KILLARNEY1, BLACK1_LOW_TRANS, KILLARNEY1);
profile_color[BACKGROUND] = COLOR(SPRINGWOOD1, WHITE1, SPRINGWOOD1);
profile_color[CEILING_SHALLOW] = COLOR(REDORANGE1_HIGH_TRANS, BLACK1_HIGH_TRANS, REDORANGE1_HIGH_TRANS);
profile_color[CEILING_DEEP] = COLOR(RED1_MED_TRANS, BLACK1_HIGH_TRANS, RED1_MED_TRANS);
profile_color[CALC_CEILING_SHALLOW] = COLOR(FUNGREEN1_HIGH_TRANS, BLACK1_HIGH_TRANS, FUNGREEN1_HIGH_TRANS);
profile_color[CALC_CEILING_DEEP] = COLOR(APPLE1_HIGH_TRANS, BLACK1_HIGH_TRANS, APPLE1_HIGH_TRANS);
#undef COLOR
}
开发者ID:Exhora,项目名称:subsurface,代码行数:53,代码来源:graphicsview-common.cpp
注:本文中的COLOR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论