コード例 #1
0
void ExpandCelCanvas::validateSourceCanvas(const gfx::Region& rgn)
{
  getSourceCanvas();

  gfx::Region rgnToValidate(rgn);
  rgnToValidate.offset(-m_bounds.getOrigin());
  rgnToValidate.createSubtraction(rgnToValidate, m_validSrcRegion);
  rgnToValidate.createIntersection(rgnToValidate, gfx::Region(m_srcImage->bounds()));

  if (m_celImage) {
    gfx::Region rgnToClear;
    rgnToClear.createSubtraction(rgnToValidate,
      gfx::Region(m_celImage->bounds()
        .offset(m_origCelPos)
        .offset(-m_bounds.getOrigin())));
    for (const auto& rc : rgnToClear)
      fill_rect(m_srcImage, rc, m_srcImage->maskColor());

    for (const auto& rc : rgnToValidate)
      m_srcImage->copy(m_celImage, rc.x, rc.y,
        rc.x+m_bounds.x-m_origCelPos.x,
        rc.y+m_bounds.y-m_origCelPos.y, rc.w, rc.h);
  }
  else {
    for (const auto& rc : rgnToValidate)
      fill_rect(m_srcImage, rc, m_srcImage->maskColor());
  }

  m_validSrcRegion.createUnion(m_validSrcRegion, rgnToValidate);
}
コード例 #2
0
    bool slider(int id, const rect & r, double min, double max, double step, double & value, bool disable_dragger = false)
    {
        bool changed = false;
        const int w = r.x1 - r.x0, h = r.y1 - r.y0;
        double p = (w - h) * (value - min) / (max - min);
        if (mouse_down && clicked_id == id)
        {
            p = std::max(0.0, std::min<double>(cursor.x - clicked_offset.x - r.x0, w - h));
            double new_value = min + p * (max - min) / (w - h);
            if (step) new_value = std::round((new_value - min) / step) * step + min;
            changed = new_value != value;
            value = new_value;
            p = (w - h) * (value - min) / (max - min);
        }
        const rect dragger = { int(r.x0 + p), int(r.y0), int(r.x0 + p + h), int(r.y1) };
        if (click && dragger.contains(cursor) && !disable_dragger)
        {
            clicked_offset = { cursor.x - dragger.x0, cursor.y - dragger.y0 };
            clicked_id = id;
        }
        fill_rect(r, { 0.5, 0.5, 0.5 });

        if (!disable_dragger)
            fill_rect(dragger, { 1, 1, 1 });

        return changed;
    }
コード例 #3
0
TEST ()
{
  GeglBuffer   *buffer;
  GeglRectangle extent = {0,0,40,20};
  GeglRectangle roi = {1,1,30,10};
  test_start();
  buffer = gegl_buffer_new (&extent, babl_format ("Y float"));
  fill_rect (buffer, &roi, 0.5);
  roi.y+=3;
  roi.x+=20;

  {
    gint    rowstride;
    gfloat *buf;
    gint    x, y, i;

    buf = (gpointer)gegl_buffer_linear_open (buffer, &extent, &rowstride, NULL);
    g_assert (buf);

    i=0;
    for (y=0;y<extent.height;y++)
      for (x=0;x<extent.width;x++)
        {
          buf[i++]= ((x+y)*1.0) / extent.width;
        }
    gegl_buffer_linear_close (buffer, buf);
  }
  fill_rect (buffer, &roi, 0.2);

  print_buffer (buffer);
  gegl_buffer_destroy (buffer);
  test_end ();
}
コード例 #4
0
ファイル: button.c プロジェクト: billzbh/ov-secure-kernel
/**
* @brief 
*
* @param id
* @param str
* @param width
* @param height
* @param color
*/
void button(u8* id, u8* str, s32int width, 
		s32int height, u32 color)
{

	if(!obj_val.end_inserting_obj) {
		compute_button_width(str);
		
		/* checking if the given width is greater than the default width. Else 
		 * width will be reassigned*/
		width = (width>obj_val.obj_width)?width:obj_val.obj_width; 

		/* Checking if the given width is less than the window width. Else 
		 * width will be reassigned*/
		width = (width > (obj_val.window_x2 - obj_val.window_x1))?
			(obj_val.window_x2 - obj_val.window_x1):width; 

		if(check_space_for_object(str, width, height)) {
			fill_rect(obj_val.obj_x, obj_val.obj_y, obj_val.obj_x+width,
					obj_val.obj_y+height, color);
			fill_rect(obj_val.obj_x+3, obj_val.obj_y+3, obj_val.obj_x+width,
					obj_val.obj_y+height, color);

			put_string(obj_val.obj_x+(sw_strlen(str)
						+(width-(sw_strlen(str)*10))/2), 
					obj_val.obj_y + (height-8)/2, str, sw_strlen(str),
					calc_contrast_color(color), NO_TEXT_BG);

			set_object_values(id, str, width, height, "button\0", color);
		}
	}
}
コード例 #5
0
// helper function for drawing - no more need to go mess with
// the main function when just want to change what to draw...
void draw()
{
    int i, x, y, w, h, dx, dy;

    // start position (upper left)
    x = 0;
    y = 0;
    // rectangle dimensions
    w = YRES / 10;
    h = w;
    // move step 'size'
    dx = 1;
    dy = 1;

    int fps = 100;
    int secs = 10;

    // loop for a while
    for (i = 0; i < (fps * secs); i++) {

        // change page to draw to (between 0 and 1)
        cur_page = (cur_page + 1) % 2;

        // clear the previous image (= fill entire screen)
        clear_screen(0);

        // draw the bouncing rectangle
        fill_rect(x,         y,         w / 2, h / 2, 0xF800);
        fill_rect(x,         y + h / 2, w / 2, h / 2, 0x07E0);
        fill_rect(x + w / 2, y,         w / 2, h / 2, 0x001F);
        fill_rect(x + w / 2, y + h / 2, w / 2, h / 2, 0xFFFF);

        // move the rectangle
        x = x + dx;
        y = y + dy;

        // check for display sides
        if ((x < 0) || (x > (XRES - w))) {
            dx = -dx; // reverse direction
            x = x + 2 * dx; // counteract the move already done above
        }
        // same for vertical dir
        if ((y < 0) || (y > (YRES - h))) {
            dy = -dy;
            y = y + 2 * dy;
        }

        // switch page
        vinfo.yoffset = cur_page * vinfo.yres;
        vinfo.activate = FB_ACTIVATE_VBL;
        if (ioctl(fbfd, FBIOPAN_DISPLAY, &vinfo))
            printf("Error panning display.\n");

        //int zero = 0;
        //ioctl(fbfd, FBIO_WAITFORVSYNC, NULL);
        //usleep(1000000 / fps);
    }

}
コード例 #6
0
 bool button(const rect & r, const std::string & label)
 {
     fill_rect(r, { 1, 1, 1 });
     fill_rect(r.shrink(2), r.contains(cursor) ? (mouse_down ? color{ 0.3f, 0.3f, 0.3f } : color{ 0.4f, 0.4f, 0.4f }) : color{ 0.5f, 0.5f, 0.5f });
     glColor3f(1, 1, 1);
     draw_text(r.x0 + 4, r.y1 - 8, label.c_str());
     return click && r.contains(cursor);
 }
コード例 #7
0
/**
 * gst_vaapi_window_glx_put_texture:
 * @window: a #GstVaapiWindowGLX
 * @texture: a #GstVaapiTexture
 * @src_rect: the sub-rectangle of the source texture to
 *   extract and process. If %NULL, the entire texture will be used.
 * @dst_rect: the sub-rectangle of the destination
 *   window into which the texture is rendered. If %NULL, the entire
 *   window will be used.
 *
 * Renders the @texture region specified by @src_rect into the @window
 * region specified by @dst_rect.
 *
 * NOTE: only GL_TEXTURE_2D textures are supported at this time.
 *
 * Return value: %TRUE on success
 */
