Adds for previous commit

This commit is contained in:
Oleg Korshul
2023-07-02 14:17:38 +03:00
parent 4306486c3c
commit 0a5f9070de
6 changed files with 68 additions and 62 deletions

View File

@ -16,14 +16,6 @@
#ifndef AGG_SPAN_GRADIENT_INCLUDED #ifndef AGG_SPAN_GRADIENT_INCLUDED
#define AGG_SPAN_GRADIENT_INCLUDED #define AGG_SPAN_GRADIENT_INCLUDED
#include <stdlib.h>
#include <string.h>
#include "../../graphics/structures.h"
#include "agg_math.h"
#include "agg_array.h"
#include "agg_trans_affine.h"
#include <iostream>
#include <cmath>
#include "./test_grads/custom_gradients.h" #include "./test_grads/custom_gradients.h"
namespace agg namespace agg
{ {

View File

@ -1,9 +1,11 @@
#include <algorithm> #include <algorithm>
#include <time.h> #include <time.h>
#include <math.h>
#include "../../../graphics/AggPlusEnums.h" #include "../../../graphics/AggPlusEnums.h"
#include "../../../graphics/structures.h" #include "../../../graphics/structures.h"
#include <cmath> #include "agg_math.h"
#include "agg_array.h"
#include "agg_trans_affine.h"
#ifndef M_1_PI #ifndef M_1_PI
#define M_1_PI 0.318309886183790671538 #define M_1_PI 0.318309886183790671538
#endif #endif

View File

@ -43,49 +43,49 @@ class IGrObject
protected: protected:
#ifdef __APPLE__ #ifdef __APPLE__
volatile int32_t m_lRef; volatile int32_t m_lRef;
#else #else
ULONG m_lRef; ULONG m_lRef;
#endif #endif
public: public:
IGrObject() IGrObject()
{ {
m_lRef = 1; m_lRef = 1;
} }
virtual ~IGrObject() virtual ~IGrObject()
{ {
} }
#ifdef __APPLE__ #ifdef __APPLE__
virtual ULONG AddRef() virtual ULONG AddRef()
{ {
OSAtomicIncrement32(&m_lRef); OSAtomicIncrement32(&m_lRef);
return (ULONG)m_lRef; return (ULONG)m_lRef;
} }
virtual ULONG Release() virtual ULONG Release()
{ {
int32_t ret = OSAtomicDecrement32(&m_lRef); int32_t ret = OSAtomicDecrement32(&m_lRef);
if (0 == m_lRef) if (0 == m_lRef)
delete this; delete this;
return (ULONG)ret; return (ULONG)ret;
} }
#else #else
virtual ULONG AddRef() virtual ULONG AddRef()
{ {
++m_lRef; ++m_lRef;
return m_lRef; return m_lRef;
} }
virtual ULONG Release() virtual ULONG Release()
{ {
ULONG ret = --m_lRef; ULONG ret = --m_lRef;
if (0 == m_lRef) if (0 == m_lRef)
delete this; delete this;
return ret; return ret;
} }
#endif #endif
}; };

View File

@ -17,12 +17,21 @@ namespace Aggplus
m_internal->Clear(); m_internal->Clear();
} }
Status CAlphaMask::CrateImageBuffer(UINT unWidth, UINT unHeight) StatusAlphaMask CAlphaMask::GetStatus() const
{
return m_internal->GetStatus();
}
AMaskDataType CAlphaMask::GetDataType() const
{
return m_internal->GetDataType();
}
Status CAlphaMask::CreateImageBuffer(UINT unWidth, UINT unHeight)
{ {
return m_internal->Create(unWidth, unHeight, ImageBuffer); return m_internal->Create(unWidth, unHeight, ImageBuffer);
} }
Status CAlphaMask::CrateAlphaBuffer(UINT unWidth, UINT unHeight) Status CAlphaMask::CreateAlphaBuffer(UINT unWidth, UINT unHeight)
{ {
return m_internal->Create(unWidth, unHeight, AlphaBuffer); return m_internal->Create(unWidth, unHeight, AlphaBuffer);
} }

View File

@ -8,17 +8,33 @@
namespace Aggplus namespace Aggplus
{ {
enum StatusAlphaMask
{
EmptyAlphaMask,
GenerationAlphaMask,
ApplyingAlphaMask
};
enum AMaskDataType
{
ImageBuffer,
AlphaBuffer
};
class CAlphaMask_private; class CAlphaMask_private;
class GRAPHICS_DECL CAlphaMask : public IGrObject class GRAPHICS_DECL CAlphaMask : public IGrObject
{ {
public: public:
CAlphaMask(); CAlphaMask();
~CAlphaMask(); virtual ~CAlphaMask();
StatusAlphaMask GetStatus() const;
AMaskDataType GetDataType() const;
void Clear(); void Clear();
Status CrateImageBuffer(UINT unWidth, UINT unHeight); Status CreateImageBuffer(UINT unWidth, UINT unHeight);
Status CrateAlphaBuffer(UINT unWidth, UINT unHeight); Status CreateAlphaBuffer(UINT unWidth, UINT unHeight);
Status LoadFromAlphaBuffer(BYTE* pBuffer, UINT unWidth, UINT unHeight, bool bExternalBuffer = true); Status LoadFromAlphaBuffer(BYTE* pBuffer, UINT unWidth, UINT unHeight, bool bExternalBuffer = true);
Status LoadFromImageBuffer(BYTE* pBuffer, UINT unWidth, UINT unHeight, bool bExternalBuffer = true); Status LoadFromImageBuffer(BYTE* pBuffer, UINT unWidth, UINT unHeight, bool bExternalBuffer = true);

View File

@ -3,7 +3,7 @@
#include <string> #include <string>
#include "aggplustypes.h" #include "aggplustypes.h"
#include "../common/IGrObject.h" #include "./AlphaMask.h"
#include "../agg-2.4/include/agg_alpha_mask_u8.h" #include "../agg-2.4/include/agg_alpha_mask_u8.h"
#include "../agg-2.4/include/agg_renderer_base.h" #include "../agg-2.4/include/agg_renderer_base.h"
@ -13,19 +13,6 @@
namespace Aggplus namespace Aggplus
{ {
enum StatusAlphaMask
{
EmptyAlphaMask,
GenerationAlphaMask,
ApplyingAlphaMask
};
enum AMaskDataType
{
ImageBuffer,
AlphaBuffer
} ;
template <class PixelFormat, class AlphaMask> template <class PixelFormat, class AlphaMask>
struct TAlphaMaskData struct TAlphaMaskData
{ {