Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
include
core
SkColorTable.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Google LLC
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
8
#ifndef SkColorTable_DEFINED
9
#define SkColorTable_DEFINED
10
11
#include "
include/core/SkBitmap.h
"
12
#include "
include/core/SkRefCnt.h
"
13
#include "
include/private/base/SkAPI.h
"
14
15
#include <cstdint>
16
17
class
SkReadBuffer
;
18
class
SkWriteBuffer
;
19
20
/**
21
* SkColorTable holds the lookup tables for each channel (ARGB) used to define the filter behavior
22
* of `SkColorFilters::Table`, and provides a way to share the table data between client code and
23
* the returned SkColorFilter. Once created, an SkColorTable is immutable.
24
*/
25
class
SK_API
SkColorTable
:
public
SkRefCnt
{
26
public
:
27
// Creates a new SkColorTable with 'table' used for all four channels. The table is copied into
28
// the SkColorTable.
29
static
sk_sp<SkColorTable>
Make
(
const
uint8_t
table
[256]) {
30
return
Make
(
table
,
table
,
table
,
table
);
31
}
32
33
// Creates a new SkColorTable with the per-channel lookup tables. Each non-null table is copied
34
// into the SkColorTable. Null parameters are interpreted as the identity table.
35
static
sk_sp<SkColorTable>
Make
(
const
uint8_t tableA[256],
36
const
uint8_t tableR[256],
37
const
uint8_t tableG[256],
38
const
uint8_t tableB[256]);
39
40
// Per-channel constant value lookup (0-255).
41
const
uint8_t*
alphaTable
()
const
{
return
fTable.getAddr8(0, 0); }
42
const
uint8_t*
redTable
()
const
{
return
fTable.getAddr8(0, 1); }
43
const
uint8_t*
greenTable
()
const
{
return
fTable.getAddr8(0, 2); }
44
const
uint8_t*
blueTable
()
const
{
return
fTable.getAddr8(0, 3); }
45
46
void
flatten(
SkWriteBuffer
&
buffer
)
const
;
47
48
static
sk_sp<SkColorTable>
Deserialize(
SkReadBuffer
&
buffer
);
49
50
private
:
51
friend
class
SkTableColorFilter
;
// for bitmap()
52
53
SkColorTable
(
const
SkBitmap
&
table
) : fTable(
table
) {}
54
55
// The returned SkBitmap is immutable; attempting to modify its pixel data will trigger asserts
56
// in debug builds and cause undefined behavior in release builds.
57
const
SkBitmap
&
bitmap
()
const
{
return
fTable; }
58
59
SkBitmap
fTable;
// A 256x4 A8 image
60
};
61
62
#endif
// SkColorTable_DEFINED
SkAPI.h
SK_API
#define SK_API
Definition
SkAPI.h:35
SkBitmap.h
Make
static std::unique_ptr< SkEncoder > Make(SkWStream *dst, const SkPixmap *src, const SkYUVAPixmaps *srcYUVA, const SkColorSpace *srcYUVAColorSpace, const SkJpegEncoder::Options &options)
Definition
SkJpegEncoderImpl.cpp:259
SkRefCnt.h
table
SI F table(const skcms_Curve *curve, F v)
Definition
Transform_inl.h:604
SkBitmap
Definition
SkBitmap.h:59
SkColorTable
Definition
SkColorTable.h:25
SkColorTable::redTable
const uint8_t * redTable() const
Definition
SkColorTable.h:42
SkColorTable::alphaTable
const uint8_t * alphaTable() const
Definition
SkColorTable.h:41
SkColorTable::Make
static sk_sp< SkColorTable > Make(const uint8_t table[256])
Definition
SkColorTable.h:29
SkColorTable::greenTable
const uint8_t * greenTable() const
Definition
SkColorTable.h:43
SkColorTable::blueTable
const uint8_t * blueTable() const
Definition
SkColorTable.h:44
SkReadBuffer
Definition
SkReadBuffer.h:52
SkRefCnt
Definition
SkRefCnt.h:119
SkTableColorFilter
Definition
SkTableColorFilter.h:22
SkWriteBuffer
Definition
SkWriteBuffer.h:41
sk_sp
Definition
SkRefCnt.h:220
buffer
static const uint8_t buffer[]
Definition
fl_pixel_buffer_texture_test.cc:44
bitmap
Definition
bitmap.py:1
Generated on Fri Apr 26 2024 06:16:10 for Flutter Engine by
1.9.8