7#ifndef CORE_FXGE_DIB_CFX_DIBITMAP_H_
8#define CORE_FXGE_DIB_CFX_DIBITMAP_H_
10#include "core/fxcrt/fx_memory_wrappers.h"
11#include "core/fxcrt/maybe_owned.h"
12#include "core/fxcrt/retain_ptr.h"
13#include "core/fxge/dib/cfx_dibbase.h"
14#include "core/fxge/dib/fx_dib.h"
15#include "third_party/abseil-cpp/absl/types/optional.h"
16#include "third_party/base/containers/span.h"
37 pdfium::span<
const uint8_t>
GetScanline(
int line)
const override;
39#if BUILDFLAG(IS_WIN) || defined(PDF_USE_SKIA)
40 RetainPtr<
const CFX_DIBitmap> RealizeIfNeeded()
const override;
43 pdfium::span<
const uint8_t>
GetBuffer()
const;
45 pdfium::span<
const uint8_t> src = GetBuffer();
46 return {
const_cast<uint8_t*>(src.data()), src.size()};
50 pdfium::span<
const uint8_t> src = GetScanline(line);
51 return {
const_cast<uint8_t*>(src.data()), src.size()};
56 void Clear(uint32_t color);
58#if defined(PDF_USE_SKIA)
59 uint32_t GetPixelForTesting(
int x,
int y)
const;
129#if defined(PDF_USE_SKIA)
131 void UnPreMultiply();
135 void ForcePreMultiply();
139#if defined(PDF_USE_SKIA)
140 bool IsPremultiplied()
const override;
144 enum class Channel : uint8_t { kRed, kAlpha };
146#if defined(PDF_USE_SKIA)
147 enum class Format { kCleared, kPreMultiplied, kUnPreMultiplied };
151 CFX_DIBitmap(
const CFX_DIBitmap& src);
154 bool SetChannelFromBitmap(Channel dest_channel,
156 void ConvertBGRColorScale(uint32_t forecolor, uint32_t backcolor);
157 bool TransferWithUnequalFormats(
FXDIB_Format dest_format,
165 void TransferWithMultipleBPP(
int dest_left,
172 void TransferEqualFormatsOneBPP(
int dest_left,
181#if defined(PDF_USE_SKIA)
182 Format m_nFormat = Format::kCleared;
bool TransferBitmap(int dest_left, int dest_top, int width, int height, RetainPtr< const CFX_DIBBase > source, int src_left, int src_top)
bool SetAlphaFromBitmap(RetainPtr< const CFX_DIBBase > source)
bool SetUniformOpaqueAlpha()
bool Create(int width, int height, FXDIB_Format format)
pdfium::span< const uint8_t > GetBuffer() const
static absl::optional< PitchAndSize > CalculatePitchAndSize(int width, int height, FXDIB_Format format, uint32_t pitch)
bool CompositeMask(int dest_left, int dest_top, int width, int height, const RetainPtr< const CFX_DIBBase > &pMask, uint32_t color, int src_left, int src_top, BlendMode blend_type, const CFX_ClipRgn *pClipRgn, bool bRgbByteOrder)
bool SetRedFromBitmap(RetainPtr< const CFX_DIBBase > source)
bool MultiplyAlphaMask(RetainPtr< const CFX_DIBBase > source)
pdfium::span< uint8_t > GetWritableScanline(int line)
bool CompositeBitmap(int dest_left, int dest_top, int width, int height, RetainPtr< const CFX_DIBBase > source, int src_left, int src_top, BlendMode blend_type, const CFX_ClipRgn *pClipRgn, bool bRgbByteOrder)
bool ConvertColorScale(uint32_t forecolor, uint32_t backcolor)
bool ConvertFormat(FXDIB_Format format)
bool CompositeRect(int dest_left, int dest_top, int width, int height, uint32_t color)
pdfium::span< const uint8_t > GetScanline(int line) const override
size_t GetEstimatedImageMemoryBurden() const override
bool MultiplyAlpha(float alpha)
pdfium::span< uint8_t > GetWritableBuffer()
bool Create(int width, int height, FXDIB_Format format, uint8_t *pBuffer, uint32_t pitch)
void TakeOver(RetainPtr< CFX_DIBitmap > &&pSrcBitmap)
void Clear(uint32_t color)
bool Copy(RetainPtr< const CFX_DIBBase > source)
void CompositeOneBPPMask(int dest_left, int dest_top, int width, int height, RetainPtr< const CFX_DIBBase > source, int src_left, int src_top)
FX_RECT ToRoundedFxRect() const
CFX_FloatRect(const FX_RECT &rect)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
const CFX_Matrix & matrix() const
static float TextUnitToGlyphUnit(float fTextUnit)
void Transform(CPDF_Font::FormIface *pForm, const CFX_Matrix &matrix)
void InitializeFromStreamData(bool bColored, pdfium::span< const float > pData)
RetainPtr< CFX_DIBitmap > GetBitmap()
static void TextUnitRectToGlyphUnitRect(CFX_FloatRect *pRect)
const FX_RECT & bbox() const
const CPDF_Font::FormIface * form() const
bool LoadBitmapFromSoleImageOfForm()
void SetForm(std::unique_ptr< CPDF_Font::FormIface > pForm)
#define CONSTRUCT_VIA_MAKE_RETAIN
FX_RECT & operator=(const FX_RECT &that)=default