7#include "xfa/fgas/graphics/cfgas_geshading.h"
10 const CFX_PointF& endPoint,
20 m_isExtendedBegin(isExtendedBegin),
21 m_isExtendedEnd(isExtendedEnd) {
22 InitArgbArray(beginArgb, endArgb);
26 const CFX_PointF& endPoint,
36 m_beginRadius(beginRadius),
37 m_endRadius(endRadius),
38 m_isExtendedBegin(isExtendedBegin),
39 m_isExtendedEnd(isExtendedEnd) {
40 InitArgbArray(beginArgb, endArgb);
45void CFGAS_GEShading::InitArgbArray(FX_ARGB beginArgb, FX_ARGB endArgb) {
50 std::tie(a1, r1, g1, b1) = ArgbDecode(beginArgb);
56 std::tie(a2, r2, g2, b2) = ArgbDecode(endArgb);
58 float f =
static_cast<
float>(kSteps - 1);
59 float aScale = 1.0 * (a2 - a1) / f;
60 float rScale = 1.0 * (r2 - r1) / f;
61 float gScale = 1.0 * (g2 - g1) / f;
62 float bScale = 1.0 * (b2 - b1) / f;
64 for (size_t i = 0; i < kSteps; i++) {
65 int32_t a3 =
static_cast<int32_t>(i * aScale);
66 int32_t r3 =
static_cast<int32_t>(i * rScale);
67 int32_t g3 =
static_cast<int32_t>(i * gScale);
68 int32_t b3 =
static_cast<int32_t>(i * bScale);
71 m_argbArray[i] = ArgbEncode(a1 + a3, r1 + r3, g1 + g3, b1 + b3);
CFGAS_GEShading(const CFX_PointF &beginPoint, const CFX_PointF &endPoint, bool isExtendedBegin, bool isExtendedEnd, FX_ARGB beginArgb, FX_ARGB endArgb)
CFGAS_GEShading(const CFX_PointF &beginPoint, const CFX_PointF &endPoint, float beginRadius, float endRadius, bool isExtendedBegin, bool isExtendedEnd, FX_ARGB beginArgb, FX_ARGB endArgb)