Gradients

Gradients — Metacity gradient rendering

Synopsis

enum                MetaGradientType;
GdkPixbuf *         meta_gradient_create_simple         (int width,
                                                         int height,
                                                         const GdkRGBA *from,
                                                         const GdkRGBA *to,
                                                         MetaGradientType style);
GdkPixbuf *         meta_gradient_create_multi          (int width,
                                                         int height,
                                                         const GdkRGBA *colors,
                                                         int n_colors,
                                                         MetaGradientType style);
GdkPixbuf *         meta_gradient_create_interwoven     (int width,
                                                         int height,
                                                         const GdkRGBA colors1[2],
                                                         int thickness1,
                                                         const GdkRGBA colors2[2],
                                                         int thickness2);
void                meta_gradient_add_alpha             (GdkPixbuf *pixbuf,
                                                         const guchar *alphas,
                                                         int n_alphas,
                                                         MetaGradientType type);

Description

Details

enum MetaGradientType

typedef enum {
  META_GRADIENT_VERTICAL,
  META_GRADIENT_HORIZONTAL,
  META_GRADIENT_DIAGONAL,
  META_GRADIENT_LAST
} MetaGradientType;

META_GRADIENT_VERTICAL

Vertical gradient

META_GRADIENT_HORIZONTAL

Horizontal gradient

META_GRADIENT_DIAGONAL

Diagonal gradient

META_GRADIENT_LAST

Marks the end of the MetaGradientType enumeration

meta_gradient_create_simple ()

GdkPixbuf *         meta_gradient_create_simple         (int width,
                                                         int height,
                                                         const GdkRGBA *from,
                                                         const GdkRGBA *to,
                                                         MetaGradientType style);

width :

Width in pixels

height :

Height in pixels

from :

Starting color

to :

Ending color

style :

Gradient style

Returns :

A new linear gradient. [transfer full]

meta_gradient_create_multi ()

GdkPixbuf *         meta_gradient_create_multi          (int width,
                                                         int height,
                                                         const GdkRGBA *colors,
                                                         int n_colors,
                                                         MetaGradientType style);

width :

Width in pixels

height :

Height in pixels

colors :

Array of colors. [array length=n_colors]

n_colors :

Number of colors

style :

Gradient style

Returns :

A new multi-step linear gradient. [transfer full]

meta_gradient_create_interwoven ()

GdkPixbuf *         meta_gradient_create_interwoven     (int width,
                                                         int height,
                                                         const GdkRGBA colors1[2],
                                                         int thickness1,
                                                         const GdkRGBA colors2[2],
                                                         int thickness2);

Interwoven essentially means we have two vertical gradients, cut into horizontal strips of the given thickness, and then the strips are alternated. I'm not sure what it's good for, just copied since WindowMaker had it.

width :

Width in pixels

height :

Height in pixels

colors1 :

Array of colors

thickness1 :

Thickness

colors2 :

Array of colors

thickness2 :

Thickness

meta_gradient_add_alpha ()

void                meta_gradient_add_alpha             (GdkPixbuf *pixbuf,
                                                         const guchar *alphas,
                                                         int n_alphas,
                                                         MetaGradientType type);