Browse Source

Added Context2d::setSourceRGBA()

v1.x
Tj Holowaychuk 14 years ago
parent
commit
19fe22a1c6
  1. 18
      src/CanvasRenderingContext2d.cc
  2. 1
      src/CanvasRenderingContext2d.h

18
src/CanvasRenderingContext2d.cc

@ -1069,13 +1069,11 @@ Context2d::FillRect(const Arguments &args) {
}
context->shadowStart();
cairo_rectangle(ctx, x, y, width, height);
SET_SOURCE_RGBA(context->state->shadow);
context->setSourceRGBA(context->state->shadow);
cairo_fill(ctx);
context->shadowApply();
cairo_rectangle(ctx, x, y, width, height);
cairo_fill(ctx);
return Undefined();
@ -1195,6 +1193,20 @@ Context2d::Arc(const Arguments &args) {
return Undefined();
}
/*
* Set source RGBA.
*/
void
Context2d::setSourceRGBA(rgba_t color) {
cairo_set_source_rgba(
_context
, color.r
, color.g
, color.b
, color.a * state->globalAlpha);
}
/*
* Start shadow context.
*/

1
src/CanvasRenderingContext2d.h

@ -101,6 +101,7 @@ class Context2d: public node::ObjectWrap {
inline cairo_t *getContext(){ return _context; }
inline Canvas *getCanvas(){ return _canvas; }
inline bool hasShadow();
void inline setSourceRGBA(rgba_t color);
void setTextPath(const char *str, double x, double y);
void shadowStart();
void shadowApply();

Loading…
Cancel
Save