Home | History | Annotate | Download | only in fxgraphics
      1 // Copyright 2016 PDFium Authors. All rights reserved.
      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 #ifndef XFA_FXGRAPHICS_CXFA_GESHADING_H_
      8 #define XFA_FXGRAPHICS_CXFA_GESHADING_H_
      9 
     10 #include "core/fxcrt/fx_coordinates.h"
     11 #include "core/fxcrt/fx_system.h"
     12 #include "core/fxge/fx_dib.h"
     13 
     14 #define FX_SHADING_Steps 256
     15 
     16 enum CXFA_GEShading_Type { FX_SHADING_Axial = 1, FX_SHADING_Radial };
     17 
     18 class CXFA_GEShading {
     19  public:
     20   // Axial shading.
     21   CXFA_GEShading(const CFX_PointF& beginPoint,
     22                  const CFX_PointF& endPoint,
     23                  bool isExtendedBegin,
     24                  bool isExtendedEnd,
     25                  const FX_ARGB beginArgb,
     26                  const FX_ARGB endArgb);
     27 
     28   // Radial shading.
     29   CXFA_GEShading(const CFX_PointF& beginPoint,
     30                  const CFX_PointF& endPoint,
     31                  const float beginRadius,
     32                  const float endRadius,
     33                  bool isExtendedBegin,
     34                  bool isExtendedEnd,
     35                  const FX_ARGB beginArgb,
     36                  const FX_ARGB endArgb);
     37   virtual ~CXFA_GEShading();
     38 
     39  private:
     40   friend class CXFA_Graphics;
     41 
     42   void InitArgbArray();
     43 
     44   const CXFA_GEShading_Type m_type;
     45   const CFX_PointF m_beginPoint;
     46   const CFX_PointF m_endPoint;
     47   const float m_beginRadius;
     48   const float m_endRadius;
     49   const bool m_isExtendedBegin;
     50   const bool m_isExtendedEnd;
     51   const FX_ARGB m_beginArgb;
     52   const FX_ARGB m_endArgb;
     53   FX_ARGB m_argbArray[FX_SHADING_Steps];
     54 };
     55 
     56 #endif  // XFA_FXGRAPHICS_CXFA_GESHADING_H_
     57