Re: setting line dash on Gnome2::Canvas
- From: Remco Wouts <remco wouts mpibp-frankfurt mpg de>
- To: gtk-perl-list gnome org
- Subject: Re: setting line dash on Gnome2::Canvas
- Date: Mon, 20 Mar 2006 15:42:28 +0100
Torsten Schoenfeld wrote:
On Thu, 2006-03-16 at 18:04 -0500, zentara wrote:
# feeble attempt dosn't work
#$line1->set_dashes( {0,0xff,0,0xff} );
As the name gdk_gc_set_dashes suggests, you need to call the set_dashes
method on a Gtk2::Gdk::GC object:
$gc->set_dashes(0, 0xff, 0, 0xff);
Unfortunately though, the "gc" struct member of Gnome2::Canvas::Line is
not accessible via the bindings at this point -- so right now, I think
this isn't possible.
The following hack works for me:
use Inline C => 'DATA';
Inline->init;
....<your stuff>
$canvasitem->set(dash=>main::pattern(0,10,5));
__DATA__
__C__
void pattern(SV* dashes, ... )
{
Inline_Stack_Vars;
int i;
static struct dashes {
double offset;
int ndash;
double *buf;
} *dash = NULL;
if ( dash == NULL ) {
New(0, dash, 1, struct dashes);
New(0, dash->buf, Inline_Stack_Items-1, double);
} else {
Renew(dash->buf, Inline_Stack_Items-1, double);
}
dash->ndash = Inline_Stack_Items-1;
dash->offset = SvNV(Inline_Stack_Item(0));
for ( i = 1; i < Inline_Stack_Items; i++ )
dash->buf[i-1] = SvNV(Inline_Stack_Item(i)) > 0 ?
SvNV(Inline_Stack_Item(i)) : 1;
Inline_Stack_Reset;
Inline_Stack_Push(sv_2mortal(newSViv((long) dash)));
Inline_Stack_Done;
}
--
remco wouts
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]