gboolean
gst_vaapi_window_glx_put_texture (GstVaapiWindowGLX * window,
    GstVaapiTexture * texture,
    const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect)
{
  GstVaapiRectangle tmp_src_rect, tmp_dst_rect;
  GLTextureState ts;
  GLenum tex_target;
  GLuint tex_id;
  guint tex_width, tex_height;
  guint win_width, win_height;

  g_return_val_if_fail (GST_VAAPI_IS_WINDOW_GLX (window), FALSE);
  g_return_val_if_fail (texture != NULL, FALSE);

  gst_vaapi_texture_get_size (texture, &tex_width, &tex_height);
  fill_rect (&tmp_src_rect, src_rect, tex_width, tex_height);
  src_rect = &tmp_src_rect;

  gst_vaapi_window_get_size (GST_VAAPI_WINDOW (window), &win_width,
      &win_height);
  fill_rect (&tmp_dst_rect, dst_rect, win_width, win_height);
  dst_rect = &tmp_dst_rect;

  /* XXX: only GL_TEXTURE_2D textures are supported at this time */
  tex_target = gst_vaapi_texture_get_target (texture);
  if (tex_target != GL_TEXTURE_2D)
    return FALSE;

  tex_id = gst_vaapi_texture_get_id (texture);
  if (!gl_bind_texture (&ts, tex_target, tex_id))
    return FALSE;
  glColor4f (1.0f, 1.0f, 1.0f, 1.0f);
  glPushMatrix ();
  glTranslatef ((GLfloat) dst_rect->x, (GLfloat) dst_rect->y, 0.0f);
  glBegin (GL_QUADS);
  {
    const float tx1 = (float) src_rect->x / tex_width;
    const float tx2 = (float) (src_rect->x + src_rect->width) / tex_width;
    const float ty1 = (float) src_rect->y / tex_height;
    const float ty2 = (float) (src_rect->y + src_rect->height) / tex_height;
    const guint w = dst_rect->width;
    const guint h = dst_rect->height;
    glTexCoord2f (tx1, ty1);
    glVertex2i (0, 0);
    glTexCoord2f (tx1, ty2);
    glVertex2i (0, h);
    glTexCoord2f (tx2, ty2);
    glVertex2i (w, h);
    glTexCoord2f (tx2, ty1);
    glVertex2i (w, 0);
  }
  glEnd ();
  glPopMatrix ();
  gl_unbind_texture (&ts);
  return TRUE;
}
コード例 #8
0
ファイル: button.c プロジェクト: billzbh/ov-secure-kernel
/**
* @brief 
*
* @param x
* @param y
* @param str
* @param width
* @param height
* @param col
* @param id
*/
void button_on_given_coord(s32int x, s32int y, u8* str, s32int width, 
		s32int height, u32 col, u8* id)
{
	fill_rect(x, y, x+width, y+height, color(GRAY));
	fill_rect(x+3, y+3, x+width, y+height, col);

	put_string(x+(sw_strlen(str)+(width-(sw_strlen(str)*10))/2),
			y + (height-8)/2, str, sw_strlen(str), calc_contrast_color(col),
			NO_TEXT_BG);
	set_object_values_given_coord(id, str, x, y, width, height, "button\0", 
			col);
}
コード例 #9
0
static void ref_tests(struct test *t, int reps, int sets, enum target target)
{
	struct test_target out, ref;
	int r, s;

	printf("Testing area fills (%s): ", test_target_name(target));
	fflush(stdout);

	test_target_create_render(&t->out, target, &out);
	clear(&t->out, &out);

	test_target_create_render(&t->ref, target, &ref);
	clear(&t->ref, &ref);

	for (s = 0; s < sets; s++) {
		for (r = 0; r < reps; r++) {
			int x = rand() % (2*out.width) - out.width;
			int y = rand() % (2*out.height) - out.height;
			int w = rand() % out.width;
			int h = rand() % out.height;
			int op = ops[rand() % sizeof(ops)];
			int s_red = rand() % 0xff;
			int s_green = rand() % 0xff;
			int s_blue = rand() % 0xff;
			int s_alpha = rand() % 0xff;
			int m_red = rand() % 0xff;
			int m_green = rand() % 0xff;
			int m_blue = rand() % 0xff;
			int m_alpha = rand() % 0xff;

			fill_rect(&t->out, out.picture,
				  op, x, y, w, h,
				  s_red, s_green, s_blue, s_alpha,
				  m_red, m_green, m_blue, m_alpha);
			fill_rect(&t->ref, ref.picture,
				  op, x, y, w, h,
				  s_red, s_green, s_blue, s_alpha,
				  m_red, m_green, m_blue, m_alpha);
		}

		test_compare(t,
			     out.draw, out.format,
			     ref.draw, ref.format,
			     0, 0, out.width, out.height,
			     "");
	}

	printf("passed [%d iterations x %d]\n", reps, sets);

	test_target_destroy_render(&t->out, &out);
	test_target_destroy_render(&t->ref, &ref);
}
コード例 #10
0
int main(void)
{
    int delay;
    int x, y;
    int key_pressed = 0;
    int last_key_pressed = 0;
    enum ps2_state { idle, got_prefix, got_release } key_state = idle;
    
    clear_screen();
    init_lcd();
    init_kmi();

    x = 30; y = 30;
    do {
        uint32 key_code;

        fill_rect(x * 3, y * 3, 2, 2, 0xffff);

        last_key_pressed = 0;

        for (delay = 0; delay < 0x80000; ++delay) {
            key_code = kmi_read();

            switch (key_code) {
            case 0: break;
            case KEY_PREFIX: key_state = got_prefix; break;
            case KEY_RELEASE: key_state = got_release; break;
            default:
                if (key_state == got_release) {
                    key_pressed = 0;
                } else {
                    last_key_pressed = key_pressed = key_code;
                }
                key_state = idle;
                break;
            }
        }

        if (last_key_pressed == 0) {
            last_key_pressed = key_pressed;
        }

        fill_rect(x * 3, y * 3, 2, 2, 0x7777);
        switch (last_key_pressed) {
        case KEY_LEFT:  case KEY_4: x -= 1; break;
        case KEY_RIGHT: case KEY_6: x += 1; break;
        case KEY_UP:    case KEY_2: y -= 1; break;
        case KEY_DOWN:  case KEY_8: y += 1; break;
        }

    } while (1);
}
コード例 #11
0
 void vscroll(const rect & r, int client_height, int & offset)
 {
     if (r.contains(cursor)) offset -= scroll_vec.y * 20;
     offset = std::min(offset, client_height - (r.y1 - r.y0));
     offset = std::max(offset, 0);
     if (client_height <= r.y1 - r.y0) return;
     auto bar = r; bar.x0 = bar.x1 - 10;
     auto dragger = bar;
     dragger.y0 = bar.y0 + offset * (r.y1 - r.y0) / client_height;
     dragger.y1 = bar.y0 + (offset + r.y1 - r.y0) * (r.y1 - r.y0) / client_height;
     fill_rect(bar, { 0.5, 0.5, 0.5 });
     fill_rect(dragger, { 1, 1, 1 });
 }
