cairo-utils.h revision 41956e81860e9b4971042dc68826605afa1129e1
/**
* @file
* @brief Cairo integration helpers
*//*
* Authors:
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
*
* Copyright (C) 2010 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
struct SPColor;
/** @brief RAII idiom for Cairo groups.
* Groups are temporary surfaces used when rendering e.g. masks and opacity.
* Use this class to ensure that each group push is matched with a pop. */
~CairoGroup();
void push();
cairo_pattern_t *pop();
void pop_to_source();
bool pushed;
};
/** @brief RAII idiom for Cairo state saving */
{
if (save) {
cairo_save(ct);
}
}
void save() {
if (!saved) {
cairo_save(ct);
saved = true;
}
}
~CairoSave() {
if (saved)
}
bool saved;
};
/** @brief Cairo context with Inkscape-specific operations */
};
} // namespace Inkscape
void ink_cairo_surface_average_color(cairo_surface_t *surface, double &r, double &g, double &b, double &a);
void ink_cairo_surface_average_color_premul(cairo_surface_t *surface, double &r, double &g, double &b, double &a);
void convert_pixbuf_normal_to_argb32(GdkPixbuf *);
void convert_pixbuf_argb32_to_normal(GdkPixbuf *);
/** Convert a pixel in 0xRRGGBBAA format to Cairo ARGB32 format. */
G_GNUC_CONST inline guint32
{
}
G_GNUC_CONST inline guint32
{
// NOTE: you must check for alpha != 0 yourself.
}
// TODO: move those to 2Geom
void feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv, Geom::Affine trans, Geom::OptRect area, bool optimize_stroke, double stroke_width);
#define EXTRACT_ARGB32(px,a,r,g,b) \
guint32 a, r, g, b; \
b = ((px) & 0x000000ff);
#define ASSEMBLE_ARGB32(px,a,r,g,b) \
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :