示例#1
0
文件: cursor.cpp 项目: Elzair/q3map2
GdkCursor* create_blank_cursor(){
	GdkPixmap *pixmap;
	GdkBitmap *mask;
	char buffer [( 32 * 32 ) / 8];
	memset( buffer, 0, ( 32 * 32 ) / 8 );
	GdkColor white = {0, 0xffff, 0xffff, 0xffff};
	GdkColor black = {0, 0x0000, 0x0000, 0x0000};
	pixmap = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
	mask   = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
	GdkCursor *cursor = gdk_cursor_new_from_pixmap( pixmap, mask, &white, &black, 1, 1 );
	gdk_drawable_unref( pixmap );
	gdk_drawable_unref( mask );

	return cursor;
}
示例#2
0
static void
set_size(DiaRenderer *object, gpointer window,
		      int width, int height)
{
  DiaCairoInteractiveRenderer *renderer = DIA_CAIRO_INTERACTIVE_RENDERER (object);
  DiaCairoRenderer *base_renderer = DIA_CAIRO_RENDERER (object);

  renderer->width = width;
  renderer->height = height;
  if (renderer->pixmap != NULL)
    gdk_drawable_unref(renderer->pixmap);

  /* TODO: we can probably get rid of this extra pixmap and just draw directly to what gdk_cairo_create() gives us for the window */
  renderer->pixmap = gdk_pixmap_new(GDK_WINDOW(window),  width, height, -1);

  if (base_renderer->surface != NULL)
    cairo_surface_destroy(base_renderer->surface);

  if (renderer->gc == NULL) {
    renderer->gc = gdk_gc_new(renderer->pixmap);
  }
}
示例#3
0
static void
set_size(DiaRenderer *object, gpointer window,
		      int width, int height)
{
  DiaGdkRenderer *renderer = DIA_GDK_RENDERER (object);

  if (renderer->pixmap != NULL)
    gdk_drawable_unref(renderer->pixmap);

  if (window)
    renderer->pixmap = gdk_pixmap_new(GDK_WINDOW(window),  width, height, -1);
  else /* the integrated UI insist to call us too early */
    renderer->pixmap = gdk_pixmap_new(NULL,  width, height, 24);

  if (renderer->gc == NULL) {
    renderer->gc = gdk_gc_new(renderer->pixmap);

    gdk_gc_set_line_attributes(renderer->gc,
			       renderer->line_width,
			       renderer->line_style,
			       renderer->cap_style,
			       renderer->join_style);
  }
}