コード例 #12
0
 bool checkbox(const rect & r, bool & value)
 {
     bool changed = false;
     if (click && r.contains(cursor))
     {
         value = !value;
         changed = true;
     }
     fill_rect(r, { 1, 1, 1 });
     fill_rect(r.shrink(1), { 0.5, 0.5, 0.5 });
     if (value) fill_rect(r.shrink(3), { 1, 1, 1 });
     return changed;
 }
コード例 #13
0
static void fill(struct test_target *real,
		 struct test_target *ref)
{
	int x = rand() % (2*real->width) - real->width;
	int y = rand() % (2*real->height) - real->height;
	int w = rand() % (2*real->width);
	int h = rand() % (2*real->height);
	int color = rand();
	int alu = rand() % 16;

	fill_rect(real, alu, color, x, y, w, h);
	fill_rect(ref, alu, color, x, y, w, h);
}
コード例 #14
0
static void rect_tests(struct test *t,
		       int dx, int dy,
		       enum mask mask,
		       int reps, int sets,
		       enum target target)
{
	struct test_target real, ref;
	int r, s;

	printf("Testing area fills (offset %dx%d, mask %s) (%s): ",
	       dx, dy, mask_name(mask), test_target_name(target));
	fflush(stdout);

	test_target_create_render(&t->real, target, &real);
	clear(&t->real, &real);

	test_target_create_render(&t->ref, target, &ref);
	clear(&t->ref, &ref);

	for (s = 0; s < sets; s++) {
		for (r = 0; r < reps; r++) {
			int x = rand() % (2*real.width) - real.width;
			int y = rand() % (2*real.height) - real.height;
			int w = rand() % real.width;
			int h = rand() % real.height;
			int op = ops[rand() % sizeof(ops)];
			int red = rand() % 0xff;
			int green = rand() % 0xff;
			int blue = rand() % 0xff;
			int alpha = rand() % 0xff;

			fill_rect(&t->real, real.picture, op,
				  x, y, w, h, dx, dy, mask,
				  red, green, blue, alpha);
			fill_rect(&t->ref, ref.picture, op,
				  x, y, w, h, dx, dy, mask,
				  red, green, blue, alpha);
		}

		test_compare(t,
			     real.draw, real.format,
			     ref.draw, ref.format,
			     0, 0, real.width, real.height,
			     "");
	}

