Cairo, putting gradient on text? 1 Beer to the person who can do it.

This is a discussion on Cairo, putting gradient on text? 1 Beer to the person who can do it. within the C Programming forums, part of the General Programming Boards category; I have some text in cairo, and I set the text to a path using: cairo_text_path(). That allows me to ...

  1. #1
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153

    Cairo, putting gradient on text? 1 Beer to the person who can do it.

    I have some text in cairo, and I set the text to a path using: cairo_text_path(). That allows me to perform fills on it just fine. But I can't seem to get a gradient to display. It is only showing the first 'stop' color. Here's the relevant code:
    Code:
    cairo_pattern_t *radpat;
    
    radpat = cairo_pattern_create_linear (0,0,0,1);
    
    cairo_pattern_add_color_stop_rgb (radpat, 0 , .2 ,0, 0  );
    cairo_pattern_add_color_stop_rgb (radpat, 1 , .7,.7,.7 );
    
    cairo_text_path(crtemp4,tempoption->companyname);
    cairo_set_source(crtemp4,radpat);
    
    cairo_fill(crtemp4);
    Any thoughts?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,540
    Since your pattern only runs from 0 to 1, do you need to scale it to match the drawn object?
    cairo-pattern-set-matrix
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cairo text / mirrored text
    By javaeyes in forum C Programming
    Replies: 4
    Last Post: 02-28-2012, 11:57 AM
  2. cairo text extent weirdness
    By javaeyes in forum C Programming
    Replies: 3
    Last Post: 02-24-2012, 06:24 PM
  3. Collecting text and putting in string
    By FlyingIsFun1217 in forum C++ Programming
    Replies: 14
    Last Post: 04-08-2007, 11:46 AM
  4. Putting text into an edit box
    By eam in forum Windows Programming
    Replies: 5
    Last Post: 11-08-2003, 01:22 AM
  5. Putting CView text into a buffer
    By CodeMonkey in forum Windows Programming
    Replies: 4
    Last Post: 08-22-2002, 02:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21