Drawing with a Cairo context outside an expose signal

Hi,
I’m trying to allow a user to draw to a DrawingArea with Cairo.
The only problem is that I cannot figure out how to draw without using
create_cairo_context in the expose event.
I realize that I need to draw then if I want anything to be displayed,
but I’d like to be able to draw to a ‘buffer’ in other parts of the
script and then draw the buffer in the expose event.

There are two ways that I can think of doing this.
The first would be to create my own Cairo::Context. Since I don’t know
how create_cairo_context links a context to the DrawingArea, is stuck
for that.
The other way would be to draw to a surface and call
context.set_source_surface. For some reason, though, this function
doesn’t seem to be present in the ruby binding.

Thanks!

Hi,

In [email protected]
“[ruby-gnome2-devel-en] Drawing with a Cairo context outside an expose
signal” on Mon, 16 Jun 2008 10:38:24 +0200,
“Lucas L.” [email protected] wrote:

The other way would be to draw to a surface and call
context.set_source_surface. For some reason, though, this function
doesn’t seem to be present in the ruby binding.

Use Cairo::Context#set_source. It’s general method. It
accepts (r, g, b), (r, g, b, a), ([r, g, b]), ([r, g, b,
a]), (pattern) or (surface, x, y).

Thanks,

kou

Ah, I was searching the docs for surface_source.
rcairo really needs English documentation.

Thanks!

Kouhei S. wrote:

Hi,

In [email protected]
“[ruby-gnome2-devel-en] Drawing with a Cairo context outside an expose
signal” on Mon, 16 Jun 2008 10:38:24 +0200,
“Lucas L.” [email protected] wrote:

The other way would be to draw to a surface and call
context.set_source_surface. For some reason, though, this function
doesn’t seem to be present in the ruby binding.

Use Cairo::Context#set_source. It’s general method. It
accepts (r, g, b), (r, g, b, a), ([r, g, b]), ([r, g, b,
a]), (pattern) or (surface, x, y).

Thanks,

kou

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Drawing with a Cairo context outside an
expose signal” on Mon, 16 Jun 2008 14:17:43 +0200,
“Lucas L.” [email protected] wrote:

Ah, I was searching the docs for surface_source.
rcairo really needs English documentation.

I need your help.

Thanks,

kou

Kouhei S. wrote:

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Drawing with a Cairo context outside an
expose signal” on Mon, 16 Jun 2008 14:17:43 +0200,
“Lucas L.” [email protected] wrote:

Ah, I was searching the docs for surface_source.
rcairo really needs English documentation.

I need your help.

Thanks,

kou

Is there a wiki or something? I’d gladly help.
Right now I just try to make sense of Google’s translation of the
Japanese docs:D

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Drawing with a Cairo context outside an
expose signal” on Mon, 16 Jun 2008 14:30:16 +0200,
“Lucas L.” [email protected] wrote:

Ah, I was searching the docs for surface_source.
rcairo really needs English documentation.

I need your help.

Is there a wiki or something? I’d gladly help.

Thanks!
There is a Subversion repository:
https://www.cozmixng.org/repos/rcairo-doc/

Could you mail your prefer account name and salted password
(you may use htpasswd) to me?

Right now I just try to make sense of Google’s translation of the
Japanese docs:D

The Japanese documentations are based on cairo’s documents:
http://www.cairographics.org/manual/

Most of them will help you.

Thanks,

kou