Beispiel #1
0
JNIEXPORT void JNICALL
Java_org_gnome_gdk_GdkWindow_gdk_1window_1begin_1paint_1rect
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jlong _rectangle
)
{
	GdkWindow* self;
	GdkRectangle* rectangle;

	// convert parameter self
	self = (GdkWindow*) _self;

	// convert parameter rectangle
	rectangle = (GdkRectangle*) _rectangle;

	// call function
	gdk_window_begin_paint_rect(self, rectangle);

	// cleanup parameter self

	// cleanup parameter rectangle
}
/* draw frequency spectrum as a bunch of bars */
static void
draw_spectrum (gfloat * data)
{
  gint i;
  GdkRectangle rect = { 0, 0, spect_bands, spect_height };
  cairo_t *cr;

  if (!drawingarea)
    return;

  gdk_window_begin_paint_rect (gtk_widget_get_window (drawingarea), &rect);
  cr = gdk_cairo_create (gtk_widget_get_window (drawingarea));

  cairo_set_source_rgb (cr, 0, 0, 0);
  cairo_rectangle (cr, 0, 0, spect_bands, spect_height);
  cairo_fill (cr);
  cairo_set_source_rgb (cr, 1, 1, 1);
  for (i = 0; i < spect_bands; i++) {
    cairo_rectangle (cr, i, -data[i], 1, spect_height + data[i]);
    cairo_fill (cr);
  }
  cairo_destroy (cr);

  gdk_window_end_paint (gtk_widget_get_window (drawingarea));
}
static VALUE
rg_begin_paint(VALUE self, VALUE area)
{
    if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){
        gdk_window_begin_paint_rect(_SELF(self), 
                                    RVAL2GDKRECTANGLE(area));
    } else {
        gdk_window_begin_paint_region(_SELF(self), RVAL2CRREGION(area));
    }
    return self;
}
Beispiel #4
0
static VALUE
gdkwin_begin_paint(VALUE self, VALUE area)
{
    if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){
        gdk_window_begin_paint_rect(_SELF(self), 
                                    (GdkRectangle*)RVAL2BOXED(area, GDK_TYPE_RECTANGLE));
    } else {
        gdk_window_begin_paint_region(_SELF(self),
                                      (GdkRegion*)RVAL2BOXED(area, GDK_TYPE_REGION));
    }
    return self;
}
/* draw frequency spectrum as a bunch of bars */
static void
draw_spectrum (gfloat * data)
{
  gint i;
  GdkRectangle rect = { 0, 0, spect_bands, spect_height };

  if (!drawingarea)
    return;

  gdk_window_begin_paint_rect (drawingarea->window, &rect);
  gdk_draw_rectangle (drawingarea->window, drawingarea->style->black_gc,
      TRUE, 0, 0, spect_bands, spect_height);
  for (i = 0; i < spect_bands; i++) {
    gdk_draw_rectangle (drawingarea->window, drawingarea->style->white_gc,
        TRUE, i, -data[i], 1, spect_height + data[i]);
  }
  gdk_window_end_paint (drawingarea->window);
}
Beispiel #6
0
/**
 * draw_area:
 *
 * Draw the game area with its players and their cards
 */
