SkLumaColorFilter.h revision 8b0e8ac5f582de80356019406e2975079bf0829d
16c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org/* 26c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * Copyright 2013 Google Inc. 36c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * 46c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be 56c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * found in the LICENSE file. 66c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org */ 76c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 86c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org#ifndef SkLumaColorFilter_DEFINED 96c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org#define SkLumaColorFilter_DEFINED 106c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 116c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org#include "SkColorFilter.h" 126c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 136c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org/** 146c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * Luminance-to-alpha color filter, as defined in 156c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * http://www.w3.org/TR/SVG/masking.html#Masking 166c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * http://www.w3.org/TR/css-masking/#MaskValues 176c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * 18d494b09f554d470fc6411d0924879bbfb0cb0e95commit-bot@chromium.org * The resulting color is black with transparency equal to the 19d494b09f554d470fc6411d0924879bbfb0cb0e95commit-bot@chromium.org * luminance value modulated by alpha: 206c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * 21d494b09f554d470fc6411d0924879bbfb0cb0e95commit-bot@chromium.org * C' = [ Lum * a, 0, 0, 0 ] 226c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org * 236c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org */ 246c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.orgclass SK_API SkLumaColorFilter : public SkColorFilter { 256c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.orgpublic: 266c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org static SkColorFilter* Create(); 276c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 286c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE; 296c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 306c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org#if SK_SUPPORT_GPU 316c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE; 326c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org#endif 336c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 346c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;) 356c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter) 366c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 376c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.orgprotected: 388b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkLumaColorFilter(SkReadBuffer& buffer); 398b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 406c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 416c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.orgprivate: 426c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org SkLumaColorFilter(); 436c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 446c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org typedef SkColorFilter INHERITED; 456c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org}; 466c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org 476c1ee2d4e727357451c8a6fcf4a08e75890b5d6dcommit-bot@chromium.org#endif 48