OSDN Git Service

#36897 [DTXC] MIDIインポート機能の呼び出し口を、ファイルメニュー内にも配置。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d10 / FontDescription10.cpp
1 #include "stdafx.h"\r
2 /*\r
3 * Copyright (c) 2007-2010 SlimDX Group\r
4\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy\r
6 * of this software and associated documentation files (the "Software"), to deal\r
7 * in the Software without restriction, including without limitation the rights\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
9 * copies of the Software, and to permit persons to whom the Software is\r
10 * furnished to do so, subject to the following conditions:\r
11\r
12 * The above copyright notice and this permission notice shall be included in\r
13 * all copies or substantial portions of the Software.\r
14\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
21 * THE SOFTWARE.\r
22 */\r
23 \r
24 #include <d3dx10.h>\r
25 \r
26 #include "FontDescription10.h"\r
27 \r
28 using namespace System;\r
29 \r
30 namespace SlimDX\r
31 {\r
32 namespace Direct3D10\r
33 {       \r
34         FontDescription::FontDescription( const D3DX10_FONT_DESC& native )\r
35         {\r
36                 m_Height = native.Height;\r
37                 m_Width = native.Width;\r
38                 m_Weight = static_cast<FontWeight>( native.Weight );\r
39                 m_MipLevels = native.MipLevels;\r
40                 m_Italic = native.Italic ? true : false;\r
41                 m_CharSet = static_cast<FontCharacterSet>( native.CharSet );\r
42                 m_OutputPrecision = static_cast<FontPrecision>( native.OutputPrecision );\r
43                 m_Quality = static_cast<FontQuality>( native.Quality );\r
44                 m_PitchAndFamily = static_cast<FontPitchAndFamily>( native.PitchAndFamily );\r
45                 m_FaceName = gcnew String( native.FaceName );\r
46         }\r
47         \r
48         /*D3DX10_FONT_DESC FontDescription::CreateNativeVersion()\r
49         {\r
50                 D3DX10_FONT_DESC native;\r
51                 native.Height = m_Height;\r
52                 native.Width = m_Width;\r
53                 native.Weight = static_cast<UINT>( m_Weight );\r
54                 native.MipLevels = m_MipLevels;\r
55                 native.Italic = m_Italic;\r
56                 native.CharSet = static_cast<BYTE>( m_CharSet );\r
57                 native.OutputPrecision = static_cast<BYTE>( m_OutputPrecision );\r
58                 native.Quality = static_cast<BYTE>( m_Quality );\r
59                 native.PitchAndFamily = static_cast<BYTE>( m_PitchAndFamily );\r
60                 \r
61                 for(int index = 0; index < LF_FACESIZE; ++index )\r
62                 {\r
63                         if( index < m_FaceName->Length )\r
64                                 native.FaceName[ index ] = m_FaceName[ index ];\r
65                         else\r
66                                 native.FaceName[ index ] = 0;\r
67                 }\r
68                 \r
69                 return native;\r
70         }*/\r
71 \r
72         int FontDescription::Width::get()\r
73         {\r
74                 return m_Width;\r
75         }\r
76 \r
77         void FontDescription::Width::set( int value )\r
78         {\r
79                 m_Width = value;\r
80         }\r
81         \r
82         int FontDescription::Height::get()\r
83         {\r
84                 return m_Height;\r
85         }\r
86 \r
87         void FontDescription::Height::set( int value )\r
88         {\r
89                 m_Height = value;\r
90         }\r
91         \r
92         FontWeight FontDescription::Weight::get()\r
93         {\r
94                 return m_Weight;\r
95         }\r
96 \r
97         void FontDescription::Weight::set( FontWeight value )\r
98         {\r
99                 m_Weight = value;\r
100         }\r
101         \r
102         int FontDescription::MipLevels::get()\r
103         {\r
104                 return m_MipLevels;\r
105         }\r
106 \r
107         void FontDescription::MipLevels::set( int value )\r
108         {\r
109                 m_MipLevels = value;\r
110         }\r
111         \r
112         bool FontDescription::IsItalic::get()\r
113         {\r
114                 return m_Italic;\r
115         }\r
116 \r
117         void FontDescription::IsItalic::set( bool value )\r
118         {\r
119                 m_Italic = value;\r
120         }\r
121         \r
122         FontCharacterSet FontDescription::CharacterSet::get()\r
123         {\r
124                 return m_CharSet;\r
125         }\r
126 \r
127         void FontDescription::CharacterSet::set( FontCharacterSet value )\r
128         {\r
129                 m_CharSet = value;\r
130         }\r
131         \r
132         FontPrecision FontDescription::Precision::get()\r
133         {\r
134                 return m_OutputPrecision;\r
135         }\r
136 \r
137         void FontDescription::Precision::set( FontPrecision value )\r
138         {\r
139                 m_OutputPrecision = value;\r
140         }\r
141         \r
142         FontQuality FontDescription::Quality::get()\r
143         {\r
144                 return m_Quality;\r
145         }\r
146 \r
147         void FontDescription::Quality::set( FontQuality value )\r
148         {\r
149                 m_Quality = value;\r
150         }\r
151         \r
152         FontPitchAndFamily FontDescription::PitchAndFamily::get()\r
153         {\r
154                 return m_PitchAndFamily;\r
155         }\r
156 \r
157         void FontDescription::PitchAndFamily::set( FontPitchAndFamily value )\r
158         {\r
159                 m_PitchAndFamily = value;\r
160         }\r
161         \r
162         String^ FontDescription::FaceName::get()\r
163         {\r
164                 return m_FaceName;\r
165         }\r
166 \r
167         void FontDescription::FaceName::set( String^ value )\r
168         {\r
169                 m_FaceName = value;\r
170         }\r
171 \r
172         \r
173         bool FontDescription::operator == ( FontDescription left, FontDescription right )\r
174         {\r
175                 return FontDescription::Equals( left, right );\r
176         }\r
177 \r
178         bool FontDescription::operator != ( FontDescription left, FontDescription right )\r
179         {\r
180                 return !FontDescription::Equals( left, right );\r
181         }\r
182 \r
183         int FontDescription::GetHashCode()\r
184         {\r
185                 return m_Height.GetHashCode() + m_Width.GetHashCode() + m_Weight.GetHashCode()\r
186                          + m_MipLevels.GetHashCode() + m_Italic.GetHashCode() + m_CharSet.GetHashCode()\r
187                          + m_OutputPrecision.GetHashCode() + m_Quality.GetHashCode() + m_PitchAndFamily.GetHashCode()\r
188                          + m_FaceName->GetHashCode();\r
189         }\r
190 \r
191         bool FontDescription::Equals( Object^ value )\r
192         {\r
193                 if( value == nullptr )\r
194                         return false;\r
195 \r
196                 if( value->GetType() != GetType() )\r
197                         return false;\r
198 \r
199                 return Equals( safe_cast<FontDescription>( value ) );\r
200         }\r
201 \r
202         bool FontDescription::Equals( FontDescription value )\r
203         {\r
204                 return ( m_Height == value.m_Height && m_Width == value.m_Width && m_Weight == value.m_Weight\r
205                          && m_MipLevels == value.m_MipLevels && m_Italic == value.m_Italic && m_CharSet == value.m_CharSet\r
206                          && m_OutputPrecision == value.m_OutputPrecision && m_Quality == value.m_Quality && m_PitchAndFamily == value.m_PitchAndFamily\r
207                          && m_FaceName == value.m_FaceName );\r
208         }\r
209 \r
210         bool FontDescription::Equals( FontDescription% value1, FontDescription% value2 )\r
211         {\r
212                 return ( value1.m_Height == value2.m_Height && value1.m_Width == value2.m_Width && value1.m_Weight == value2.m_Weight\r
213                          && value1.m_MipLevels == value2.m_MipLevels && value1.m_Italic == value2.m_Italic && value1.m_CharSet == value2.m_CharSet\r
214                          && value1.m_OutputPrecision == value2.m_OutputPrecision && value1.m_Quality == value2.m_Quality && value1.m_PitchAndFamily == value2.m_PitchAndFamily\r
215                          && value1.m_FaceName == value2.m_FaceName );\r
216         }\r
217 }\r
218 }\r