SkTableMaskFilter.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright 2006 The Android Open Source Project
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #ifndef SkTableMaskFilter_DEFINED
  8. #define SkTableMaskFilter_DEFINED
  9. #include "include/core/SkMaskFilter.h"
  10. #include "include/core/SkScalar.h"
  11. /** \class SkTableMaskFilter
  12. Applies a table lookup on each of the alpha values in the mask.
  13. Helper methods create some common tables (e.g. gamma, clipping)
  14. */
  15. class SK_API SkTableMaskFilter {
  16. public:
  17. /** Utility that sets the gamma table
  18. */
  19. static void MakeGammaTable(uint8_t table[256], SkScalar gamma);
  20. /** Utility that creates a clipping table: clamps values below min to 0
  21. and above max to 255, and rescales the remaining into 0..255
  22. */
  23. static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max);
  24. static SkMaskFilter* Create(const uint8_t table[256]);
  25. static SkMaskFilter* CreateGamma(SkScalar gamma);
  26. static SkMaskFilter* CreateClip(uint8_t min, uint8_t max);
  27. SkTableMaskFilter() = delete;
  28. };
  29. #endif