示例#1
0
void
edit_interface_rep::draw_selection (renderer ren) {
  if (!is_nil (locus_rects)) {
    ren->set_color (rgb_color (32, 160, 96));
    ren->draw_rectangles (locus_rects);
  }
  if (made_selection && !is_nil (selection_rects)) {
    ren->set_color (table_selection? rgb_color (192, 0, 255): red);
#ifdef QTTEXMACS
    ren->draw_selection (selection_rects);
#else
    ren->draw_rectangles (selection_rects);
#endif
  }
}
示例#2
0
void
edit_interface_rep::draw_env (renderer ren) {
  if (!full_screen) {
    if (!is_nil (env_rects)) {
      ren->set_color (rgb_color (0, 85, 85, 24));
      ren->draw_rectangles (env_rects);
    }
    if (!is_nil (foc_rects)) {
      ren->set_color (rgb_color (0, 255, 255));
      ren->draw_rectangles (foc_rects);
    }
    if (!is_nil (sem_rects)) {
      if (sem_correct) ren->set_color (rgb_color (112, 208, 112));
      else ren->set_color (rgb_color (208, 144, 80));
      ren->draw_rectangles (sem_rects);
    }
  }
}
示例#3
0
color
x_picture_rep::internal_get_pixel (int x, int y) {
  if (im == NULL)
    im= XGetImage (the_gui->dpy, pm, 0, 0, w, h, AllPlanes, XYPixmap);
  if (im != NULL) {
    unsigned long c= XGetPixel (im, x, h-1-y);
    int r= (c >> 16) & 0xff;
    int g= (c >> 8 ) & 0xff;
    int b= (c      ) & 0xff;
    if (r == 0x64 && g == 0x65 && b == 0x66) return 0x00ffffff;
    return rgb_color (r, g, b, 255);
  }
示例#4
0
void
balloon_decoration_widget_rep::handle_repaint (repaint_event ev) {
  (void) ev;
  renderer ren= ev->win;
  ren->set_background (rgb_color (255, 255, 160));
  ren->clear (0, 0, w, h);
  ren->set_pencil (pencil (black, PIXEL));
  ren->line (0, 0, w-PIXEL, 0);
  ren->line (0, h-PIXEL, w-PIXEL, h-PIXEL);
  ren->line (0, 0, 0, h);
  ren->line (w-PIXEL, 0, w-PIXEL, h-PIXEL);
}
示例#5
0
 static rgb_color from_argb(const v8_uint32_t u32argb) {
     unsigned char alpha = (u32argb >> 24) & 0xFF;
     unsigned char red = (u32argb >> 16) & 0xFF;
     unsigned char green = (u32argb >> 8) & 0xFF;
     unsigned char blue = u32argb & 0xFF;
     return rgb_color(
         static_cast<float>(red) / 255.0f, 
         static_cast<float>(green) / 255.0f, 
         static_cast<float>(blue) / 255.0f, 
         static_cast<float>(alpha) / 255.0f
         );
 }
示例#6
0
void
edit_interface_rep::draw_cursor (renderer ren) {
  if (!temp_invalid_cursor && (got_focus || full_screen)) {
    cursor cu= get_cursor();
    if (!inside_active_graphics ()) {
      cu->y1 -= 2*pixel; cu->y2 += 2*pixel;
      SI x1= cu->ox + ((SI) (cu->y1 * cu->slope)), y1= cu->oy + cu->y1;
      SI x2= cu->ox + ((SI) (cu->y2 * cu->slope)), y2= cu->oy + cu->y2;
      ren->set_line_style (pixel);
      string mode= get_env_string (MODE);
      string family, series;
      if ((mode == "text") || (mode == "src")) {
	family= get_env_string (FONT_FAMILY);
	series= get_env_string (FONT_SERIES);
      }
      else if (mode == "math") {
	family= get_env_string (MATH_FONT_FAMILY);
	series= get_env_string (MATH_FONT_SERIES);
      }
      else if (mode == "prog") {
	family= get_env_string (PROG_FONT_FAMILY);
	series= get_env_string (PROG_FONT_SERIES);
      }
      if (cu->valid) {
	if (mode == "math")
	  ren->set_color (rgb_color (192, 0, 255));
	else ren->set_color (red);
      }
      else ren->set_color (green);
      SI lserif= (series=="bold"? 2*pixel: pixel), rserif= pixel;
      if (family == "ss") lserif= rserif= 0;
      ren->line (x1-lserif, y1, x1+rserif, y1);
      if (y1<=y2-pixel) {
	ren->line (x1, y1, x2, y2-pixel);
	if (series == "bold") ren->line (x1-pixel, y1, x2-pixel, y2-pixel);
	ren->line (x2-lserif, y2-pixel, x2+rserif, y2-pixel);
      }
    }
  }
}
示例#7
0
void
concater_rep::flag_ok (string s, path ip, color col) {
  path dip = decorate_right (ip);
  SI h= 4*env->fn->wfn/5;
  int r, g, b, a;
  get_rgb_color (col, r, g, b, a);
  //r= 255- (255 - r)/6;
  //g= 255- (255 - g)/6;
  //b= 255- (255 - b)/6;
  a= a/6;
  color light= rgb_color (r, g, b, a);
  int info= env->info_level;
  if (info == INFO_MINIMAL || info == INFO_SHORT || info == INFO_SHORT_PAPER) {
    box infob= info_box (dip, h, pencil (col, env->fn->wline), light);
    if (info == INFO_SHORT_PAPER) {
      box b= resize_box (ip, infob, 0, 0, 0, env->fn->yx);
      print (b);
    }
    else {
      box specb= specific_box (ip, infob, "screen", env->fn);
      print (specb);
    }
  }
  else if (info == INFO_DETAILED || info == INFO_PAPER) {
    int sz= script (env->fn_size, env->index_level+2);
    font gfn (tex_font ("ecrm", sz, (int) (env->magn*env->dpi)));
    box textb= text_box (decorate (ip), 0, s, gfn, col);
    box flagb= flag_box (dip, textb, h, pencil (col, env->fn->wline), light);
    if (info == INFO_DETAILED) {
      box specb= specific_box (ip, flagb, "screen", env->fn);
      print (specb);
    }
    else {
      box b= resize_box (ip, flagb, 0, 0, 0, env->fn->yx);
      print (b);
    }
  }
}
示例#8
0
void
x_gui_rep::prepare_color (int sf, color fg, color bg) {
  int nr_cols= sf*sf;
  if (nr_cols >= 64) nr_cols= 64;
  x_character col_entry (0, font_glyphs (), sf, fg, bg);
  color* cols= (color*) color_scale [col_entry];
  if (cols == NULL) {
    int fR, fG, fB, fA, bR, bG, bB, bA, j;
    get_rgb_color (fg, fR, fG, fB, fA);
    get_rgb_color (bg, bR, bG, bB, bA);
    if (fA != 255) {
      fR= (bR * (255 - fA) + fR * fA) / 255;
      fG= (bG * (255 - fA) + fG * fA) / 255;
      fB= (bB * (255 - fA) + fB * fA) / 255;
    }
    cols= tm_new_array<color> (nr_cols+1);
    for (j=0; j<=nr_cols; j++)
      cols [nr_cols-j]= rgb_color ((bR*j + fR*(nr_cols-j)) / nr_cols,
				   (bG*j + fG*(nr_cols-j)) / nr_cols,
				   (bB*j + fB*(nr_cols-j)) / nr_cols);
    color_scale (col_entry)= (void*) cols;
  }
}
示例#9
0
文件: color.cpp 项目: oioi/graphics
rgb_color hsv_color::to_rgb() const
{
   if (0 == s) return rgb_color {v, v, v, a};

   double hh = ((h >= 360.0) ? 0.0 : h) / 60.0;
   long i = (long)hh;
   double ff = hh - i;

   double p = v * (1.0 - s);
   double q = v * (1.0 - (s * ff));
   double t = v * (1.0 - (s * (1.0 - ff)));

   switch (i)
   {
      case 0: return rgb_color(v, t, p, a);
      case 1: return rgb_color(q, v, p, a);
      case 2: return rgb_color(p, v, t, a);
      case 3: return rgb_color(p, q, v, a);
      case 4: return rgb_color(t, p, v, a);
      case 5:
      default:
         return rgb_color(v, p, q, a);
   }
}