	printf("passed [%d iterations x %d]\n", reps, sets);

	test_target_destroy_render(&t->real, &real);
	test_target_destroy_render(&t->ref, &ref);
}
コード例 #15
0
ファイル: display.c プロジェクト: L-ios/ibus-fbterm
static void draw_margin(Rectangle rect, char color)
{
	Rectangle r1 = { rect.x, rect.y, rect.w, MARGIN };
	fill_rect(r1, color);

	r1.y = rect.y + rect.h - MARGIN;
	fill_rect(r1, color);

	Rectangle r2 = { rect.x, rect.y + MARGIN, MARGIN, rect.h - 2 * MARGIN };
	fill_rect(r2, color);

	r2.x = rect.x + rect.w - MARGIN;
	fill_rect(r2, color);
}
コード例 #16
0
    // extended label method for option lines
    // the purpose is to provide a little more visual context to the various options,
    // and make config-ui interface more human friendly
    void option_label(const int2& p, const color& c, rs::device& dev, rs::option opt, double max_width, bool enabled, double* value = nullptr)
    {
        auto name = find_and_replace(rs_option_to_string((rs_option)opt), "_", " "); // replacing _ with ' ' to reduce visual clutter
        std::string s(name);

        auto size = name.size(); // align the string to max. allowed width
        while (size > 0 && stb_easy_font_width((char*)s.c_str()) > max_width)
        {
            s = name.substr(0, size--) + "...";
        }

        // remove option prefixes converting them to visual hints through color:
        color newC = c;
#define STRING_CASE(S, C) std::string S = #S; if (s.compare(0, S.length(), S) == 0) { newC = C; s = find_and_replace(s, S + " ", ""); }
        color color1 = { 0.6f, 1.0f, 1.0f };
        color color2 = { 1.0f, 0.6f, 1.0f };
        color color3 = { 1.0f, 1.0f, 0.6f };
        color color4 = { 1.0f, 0.6f, 0.6f };
        color color5 = { 0.6f, 0.6f, 1.0f };
        color color6 = { 0.6f, 1.0f, 0.6f };
        STRING_CASE(ZR300, color1)
        STRING_CASE(F200, color2)
        STRING_CASE(SR300, color3)
        STRING_CASE(R200, color4)
        STRING_CASE(FISHEYE, color5)
        STRING_CASE(COLOR, color6)
        if (!enabled) newC = { 0.5f, 0.5f, 0.5f };

        auto w = stb_easy_font_width((char*)s.c_str());
        label(p, newC, s.c_str());
        // if value is required, append it at the end of the string
        if (value)
        {
            std::stringstream sstream;
            sstream << ": " << *value;
            int2 newP{ p.x + w, p.y };
            label(newP, c, sstream.str().c_str());
        }

        rect bbox{ p.x - 15, p.y - 10, p.x + w + 10, p.y + 5 };
        if (bbox.contains(cursor))
        {
            std::string hint = dev.get_option_description(opt);
            auto hint_w = stb_easy_font_width((char*)hint.c_str());
            fill_rect({ cursor.x - hint_w - 7, cursor.y + 5, cursor.x + 7, cursor.y - 17 }, { 1.0f, 1.0f, 1.0f });
            fill_rect({ cursor.x - hint_w - 6, cursor.y + 4, cursor.x + 6, cursor.y - 16 }, { 0.0f, 0.0f, 0.0f });
            label({ cursor.x - hint_w, cursor.y - 2 }, { 1.f, 1.f, 1.f }, hint.c_str());
        }
    }
