Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fx_dib.cpp
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "core/fxge/dib/fx_dib.h"
8
9#include <tuple>
10#include <type_traits>
11#include <utility>
12
13#include "build/build_config.h"
14
15#if BUILDFLAG(IS_WIN)
16#include <windows.h>
17#endif
18
19#if BUILDFLAG(IS_WIN)
20static_assert(sizeof(FX_COLORREF) == sizeof(COLORREF),
21 "FX_COLORREF vs. COLORREF mismatch");
22#endif
23
24// Assert that FX_*_STRUCTS are packed.
25static_assert(sizeof(FX_RGB_STRUCT<uint8_t>) == 3u);
26static_assert(sizeof(FX_BGR_STRUCT<uint8_t>) == 3u);
27static_assert(sizeof(FX_ARGB_STRUCT<uint8_t>) == 4u);
28static_assert(sizeof(FX_ABGR_STRUCT<uint8_t>) == 4u);
29static_assert(sizeof(FX_RGBA_STRUCT<uint8_t>) == 4u);
30static_assert(sizeof(FX_BGRA_STRUCT<uint8_t>) == 4u);
31static_assert(sizeof(FX_CMYK_STRUCT<uint8_t>) == 4u);
32
33// Assert that FX_*_STRUCTS remain aggregates.
34static_assert(std::is_aggregate_v<FX_RGB_STRUCT<float>>);
35static_assert(std::is_aggregate_v<FX_BGR_STRUCT<float>>);
36static_assert(std::is_aggregate_v<FX_ARGB_STRUCT<float>>);
37static_assert(std::is_aggregate_v<FX_ABGR_STRUCT<float>>);
38static_assert(std::is_aggregate_v<FX_RGBA_STRUCT<float>>);
39static_assert(std::is_aggregate_v<FX_BGRA_STRUCT<float>>);
40static_assert(std::is_aggregate_v<FX_CMYK_STRUCT<float>>);
41
43
47
49 return {FXARGB_B(argb), FXARGB_G(argb), FXARGB_R(argb), FXARGB_A(argb)};
50}
51
53 return {FXARGB_B(argb), FXARGB_G(argb), FXARGB_R(argb)};
54}
55
57 return {FXARGB_A(argb), ArgbToColorRef(argb)};
58}
59
63
uint32_t FX_ARGB
Definition fx_dib.h:36
FX_BGRA_STRUCT< uint8_t > ArgbToBGRAStruct(FX_ARGB argb)
Definition fx_dib.cpp:48
#define FXARGB_B(argb)
Definition fx_dib.h:199
#define FXARGB_G(argb)
Definition fx_dib.h:198
constexpr uint32_t FXSYS_BGR(uint8_t b, uint8_t g, uint8_t r)
Definition fx_dib.h:139
std::pair< uint8_t, FX_COLORREF > ArgbToAlphaAndColorRef(FX_ARGB argb)
Definition fx_dib.cpp:56
FX_BGR_STRUCT< uint8_t > ArgbToBGRStruct(FX_ARGB argb)
Definition fx_dib.cpp:52
#define FXARGB_A(argb)
Definition fx_dib.h:196
FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref)
Definition fx_dib.cpp:64
uint32_t FX_COLORREF
Definition fx_dib.h:42
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:188
#define FXARGB_R(argb)
Definition fx_dib.h:197
constexpr uint8_t FXSYS_GetRValue(uint32_t bgr)
Definition fx_dib.h:143
FX_COLORREF ArgbToColorRef(FX_ARGB argb)
Definition fx_dib.cpp:60
constexpr uint8_t FXSYS_GetGValue(uint32_t bgr)
Definition fx_dib.h:147
constexpr uint8_t FXSYS_GetBValue(uint32_t bgr)
Definition fx_dib.h:151
bool HasAnyOptions() const
Definition fx_dib.cpp:44