code segfaults sometimes......Why?

I can't say without seeing some code, and you may be better off asking on the Perl/Gtk2 maillist, but they will want a simple example also.

Try to use the latest version of Cairo, and look at the examples. For example, regarding your yellow problem, the module's /examples/png subdir shows a stars.pl example, which shows setting color by

$cr->set_source_rgb (0, 0, 0);
to set the color,

and the perldoc shows 2 ways, 1 with an alpha layer

$cr->set_source_rgb ($red, $green, $blue) $red: double $green: double $blue: double
for rgb32 you get an alpha layer
$cr->set_source_rgba ($red, $green, $blue, $alpha) $red: double $green: double $blue: double $alpha: double
Now your setting $data with

$data .= pack 'CCCC',255,$value,$value,$value; where $value is int from 0 to 255

dosn't seem to to be doing what is needed to set the stroke color....you almost appear to have the alpha setting (255) at the wrong end of the list, and additionally I'm not sure pack 'CCCC' is the right pack option.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re^3: Gdk, Pixbuf, Cairo, build them up by zentara
in thread Gdk, Pixbuf, Cairo, build them up by llancet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.