コード例 #17
0
ファイル: Canvas.cpp プロジェクト: niesteszeck/Cosa
void
Canvas::fill_roundrect(uint8_t x, uint8_t y,
                       uint8_t width, uint8_t height,
                       uint8_t radius)
{
    int16_t dx = 0, dy = radius;
    int16_t p = 1 - radius;
    uint8_t diameter = 2 * radius;

    // Adjust the position and fill the inner rectangle
    x += radius;
    width -= diameter;
    fill_rect(x, y, width, height + 1);
    height -= diameter;
    y += radius;

    // Draw the outer rectangle and corners
    while (dx <= dy) {
        draw_vertical_line(x + dx + width, y - dy, dy + dy + height);
        draw_vertical_line(x - dx, y - dy, dy + dy + height);
        draw_vertical_line(x + dy + width, y - dx, dx + dx + height);
        draw_vertical_line(x - dy, y - dx, dx + dx + height);
        dx++;
        if (p < 0)
            p = p + (dx << 1) + 1;
        else {
            dy--;
            p = p + ((dx - dy) << 1) + 1;
        }
    }
}
コード例 #18
0
ファイル: lsc.c プロジェクト: wcheswick/ex
void
showtimer(void) {
	int timeleft = lastgrab + grabtimeout - time(0);
	int lenx;
	Pixel text_color = White;	// was brightwhite
	Pixel bar_color;
	Rectangle thisbar_r = bar_r;
	char buf[50];

	if (grabtimeout == 0)
		return;
	thisbar_r = bar_r;
	thisbar_r.max.x = bar_r.min.x +
		((bar_r.max.x - bar_r.min.x)*timeleft/grabtimeout);

	hide_cursor();

	clear_timer();

	if (timeleft > WARNTIME)
		bar_color = Green;
	else if (timeleft > ALARMTIME) {
		bar_color = Yellow;
	} else
		bar_color = Red;

	snprintf(buf, sizeof(buf), " Seconds left: %d", timeleft);
	fill_rect(thisbar_r, bar_color);

	write_string(timer_r.min, text_color, buf);

	show_cursor();
}
コード例 #19
0
static void pixel_tests(struct test *t, int reps, int sets, enum target target)
{
	struct test_target tt;
	XImage image;
	uint32_t *cells = malloc(t->real.width*t->real.height*4);
	struct {
		uint16_t x, y;
	} *pixels = malloc(reps*sizeof(*pixels));
	int r, s;

	test_target_create_render(&t->real, target, &tt);

	printf("Testing setting of single pixels (%s): ",
	       test_target_name(target));
	fflush(stdout);

	for (s = 0; s < sets; s++) {
		for (r = 0; r < reps; r++) {
			int x = rand() % (tt.width - 1);
			int y = rand() % (tt.height - 1);
			uint32_t fg = rand();

			fill_rect(&t->real, tt.draw, GXcopy,
				  x, y, 1, 1, fg);

			pixels[r].x = x;
			pixels[r].y = y;
			cells[y*tt.width+x] = fg;
		}

		test_init_image(&image, &t->real.shm, tt.format, 1, 1);

		for (r = 0; r < reps; r++) {
			uint32_t x = pixels[r].x;
			uint32_t y = pixels[r].y;
			uint32_t result;

			XShmGetImage(t->real.dpy, tt.draw, &image,
				     x, y, AllPlanes);

			result = *(uint32_t *)image.data;
			if (!pixel_equal(image.depth, result,
					 cells[y*tt.width+x])) {
				uint32_t mask = depth_mask(image.depth);

				die("failed to set pixel (%d,%d) to %08x [%08x], found %08x [%08x] instead\n",
				    x, y,
				    cells[y*tt.width+x] & mask,
				    cells[y*tt.width+x],
				    result & mask,
				    result);
			}
		}
	}
	printf("passed [%d iterations x %d]\n", reps, sets);

	test_target_destroy_render(&t->real, &tt);
	free(pixels);
	free(cells);
}
コード例 #20
0
ファイル: Canvas.cpp プロジェクト: niesteszeck/Cosa
void
Canvas::fill_screen()
{
    color16_t saved = set_pen_color(get_canvas_color());
    fill_rect(0, 0, WIDTH, HEIGHT);
    set_pen_color(saved);
}
コード例 #21
0
ファイル: sprite.cpp プロジェクト: felipeita/aseprite
void Sprite::render(Image* image, int x, int y, FrameNumber frame) const
{
  fill_rect(image, x, y, x+m_width-1, y+m_height-1,
            (m_format == IMAGE_INDEXED ? getTransparentColor(): 0));

  layer_render(getFolder(), image, x, y, frame);
}
コード例 #22
0
ファイル: linear_new.c プロジェクト: AjayRamanathan/gegl
TEST ()
{
  GeglBuffer   *buffer;
  GeglRectangle extent = {0,0,40,20};
  GeglRectangle roi = {1,1,30,10};
  test_start();
  g_print ("foo!\n");
  buffer = gegl_buffer_linear_new (&extent, babl_format ("Y float"));
  fill_rect (buffer, &roi, 0.5);
  roi.y+=3;
  roi.x+=20;
  fill_rect (buffer, &roi, 0.2);
  print_buffer (buffer);
  g_object_unref (buffer);
  test_end ();
}
コード例 #23
0
ファイル: RASTER.C プロジェクト: AnimatorPro/Animator-Pro
/*-----------------------------------------------------------------------

   tiga_set_rect

   Draws a filled rectangle on the display.

-----------------------------------------------------------------------*/
void tiga_set_rect(tigaRast *r, Pixel color,
                   Coor x, Coor y, Ucoor w, Ucoor h)
{
   set_fcolor(color);                     /* Set the drawing color         */
   fill_rect(w, h, x, y);                 /* Draw the rectangle            */
   return;
}
コード例 #24
0
ファイル: display.c プロジェクト: L-ios/ibus-fbterm
static void draw_lookup_table()
{
	set_im_window(LookupTableWin, lookup_table_win);
	if (!lookup_table_win.w) return;

	draw_margin(lookup_table_win, COLOR_BG);

	unsigned i, x = lookup_table_win.x + MARGIN, y = lookup_table_win.y + MARGIN;
	for (i = 0; ; i++) {
		IBusText *text = ibus_lookup_table_get_candidate(lookup_table, i);
		if (!text) break;

		char buf[8];
		snprintf(buf, sizeof(buf), "%d.", i + 1);
		draw_text(x, y, COLOR_FG, COLOR_BG, buf, strlen(buf));
		x += FW(2);

		draw_text(x, y, i == lookup_table->cursor_pos ? COLOR_ACTIVE_CANDIDATE : COLOR_FG, COLOR_BG, text->text, strlen(text->text));
		x += FW(text_width(text->text));

		char space = ' ';
		draw_text(x, y, COLOR_FG, COLOR_BG, &space, 1);
		x += FW(1);
	}

	unsigned endx = lookup_table_win.x + lookup_table_win.w - MARGIN;
	if (x < endx) {
		Rectangle rect = { x, y, endx - x, FH(1) };
		fill_rect(rect, COLOR_BG);
	}
}
コード例 #25
0
	void graphics_context::clear(const colour& aColour) const
	{
		if (origin() == point{} && extents() == iSurface.extents())
			iNativeGraphicsContext->clear(aColour);
		else
			fill_rect(rect{origin(), extents()}, aColour);
	}
