Ok great, it seems to be working. The relevant code in Ruby comes up as this:
Code:
da = @builder["frame_view"]
# Get the dimensions of the frame
dims = da.allocation
d_width, d_height = dims.width, dims.height
# Create the context
c = da.window.create_cairo_context
# Clear the pixbuf to a neutral colour
c.set_operator(Cairo::Operator::SOURCE)
c.set_source_rgb( RGB_NEUTRAL )
c.paint
# Find the center point
center_x = (d_width / 2).round
center_y = (d_height / 2).round
# Paint the cell
c.set_operator(Cairo::Operator::OVER)
c.set_source_pixbuf(@cell.cell, center_x, center_y)
c.paint
where @cell.cell returns a rectangular partition of the source pixbuf, like this:
Code:
Gdk::Pixbuf.new(source, rect.x, rect.y, rect.w, rect.h)
My last concern is, is there a way to apply just a partition of the source pixbuf to the cairo context, without having to create a new Pixbuf object?