void drawline(int x, t_env *e, t_rgb *c) { t_coordint p; t_rgb skyfloor; p.x = x; e->img.d = mlx_get_data_addr(e->img.img, &e->img.bp, &e->img.s, &e->img.e); set_colors(&skyfloor, 128, 128, 128); p.y = 0; while (p.y < e->r.ystart) { mlx_image_put_pixel(e, &(e->img), p, &skyfloor); p.y++; } p.y = e->r.ystart; while (p.y < e->r.yend) { mlx_image_put_pixel(e, &(e->img), p, c); p.y++; } set_colors(&skyfloor, 102, 51, 0); p.y = e->r.yend; while (p.y < WIN_HEIGH) { mlx_image_put_pixel(e, &(e->img), p, &skyfloor); p.y++; } }
static int get_fbinfo(l4re_video_view_info_t *vinfo) { vinfo->width = use_xga ? 1024 : 640; vinfo->height = use_xga ? 768 : 480; vinfo->pixel_info.bytes_per_pixel = 2; vinfo->bytes_per_line = 2 * vinfo->width; if ((config_use_565 && type == PL111) || (is_qemu && type == PL110)) { if (config_do_bgr) set_colors(vinfo, 5, 6, 5, 11, 5, 0); else set_colors(vinfo, 5, 6, 5, 0, 5, 11); } else { if (config_do_bgr) set_colors(vinfo, 5, 5, 5, 10, 5, 0); else set_colors(vinfo, 5, 5, 5, 0, 5, 10); } return 0; }
static void fdf_draw_line(t_fdf *fdf, t_uint x, t_uint y) { t_pt *pt1; t_pt *pt2; t_color *colors[2]; pt1 = &(fdf->map[y][x]); if (x < fdf->width - 1) { pt2 = &(fdf->map[y][x + 1]), set_colors(fdf, pt1, pt2, colors); if (pt1->z > pt2->z) colors_swap(colors); if (fdf->use_colors) draw_line_gradient(fdf->gfx, pt1, pt2, colors); else draw_line(fdf->gfx, pt1, pt2, 0xffffff); } if (y < fdf->height - 1) { pt2 = &(fdf->map[y + 1][x]), set_colors(fdf, pt1, pt2, colors); if (pt1->z > pt2->z) colors_swap(colors); if (fdf->use_colors) draw_line_gradient(fdf->gfx, pt1, pt2, colors); else draw_line(fdf->gfx, pt1, pt2, 0xffffff); } }
void colors(t_env *e, t_rgb *c) { if (e->player.wallside == 0) if (e->player.step.x < 0) set_colors(c, 178, 255, 102); else set_colors(c, 102, 255, 255); else if (e->player.step.y < 0) set_colors(c, 255, 178, 102); else set_colors(c, 0, 153, 153); }
/* * Bouncing balls */ static int BouncingBalls(WINDOW *win) { int w, h; int x1, y1, xd1, yd1; int x2, y2, xd2, yd2; int x3, y3, xd3, yd3; getmaxyx(win, h, w); x1 = 2 + rand() % (w - 4); y1 = 2 + rand() % (h - 4); x2 = 2 + rand() % (w - 4); y2 = 2 + rand() % (h - 4); x3 = 2 + rand() % (w - 4); y3 = 2 + rand() % (h - 4); xd1 = 1; yd1 = 1; xd2 = 1; yd2 = 0; xd3 = 0; yd3 = 1; nodelay(win, TRUE); while (wgetch(win) == ERR) { x1 = bounce(x1, &xd1, w); y1 = bounce(y1, &yd1, h); x2 = bounce(x2, &xd2, w); y2 = bounce(y2, &yd2, h); x3 = bounce(x3, &xd3, w); y3 = bounce(y3, &yd3, h); set_colors(win, 11, COLOR_RED, COLOR_BLUE); MvWAddCh(win, y1, x1, 'O'); set_colors(win, 12, COLOR_BLUE, COLOR_RED); MvWAddCh(win, y2, x2, '*'); set_colors(win, 13, COLOR_YELLOW, COLOR_WHITE); MvWAddCh(win, y3, x3, '@'); wmove(win, 0, 0); wrefresh(win); delay_output(100); } return 0; }
static void start_or_pause(ClickRecognizerRef recognizer, void *context) { if (paused || (seconds < 0) || ((working == 0) && (resting == 0))) { if (lap == 0) { lap = 1; update_lap_text(); } APP_LOG(APP_LOG_LEVEL_DEBUG, "Start: %02d", seconds); working = 1; resting = 0; paused = 0; seconds--; show_time(); set_colors(work); text_layer_set_text(next_layer, empty); text_layer_set_text(exercise_layer, exercise[current_exercise]); if (timer) { app_timer_cancel(timer); } timer = app_timer_register(timer_interval_ms, timer_callback, NULL); } else { APP_LOG(APP_LOG_LEVEL_DEBUG, "Pause: %02d", seconds); paused = 1; if (timer) { app_timer_cancel(timer); timer = NULL; } text_layer_set_text(next_layer, "SEL to continue"); } }
void init_env(t_env *env) { srand(time(NULL)); env->mlx = mlx_init(); env->win = mlx_new_window(env->mlx, WINX, WINY, "fractol"); env->winop = mlx_new_window(env->mlx, 450, 370, "commandes"); env->img = mlx_new_image(env->mlx, WINX, WINY); env->pix = mlx_get_data_addr(env->img, &env->bpp, &env->s_l, &env->endian); env->fract = 'm'; env->maxiter = 23; env->movx = 0; env->movy = 0; env->zoom = 1.0; env->palette = 1; env->cx = 0.0; env->cy = 0.0; env->njul = 2; env->rdmclr = 0; env->riter = 2; env->rzoom = 1.0; env->rmovx = 0; env->rmovy = 0; env->music = 0; env->modif = 0; set_colors(env); draw_options(env); }
/** * \brief Draws the vertices in the case where there are textures. */ void bear::visual::gl_state::draw_textured() const { if ( m_vertices.empty() ) return; enable_shader(); set_colors(); set_vertices(); set_texture_coordinates(); for ( element_range_list::const_iterator it(m_elements.begin()); it!=m_elements.end(); ++it ) { glBindTexture( GL_TEXTURE_2D, it->texture_id ); VISUAL_GL_ERROR_THROW(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); VISUAL_GL_ERROR_THROW(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); VISUAL_GL_ERROR_THROW(); glDrawArrays( get_gl_render_mode(), it->vertex_index, it->count ); VISUAL_GL_ERROR_THROW(); } disable_states(); } // gl_state::draw_textured()
int load_colors(XFILE *file) { int nc, *colors; long n, h; if ((n = x_fread(file, &nc, sizeof(int))) < 0) return (int) n; h = (long) nc *3L * sizeof(int); if ((colors = malloc(h)) == NULL) return ENSMEM; if ((n = x_fread(file, colors, h)) != h) return (n < 0) ? (int) n : EEOF; if (nc == ncolors) set_colors(colors); else alert_printf(1, MECOLORS); free(colors); return 0; }
void colors(t_env *e, t_rgb *c) { if (e->player.wallside == 0) { if (e->player.step.x < 0) set_colors(c, 0, 0, 255); else set_colors(c, 0, 255, 0); } else { if (e->player.step.y < 0) set_colors(c, 255, 0, 255); else set_colors(c, 255, 255, 0); } }
static void set_colors_alpha (const GLfloat *color, GLfloat a) { GLfloat c[countof(leviathan_color)]; memcpy (c, color, sizeof(c)); c[3] = c[7] = c[11] = a; set_colors (c); }
int my_loop_hook(t_env *env) { if (env->rdmclr) { set_colors(env); draw_fract(env); } return (0); }
void QtCalculator::invertColors(){ QColor tmpcolor; if(calc_display->isLit()){ tmpcolor = kcalcdefaults.backcolor; kcalcdefaults.backcolor = kcalcdefaults.forecolor; kcalcdefaults.forecolor = tmpcolor; set_colors(); tmpcolor = kcalcdefaults.backcolor; kcalcdefaults.backcolor = kcalcdefaults.forecolor; kcalcdefaults.forecolor = tmpcolor; } else{ set_colors(); //printf("normal Colors\n"); } }
/* initialize curses colors */ void init_colors (int force) { /* use default foreground/background colors */ use_default_colors (); /* first set a default normal color */ set_normal_color (); /* then parse custom colors and initialize them */ set_colors (force); }
Button::Button() { init(NULL, NULL, ""); set_colors(BUTTON_DEFAULT_COLORS, BUTTON_DEFAULT_COLORS); colors[BUTTON_DISABLED] = BUTTON_DISABLED_COLORS; x = 0; y = 0; state = BUTTON_NORMAL; }
int my_hook_events(int x, int y, t_env *env) { if (env->modif) { env->cx = -1 + 2.0 * x / WINX; env->cy = -1 + 2.0 * y / WINY; } if (env->rdmclr) set_colors(env); draw_fract(env); return (0); }
static void e_minicard_label_realize (GnomeCanvasItem *item) { EMinicardLabel *e_minicard_label; GnomeCanvasGroup *group; e_minicard_label = E_MINICARD_LABEL (item); group = GNOME_CANVAS_GROUP ( item ); if (GNOME_CANVAS_ITEM_CLASS ( parent_class )->realize) (* GNOME_CANVAS_ITEM_CLASS ( parent_class )->realize) (item); e_canvas_item_request_reflow (item); e_minicard_label->rect = gnome_canvas_item_new ( group, gnome_canvas_rect_get_type (), "x1", (double) 0, "y1", (double) 0, "x2", (double) e_minicard_label->width - 1, "y2", (double) e_minicard_label->height - 1, "outline_color", NULL, NULL ); e_minicard_label->fieldname = gnome_canvas_item_new ( group, e_text_get_type (), "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), "clip", TRUE, "use_ellipsis", TRUE, "fill_color", "black", "draw_background", FALSE, "im_context", E_CANVAS (item->canvas)->im_context, NULL ); e_canvas_item_move_absolute (e_minicard_label->fieldname, 2, 1); e_minicard_label->field = gnome_canvas_item_new ( group, e_text_get_type (), "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), "clip", TRUE, "use_ellipsis", TRUE, "fill_color", "black", "editable", FALSE, /* e_minicard_label->editable, */ "draw_background", FALSE, "im_context", E_CANVAS (item->canvas)->im_context, NULL ); e_canvas_item_move_absolute (e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); set_colors (e_minicard_label); e_canvas_item_request_reflow (item); }
int set_menu_colors(struct Colors *colors) { /* SCREEN OUTLINE and CURSOR */ G_add_color_rule((CELL) 241, 180, 180, 180, (CELL) 241, 180, 180, 180, colors); /* RED */ G_add_color_rule((CELL) 242, 200, 90, 90, (CELL) 242, 200, 90, 90, colors); /* ORANGE */ G_add_color_rule((CELL) 243, 150, 100, 50, (CELL) 243, 150, 100, 50, colors); /* YELLOW */ G_add_color_rule((CELL) 244, 200, 200, 10, (CELL) 244, 200, 200, 10, colors); /* GREEN */ G_add_color_rule((CELL) 245, 90, 200, 90, (CELL) 245, 90, 200, 90, colors); /* BLUE */ G_add_color_rule((CELL) 246, 90, 90, 200, (CELL) 246, 90, 90, 200, colors); /* INDIGO */ G_add_color_rule((CELL) 247, 100, 100, 10, (CELL) 247, 100, 100, 10, colors); /* VIOLET */ G_add_color_rule((CELL) 248, 150, 150, 10, (CELL) 248, 150, 150, 10, colors); /* WHITE */ G_add_color_rule((CELL) 249, 250, 250, 250, (CELL) 249, 250, 250, 250, colors); /* BLACK */ G_add_color_rule((CELL) 250, 0, 0, 0, (CELL) 250, 0, 0, 0, colors); /* GRAY */ G_add_color_rule((CELL) 251, 180, 180, 180, (CELL) 251, 180, 180, 180, colors); /* BROWN */ G_add_color_rule((CELL) 252, 100, 100, 30, (CELL) 252, 100, 100, 30, colors); /* MAGENTA */ G_add_color_rule((CELL) 253, 150, 90, 150, (CELL) 253, 150, 90, 150, colors); /* AQUA */ G_add_color_rule((CELL) 254, 50, 120, 120, (CELL) 254, 50, 120, 120, colors); /* */ G_add_color_rule((CELL) 255, 250, 0, 0, (CELL) 255, 250, 0, 0, colors); set_colors(colors); return 0; }
/* * Test sub windows */ static int SubWinTest(WINDOW *win) { int w, h, sw, sh, bx, by; WINDOW *swin1, *swin2, *swin3; getmaxyx(win, h, w); getbegyx(win, by, bx); sw = w / 3; sh = h / 3; if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) return 1; if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) return 1; if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) return 1; set_colors(swin1, 8, COLOR_RED, COLOR_BLUE); werase(swin1); MvWAddStr(swin1, 0, 3, "Sub-window 1"); wrefresh(swin1); set_colors(swin2, 9, COLOR_CYAN, COLOR_MAGENTA); werase(swin2); MvWAddStr(swin2, 0, 3, "Sub-window 2"); wrefresh(swin2); set_colors(swin3, 10, COLOR_YELLOW, COLOR_GREEN); werase(swin3); MvWAddStr(swin3, 0, 3, "Sub-window 3"); wrefresh(swin3); delwin(swin1); delwin(swin2); delwin(swin3); WaitForUser(win); return 0; }
static void timer_callback(void *data) { // APP_LOG(APP_LOG_LEVEL_DEBUG, "Timer: %02d", seconds); seconds--; if (seconds <= 0) { if (working) { set_colors(rest); working = 0; resting = 1; seconds = default_rest; text_layer_set_text(exercise_layer, "Rest"); int next_exercise = current_exercise + 1; if (next_exercise >= exercises) { next_exercise = 0; } update_next_text(next_exercise); APP_LOG(APP_LOG_LEVEL_DEBUG, "Changed mode to Rest, next %s", exercise[next_exercise]); } else { set_colors(work); working = 1; resting = 0; seconds = default_work; current_exercise++; if (current_exercise >= exercises) { lap++; current_exercise = 0; } update_lap_text(); text_layer_set_text(exercise_layer, exercise[current_exercise]); text_layer_set_text(next_layer, empty); APP_LOG(APP_LOG_LEVEL_DEBUG, "Started %s", exercise[current_exercise]); } } timer = app_timer_register(timer_interval_ms, timer_callback, NULL); show_time(); }
static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) { EMinicardLabel *e_minicard_label; e_minicard_label = E_MINICARD_LABEL (item); switch (event->type) { case GDK_KEY_PRESS: if (event->key.keyval == GDK_KEY_Escape) { GnomeCanvasItem *parent; e_text_cancel_editing (E_TEXT (e_minicard_label->field)); parent = GNOME_CANVAS_ITEM (e_minicard_label)->parent; if (parent) e_canvas_item_grab_focus (parent, FALSE); } break; case GDK_FOCUS_CHANGE: { GdkEventFocus *focus_event = (GdkEventFocus *) event; e_minicard_label->has_focus = focus_event->in; set_colors (e_minicard_label); g_object_set (e_minicard_label->field, "handle_popup", e_minicard_label->has_focus, NULL); break; } case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: case GDK_MOTION_NOTIFY: case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: { gboolean return_val; g_signal_emit_by_name(e_minicard_label->field, "event", event, &return_val); return return_val; } default: break; } if (GNOME_CANVAS_ITEM_CLASS ( parent_class )->event) return (* GNOME_CANVAS_ITEM_CLASS ( parent_class )->event) (item, event); else return 0; }
static void ntconio_open(void) { CONSOLE_CURSOR_INFO newcci; BOOL newcci_ok; TRACE(("ntconio_open\n")); set_colors(NCOLORS); set_palette(initpalettestr); hOldConsoleOutput = 0; hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); origcci_ok = GetConsoleCursorInfo(hConsoleOutput, &origcci); GetConsoleScreenBufferInfo(hConsoleOutput, &csbi); if (csbi.dwMaximumWindowSize.Y != csbi.srWindow.Bottom - csbi.srWindow.Top + 1 || csbi.dwMaximumWindowSize.X != csbi.srWindow.Right - csbi.srWindow.Left + 1) { TRACE(("..creating alternate screen buffer\n")); hOldConsoleOutput = hConsoleOutput; hConsoleOutput = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); SetConsoleActiveScreenBuffer(hConsoleOutput); GetConsoleScreenBufferInfo(hConsoleOutput, &csbi); newcci_ok = GetConsoleCursorInfo(hConsoleOutput, &newcci); if (newcci_ok && origcci_ok && newcci.dwSize != origcci.dwSize) { /* * Ensure that user's cursor size prefs are carried forward * in the newly created console. */ show_cursor(TRUE, origcci.dwSize); } } originalAttribute = csbi.wAttributes; crow = csbi.dwCursorPosition.Y; ccol = csbi.dwCursorPosition.X; nfcolor = cfcolor = gfcolor; nbcolor = cbcolor = gbcolor; set_current_attr(); newscreensize(csbi.dwMaximumWindowSize.Y, csbi.dwMaximumWindowSize.X); hConsoleInput = GetStdHandle(STD_INPUT_HANDLE); SetConsoleCtrlHandler(nthandler, TRUE); }
Button::Button(Canvas *the_canvas, Font *the_font, const char *the_text) { init(the_canvas, the_font, the_text); set_colors(BUTTON_DEFAULT_COLORS, BUTTON_DEFAULT_COLORS); colors[BUTTON_DISABLED] = BUTTON_DISABLED_COLORS; x = 0; y = 0; width = font->string_width(text) + BUTTON_DEFAULT_PADDING; height = font->get_font_height() + BUTTON_DEFAULT_PADDING; center_text(); state = BUTTON_NORMAL; }
void reinit_env(t_env *env) { env->maxiter = 23; env->movx = 0; env->movy = 0; env->zoom = 1.0; env->cx = 0.0; env->cy = 0.0; env->modif = 0; env->njul = 2; env->riter = 2; env->rzoom = 1.0; env->rmovx = 0; env->rmovy = 0; set_colors(env); }
static void reset(void) { if (timer) { app_timer_cancel(timer); timer = NULL; } working = 0; resting = 0; paused = 0; current_exercise = 0; lap = 0; seconds = default_work; set_colors(rest); text_layer_set_text(exercise_layer, empty); show_time(); update_next_text(current_exercise); update_lap_text(); }
static int set_cur_clr(int curs_color) { struct Colors *colors; colors = &VIEW_MAP1->cell.colors; switch (curs_color) { case BLUE: G_add_color_rule((CELL) 241, 90, 90, 200, (CELL) 241, 90, 90, 200, colors); break; case GRAY: G_add_color_rule((CELL) 241, 180, 180, 180, (CELL) 241, 180, 180, 180, colors); break; case GREEN: G_add_color_rule((CELL) 241, 90, 200, 90, (CELL) 241, 90, 200, 90, colors); break; case RED: G_add_color_rule((CELL) 241, 200, 90, 90, (CELL) 241, 200, 90, 90, colors); break; case WHITE: G_add_color_rule((CELL) 241, 250, 250, 250, (CELL) 241, 250, 250, 250, colors); break; case YELLOW: G_add_color_rule((CELL) 241, 200, 200, 10, (CELL) 241, 200, 200, 10, colors); break; } set_colors(colors); return 0; }
void init_curses() { #if _BSD_SOURCE || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 // by default, ncurses stops the execution of the program for // 1 second if escape is pressed. Disable this behaviour. setenv("ESCDELAY", "0", 1); #endif initscr(); // get more control over the input cbreak(); // getch() returns ERR if no input is present and doesn't wait nodelay(stdscr, TRUE); // don't echo the inserted keys to the screen noecho(); // colors! start_color(); set_colors(); // also grab keys like F1 etc. keypad(stdscr, TRUE); }
Compressor_widget *create_compressor_editor(QWidget *parent, void *compressor){ // A minimal radium patch environment. struct Patch *patch = new Patch; SoundPlugin *plugin = new SoundPlugin; patch->patchdata = plugin; plugin->compressor = compressor; Compressor_widget *compressor_widget = new Compressor_widget(patch,parent); if(g_settings_filename!=NULL) compressor_widget->load(g_settings_filename); set_colors(); QPalette pal = compressor_widget->palette(); //pal.setColor(compressor.backgroundRole(), das_colors[11].light(200)); pal.setColor(compressor_widget->backgroundRole(), das_colors[11].light(100)); compressor_widget->setPalette(pal); return compressor_widget; }
static void skip(ClickRecognizerRef recognizer, void *context) { vibes_short_pulse(); if (timer) { app_timer_cancel(timer); } current_exercise++; if (current_exercise >= exercises) { current_exercise = 0; lap++; } seconds = default_work; working = 0; resting = 0; paused = 0; set_colors(rest); text_layer_set_text(exercise_layer, empty); update_next_text(current_exercise); show_time(); update_lap_text(); APP_LOG(APP_LOG_LEVEL_DEBUG, "Skip to lap %d, exercise %d/%d", lap, current_exercise, exercises); }
void ColPalCtx::set_active( colpal_eActive a) { active = a; switch ( active) { case colpal_eActive_FillColor: ((GrowRect *)active_fill)->display_level = glow_mDisplayLevel_1; ((GrowRect *)active_border)->display_level = glow_mDisplayLevel_2; ((GrowRect *)active_text)->display_level = glow_mDisplayLevel_2; break; case colpal_eActive_BorderColor: ((GrowRect *)active_fill)->display_level = glow_mDisplayLevel_2; ((GrowRect *)active_border)->display_level = glow_mDisplayLevel_1; ((GrowRect *)active_text)->display_level = glow_mDisplayLevel_2; break; case colpal_eActive_TextColor: ((GrowRect *)active_fill)->display_level = glow_mDisplayLevel_2; ((GrowRect *)active_border)->display_level = glow_mDisplayLevel_2; ((GrowRect *)active_text)->display_level = glow_mDisplayLevel_1; break; } set_colors(); }