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 <utility>
11
12#include "build/build_config.h"
13
14#if BUILDFLAG(IS_WIN)
15#include <windows.h>
16#endif
17
18#if BUILDFLAG(IS_WIN)
19static_assert(sizeof(FX_COLORREF) == sizeof(COLORREF),
20 "FX_COLORREF vs. COLORREF mismatch");
21#endif
22
24 switch (bpp) {
25 case 1:
27 case 8:
29 case 24:
30 return FXDIB_Format::kRgb;
31 case 32:
33 default:
35 }
36}
37
39
43
44std::tuple<int, int, int, int> ArgbDecode(FX_ARGB argb) {
45 return std::make_tuple(FXARGB_A(argb), FXARGB_R(argb), FXARGB_G(argb),
46 FXARGB_B(argb));
47}
48
49std::pair<int, FX_COLORREF> ArgbToAlphaAndColorRef(FX_ARGB argb) {
50 return {FXARGB_A(argb), ArgbToColorRef(argb)};
51}
52
53FX_COLORREF ArgbToColorRef(FX_ARGB argb) {
54 return FXSYS_BGR(FXARGB_B(argb), FXARGB_G(argb), FXARGB_R(argb));
55}
56
57FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref) {
59 FXSYS_GetBValue(colorref));
60}
#define FXARGB_B(argb)
Definition fx_dib.h:127
#define FXARGB_G(argb)
Definition fx_dib.h:126
constexpr uint32_t FXSYS_BGR(uint8_t b, uint8_t g, uint8_t r)
Definition fx_dib.h:69
FXDIB_Format MakeRGBFormat(int bpp)
Definition fx_dib.cpp:23
std::pair< int, FX_COLORREF > ArgbToAlphaAndColorRef(FX_ARGB argb)
Definition fx_dib.cpp:49
#define FXARGB_A(argb)
Definition fx_dib.h:124
FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref)
Definition fx_dib.cpp:57
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118
#define FXARGB_R(argb)
Definition fx_dib.h:125
constexpr uint8_t FXSYS_GetRValue(uint32_t bgr)
Definition fx_dib.h:73
std::tuple< int, int, int, int > ArgbDecode(FX_ARGB argb)
Definition fx_dib.cpp:44
FX_COLORREF ArgbToColorRef(FX_ARGB argb)
Definition fx_dib.cpp:53
FXDIB_Format
Definition fx_dib.h:19
constexpr uint8_t FXSYS_GetGValue(uint32_t bgr)
Definition fx_dib.h:77
constexpr uint8_t FXSYS_GetBValue(uint32_t bgr)
Definition fx_dib.h:81
bool HasAnyOptions() const
Definition fx_dib.cpp:40
bool bInterpolateBilinear
Definition fx_dib.h:41