コード例 #26
0
// helper function for drawing - no more need to go mess with
// the main function when just want to change what to draw...
void draw() {

    int x;
    
    // some pixels
    for (x = 0; x < vinfo.xres; x+=5) {
        put_pixel(x, vinfo.yres / 2, WHITE);
    }

    // some lines (note the quite likely 'Moire pattern')
    for (x = 0; x < vinfo.xres; x+=20) {
        draw_line(0, 0, x, vinfo.yres - 1, GREEN);
    }
    
    // some rectangles
    draw_rect(vinfo.xres / 4, vinfo.yres / 2 + 10, vinfo.xres / 4, vinfo.yres / 4, PURPLE);    
    draw_rect(vinfo.xres / 4 + 10, vinfo.yres / 2 + 20, vinfo.xres / 4 - 20, vinfo.yres / 4 - 20, PURPLE);    
    fill_rect(vinfo.xres / 4 + 20, vinfo.yres / 2 + 30, vinfo.xres / 4 - 40, vinfo.yres / 4 - 40, YELLOW);    

    // some circles
    int d;
    for(d = 10; d < vinfo.yres / 6; d+=10) {
        draw_circle(3 * vinfo.xres / 4, vinfo.yres / 4, d, RED);
    }
    
    fill_circle(3 * vinfo.xres / 4, 3 * vinfo.yres / 4, vinfo.yres / 6, ORANGE);
    fill_circle(3 * vinfo.xres / 4, 3 * vinfo.yres / 4, vinfo.yres / 8, RED);

}
コード例 #27
0
static enum test_res test002_func(void)
{
    int i;
    u32 a, b, x1, x2, y1, y2;