void draw_area(void)
{
    gint i;
    cairo_t *cr;
    player *player;

    GdkRectangle rect =
    {
        0, 0,
        gskat.area->allocation.width,
        gskat.area->allocation.height
    };

    gdk_window_begin_paint_rect(gskat.area->window, &rect);

    cr = gdk_cairo_create(gskat.area->window);

    draw_table(gskat.area, cr);

    if (gskat.skat)
        draw_cards(gskat.skat, cr);

    if (gskat.table)
        draw_cards(gskat.table, cr);

    if (gskat.players)
    {
        for (i=0; i<3; ++i)
        {
            player = gskat.players[i];
            draw_cards(player->cards, cr);
            draw_player(player, cr);
        }
    }

    /* draw bid values during provoke phase only */
    if (gskat.state >= PROVOKE1 && gskat.state <= PROVOKE4 &&
            get_prop_bool("provoke_values"))
        draw_provoke_value(cr);

    cairo_destroy(cr);

    gdk_window_end_paint(gskat.area->window);
}
Beispiel #7
0
gboolean on_expose_event(GtkWidget *widget,
                         GdkEventExpose *event,
                         gpointer data)
{
    GdkWindow *window = widget->window;
    GtkStyle *style = gtk_widget_get_style(widget);

    gint width, height;
    gdk_drawable_get_size(window, & width, & height);

    GdkRectangle rect = {0, 0, width, height};

    gdk_window_begin_paint_rect(window, & rect);

    cairo_t *ctx = gdk_cairo_create(window);
    cairo_set_antialias(ctx, CAIRO_ANTIALIAS_NONE);
    cairo_set_line_width(ctx, 1);

    // Fill background.
    cairo_rectangle(ctx, 0, 0, width, height);
    cairo_set_source_rgb(ctx,
            style->mid[0].red/255./255.,
            style->mid[0].green/255./255.,
            style->mid[0].blue/255./255.);
    cairo_fill(ctx);

    // Line.
    cairo_move_to(ctx, 0, height/(gfloat)2);
    cairo_line_to(ctx, width, height/(gfloat)2);
    cairo_set_source_rgb(ctx,
            style->dark[0].red/255./255.,
            style->dark[0].green/255./255.,
            style->dark[0].blue/255./255.);
    cairo_stroke(ctx);

    gdk_window_end_paint(window);

    cairo_destroy(ctx);

    return FALSE;
}
Beispiel #8
0
/**
 * draw_tricks_area:
 * @area: #GtkDrawingArea widget the cards are drawn on
 * @sv:   trick (three cards) to draw
 *
 * Draw the tricks in the show last tricks dialog window
 */
void draw_tricks_area(GtkWidget *area, stich_view *sv)
{
    gint i, x, y, winner;
    gchar *caption = NULL;
    cairo_t *cr;
    trick *stich = sv->stich;
    card **cards = stich->cards;

    GdkRectangle rect =
    {
        0, 0,
        area->allocation.width,
        area->allocation.height
    };

    /* begin drawing process
     * used for double buffering */
    gdk_window_begin_paint_rect(area->window, &rect);

    cr = gdk_cairo_create(area->window);

    /* draw table background */
    draw_table(area, cr);

    /* draw current stich */
    caption = g_strdup_printf(_("Trick %d"), sv->cur + 1);

    cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
    cairo_select_font_face(cr, "sans-serif",
            CAIRO_FONT_SLANT_NORMAL,
            CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size(cr, 12);
    cairo_move_to(cr, area->allocation.width / 2 - 25, 25);
    cairo_show_text(cr, caption);

    /* draw cards of the given stich */
    x = 5;
    y = 40;
    winner = get_trick_winner(cards);

    for (i=0; i<3; ++i)
    {
        if (cards[i])
        {
            /* draw card image */
            cairo_set_source_surface(cr, cards[i]->img, x, y);
            cairo_paint(cr);

            /* darken the non-winning cards */
            if (cards[i]->owner != winner)
            {
                cairo_set_source_rgba(cr, 0.1, 0.1, 0.1, 0.2);
                cairo_rectangle(cr, x, y, cards[i]->dim.w, cards[i]->dim.h);
                cairo_fill(cr);
            }

            /* draw card owner's name */
            cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
            cairo_select_font_face(cr, "sans-serif",
                    CAIRO_FONT_SLANT_NORMAL,
                    CAIRO_FONT_WEIGHT_BOLD);
            cairo_set_font_size(cr, 12);
            cairo_move_to(cr, x, y + cards[i]->dim.h + 15);
            cairo_show_text(cr, gskat.players[cards[i]->owner]->name);

            x += cards[i]->dim.w + 5;
        }
    }

    cairo_destroy(cr);
    g_free(caption);

    /* end drawing process
     * used for double buffering */
    gdk_window_end_paint(area->window);
}