Skia
2D Graphics Library
SkUnPreMultiply.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright 2008 The Android Open Source Project
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 
10 
11 
12 
13 #ifndef SkUnPreMultiply_DEFINED
14 #define SkUnPreMultiply_DEFINED
15 
16 #include "include/core/SkColor.h"
17 
19 public:
20  typedef uint32_t Scale;
21 
22  // index this table with alpha [0..255]
23  static const Scale* GetScaleTable() {
24  return gTable;
25  }
26 
27  static Scale GetScale(U8CPU alpha) {
28  SkASSERT(alpha <= 255);
29  return gTable[alpha];
30  }
31 
45  static U8CPU ApplyScale(Scale scale, U8CPU component) {
46  SkASSERT(component <= 255);
47  return (scale * component + (1 << 23)) >> 24;
48  }
49 
51 
52 private:
53  static const uint32_t gTable[256];
54 };
55 
56 #endif
SkUnPreMultiply::GetScaleTable
static const Scale * GetScaleTable()
Definition: SkUnPreMultiply.h:23
SK_API
#define SK_API
Definition: SkTypes.h:181
SkASSERT
#define SkASSERT(cond)
Definition: SkTypes.h:460
SkUnPreMultiply::GetScale
static Scale GetScale(U8CPU alpha)
Definition: SkUnPreMultiply.h:27
SkUnPreMultiply
Definition: SkUnPreMultiply.h:18
SkUnPreMultiply::PMColorToColor
static SkColor PMColorToColor(SkPMColor c)
SkUnPreMultiply::ApplyScale
static U8CPU ApplyScale(Scale scale, U8CPU component)
Usage:
Definition: SkUnPreMultiply.h:45
SkPMColor
uint32_t SkPMColor
32-bit ARGB color value, premultiplied.
Definition: SkColor.h:203
SkColor
uint32_t SkColor
32-bit ARGB color value, unpremultiplied.
Definition: SkColor.h:35
U8CPU
unsigned U8CPU
Fast type for unsigned 8 bits.
Definition: SkTypes.h:488
SkColor.h
SkUnPreMultiply::Scale
uint32_t Scale
Definition: SkUnPreMultiply.h:20