    fill_rect(0, 0, fb_var.xres, fb_var.yres, black_pixel);
    for (i = 0; i <= Y_BLOCKS; i++)
	draw_hline(0, i*(fb_var.yres-1)/Y_BLOCKS, fb_var.xres, white_pixel);
    for (i = 0; i <= X_BLOCKS; i++)
	draw_vline(i*(fb_var.xres-1)/X_BLOCKS, 0, fb_var.yres, white_pixel);
    draw_ellipse(fb_var.xres/2, fb_var.yres/2, 3*fb_var.xres/8,
		 fb_var.yres/2-1, white_pixel);
    a = (fb_var.xres-1)/X_BLOCKS;
    b = (fb_var.yres-1)/Y_BLOCKS;
    x1 = (fb_var.xres-1)/X_BLOCKS;
    y1 = (fb_var.yres-1)/Y_BLOCKS;
    x2 = (X_BLOCKS-1)*(fb_var.xres-1)/X_BLOCKS;
    y2 = (Y_BLOCKS-1)*(fb_var.yres-1)/Y_BLOCKS;
    draw_ellipse(x1, y1, a, b, white_pixel);
    draw_ellipse(x2, y1, a, b, white_pixel);
    draw_ellipse(x1, y2, a, b, white_pixel);
    draw_ellipse(x2, y2, a, b, white_pixel);
    wait_for_key(10);
    return TEST_OK;
}
コード例 #28
0
ファイル: vo_xv.c プロジェクト: DZW314/mpv
// Clear everything outside of rc with the background color
static void vo_x11_clear_background(struct vo *vo, const struct mp_rect *rc)
{
    struct vo_x11_state *x11 = vo->x11;
    struct xvctx *ctx = vo->priv;
    GC gc = ctx->f_gc;

    int w = vo->dwidth;
    int h = vo->dheight;

    fill_rect(vo, gc, 0,      0,      w,      rc->y0); // top
    fill_rect(vo, gc, 0,      rc->y1, w,      h);      // bottom
    fill_rect(vo, gc, 0,      rc->y0, rc->x0, rc->y1); // left
    fill_rect(vo, gc, rc->x1, rc->y0, w,      rc->y1); // right

    XFlush(x11->display);
}
コード例 #29
0
ファイル: nStyle.cpp プロジェクト: alcemirfernandes/GD
void scrollStyle::draw_scroll_bar_background( const canvas& c, const rectangle& rect, const bool enabled,
        const long lastx, const long lasty, const bool is_depressed ) const
{
    if ( is_depressed )
        draw_checkered( c, rect, rgb_pixel( 0, 0, 0 ), rgb_pixel( 43, 47, 55 ) );
    else
        fill_rect( c, rect, rgb_pixel( 240, 240, 240 ) );
}
コード例 #30
0
static void rect_tests(struct test *t, int reps, int sets, enum target target, int use_window)
{
	struct test_target out, ref;
	int r, s;
	printf("Testing area fills (%s, using %s source): ",
	       test_target_name(target), use_window ? "window" : "pixmap");
	fflush(stdout);

	test_target_create_render(&t->out, target, &out);
	clear(&t->out, &out);

	test_target_create_render(&t->ref, target, &ref);
	clear(&t->ref, &ref);

	for (s = 0; s < sets; s++) {
		for (r = 0; r < reps; r++) {
			int x, y, w, h;
			uint8_t red = rand();
			uint8_t green = rand();
			uint8_t blue = rand();

			x = rand() % (out.width - 1);
			y = rand() % (out.height - 1);
			w = 1 + rand() % (out.width - x - 1);
			h = 1 + rand() % (out.height - y - 1);

			fill_rect(&t->out, out.picture,
				  x, y, w, h,
				  red, green, blue);
			fill_rect(&t->ref, ref.picture,
				  x, y, w, h,
				  red, green, blue);
		}

		test_compare(t,
			     out.draw, out.format,
			     ref.draw, ref.format,
			     0, 0, out.width, out.height,
			     "");
	}

	printf("passed [%d iterations x %d]\n", reps, sets);

	test_target_destroy_render(&t->out, &out);
	test_target_destroy_render(&t->ref, &ref);
}