예제 #1
0
파일: property.c 프로젝트: blueyed/LilyTerm
void create_theme_color_data(GdkRGBA color[COLOR], GdkRGBA color_orig[COLOR], gdouble color_brightness, gboolean invert_color,
			     gboolean default_vte_theme, gboolean dim_fg_color)
{
#ifdef DETAIL
	g_debug("! Launch create_theme_color_data() with color = %p, color_orig = %p, color_brightness = %3f, invert_color = %d",
		color, color_orig, color_brightness, invert_color);
#endif
#ifdef SAFEMODE
	if ((color==NULL) || (color_orig==NULL)) return;
#endif
	if (! default_vte_theme)
	{
		// g_debug("Get win_data = %d when set background saturation!", win_data);
		color_brightness = CLAMP(color_brightness, -1, 1);

		gint i;
		for (i=1; i<COLOR-1; i++)
		{
			// g_debug("adjuset the color of %d", get_color_index(invert_color, i));
			adjust_ansi_color(&color[i], &color_orig[get_color_index(invert_color, i)], color_brightness);
			// print_color(get_color_index(invert_color, i), "create_theme_color_data(): color_orig ", color_orig[i]);
			// print_color(i, "create_theme_color_data(): new: color ", color[i]);
		}
	}

	// The fg_color and bg_color will not affect by color_brightness
	if (dim_fg_color)
		adjust_ansi_color(&color[COLOR-1], &color_orig[get_color_index(invert_color, COLOR-1)], color_brightness);
	else
		color[COLOR-1] = color_orig[get_color_index(invert_color, COLOR-1)];
	// print_color(get_color_index(invert_color, COLOR-1), "create_theme_color_data(): fg color_orig ", color_orig[COLOR-1]);
	// print_color(COLOR-1, "create_theme_color_data(): new: fg color ", color[COLOR-1]);
	color[0] = color_orig[get_color_index(invert_color, 0)];
	// print_color(get_color_index(invert_color, 0), "create_theme_color_data(): bg color_orig ", color_orig[0]);
	// print_color(0, "create_theme_color_data(): new: bg color ", color[0]);
}
예제 #2
0
void
Canvas::
fill_area()
{
  const palette::index_t  target_i = get_index(tool_point.x,tool_point.y);

  const palette::index_t  source_i = get_color_index();

    if(target_i == source_i)
    {
      return;
    }


  field.resize(module.get_width(),module.get_height());

  field.fill(0);

  std::stack<Frame>  stack;

  stack.emplace(tool_point.x,tool_point.y);

START:
    if(stack.empty())
    {
      return;
    }


  auto&  top = stack.top();

    switch(top.phase)
    {
      case(0):
        {
          auto&  mark = field.get_element(top.x,top.y);

            if(mark)
            {
              stack.pop();

              goto START;
            }


          mark = 1;

          auto&  dst = get_index(top.x,top.y);

            if(dst == target_i)
            {
              put_dot(Dot(top.x,top.y,source_i));
            }

          else
            {
              stack.pop();

              goto START;
            }
        }
      case(1):
          if(top.x)
          {
            top.phase = 2;

            stack.emplace(top.x-1,top.y);

            goto START;
          }
      case(2):
          if(top.y)
          {
            top.phase = 3;

            stack.emplace(top.x,top.y-1);

            goto START;
          }
      case(3):
          if(top.x < (module.get_width()-1))
          {
            top.phase = 4;

            stack.emplace(top.x+1,top.y);

            goto START;
          }
      case(4):
          if(top.y < (module.get_height()-1))
          {
            top.phase = 5;

            stack.emplace(top.x,top.y+1);

            goto START;
          }
      case(5):
      default:;
    }


  stack.pop();

  goto START;
}