-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCAniShape.cpp
110 lines (82 loc) · 1.94 KB
/
CAniShape.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// CAniShape.cpp
//
// CAniShape class
// Copyright (c) 2011 by Kronosaur Productions, LLC. All Rights Reserved.
#include <windows.h>
#include "Alchemy.h"
#include "DirectXUtil.h"
#include <math.h>
#include <stdio.h>
#include "Reanimator.h"
#define PROP_FILL_TYPE CONSTLIT("fillType")
#define PROP_LINE_TYPE CONSTLIT("lineType")
#define FILL_TYPE_NONE CONSTLIT("none")
#define FILL_TYPE_SOLID CONSTLIT("solid")
#define LINE_TYPE_NONE CONSTLIT("none")
#define LINE_TYPE_SOLID CONSTLIT("solid")
CAniShape::CAniShape (void) :
m_pFill(NULL),
m_pLine(NULL)
// CAniShape constructor
{
}
CAniShape::~CAniShape (void)
// CAniShape destructor
{
if (m_pFill)
delete m_pFill;
if (m_pLine)
delete m_pLine;
}
IAniFillMethod *CAniShape::GetFillMethod (void)
// GetFillMethod
//
// Returns the fill method for the shape based on properties
{
if (m_pFill == NULL)
{
CString sFill = GetPropertyString(PROP_FILL_TYPE);
if (strEquals(sFill, FILL_TYPE_NONE))
SetFillMethod(new CAniNullFill);
else if (strEquals(sFill, FILL_TYPE_SOLID))
SetFillMethod(new CAniSolidFill);
else
SetFillMethod(new CAniSolidFill);
}
return m_pFill;
}
IAniLineMethod *CAniShape::GetLineMethod (void)
// GetLineMethod
//
// Returns the line method for the shape based on properties
{
if (m_pLine == NULL)
{
CString sLine = GetPropertyString(PROP_LINE_TYPE);
if (strEquals(sLine, LINE_TYPE_SOLID))
SetLineMethod(new CAniSolidLine);
else
SetLineMethod(new CAniNullLine);
}
return m_pLine;
}
void CAniShape::SetFillMethod (IAniFillMethod *pFill)
// SetFillMethod
//
// Sets the fill method for the shape
{
if (m_pFill)
delete m_pFill;
m_pFill = pFill;
m_pFill->InitDefaults(m_Properties);
}
void CAniShape::SetLineMethod (IAniLineMethod *pLine)
// SetLineMethod
//
// Sets the line drawing method for the shape
{
if (m_pLine)
delete m_pLine;
m_pLine = pLine;
m_pLine->InitDefaults(m_Properties);
}