Browse Source

Merge pull request #277 from mojodna/pattern-quality

Add 'nearest' and 'bilinear' to patternQuality
v1.x
TJ Holowaychuk 12 years ago
parent
commit
fedf14cbf3
  1. 2
      Readme.md
  2. 6
      src/CanvasRenderingContext2d.cc

2
Readme.md

@ -146,6 +146,8 @@ Given one of the values below will alter pattern (gradients, images, etc) render
- fast
- good
- best
- nearest
- bilinear
### CanvasRenderingContext2d#textDrawingMode

6
src/CanvasRenderingContext2d.cc

@ -778,6 +778,10 @@ Context2d::SetPatternQuality(Local<String> prop, Local<Value> val, const Accesso
context->state->patternQuality = CAIRO_FILTER_GOOD;
} else if (0 == strcmp("best", *quality)) {
context->state->patternQuality = CAIRO_FILTER_BEST;
} else if (0 == strcmp("nearest", *quality)) {
context->state->patternQuality = CAIRO_FILTER_NEAREST;
} else if (0 == strcmp("bilinear", *quality)) {
context->state->patternQuality = CAIRO_FILTER_BILINEAR;
}
}
@ -793,6 +797,8 @@ Context2d::GetPatternQuality(Local<String> prop, const AccessorInfo &info) {
switch (context->state->patternQuality) {
case CAIRO_FILTER_FAST: quality = "fast"; break;
case CAIRO_FILTER_BEST: quality = "best"; break;
case CAIRO_FILTER_NEAREST: quality = "nearest"; break;
case CAIRO_FILTER_BILINEAR: quality = "bilinear"; break;
default: quality = "good";
}
return scope.Close(String::NewSymbol(quality));

Loading…
Cancel
Save