Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/FDK17プロジェクト/コード/04.グラフィック/CTexture.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 574 by kairera0467, Fri Apr 26 15:19:46 2019 UTC revision 581 by kairera0467, Sun May 24 05:50:14 2020 UTC
# Line 67  namespace FDK Line 67  namespace FDK
67                  }                  }
68                  public Vector3 vc拡大縮小倍率;                  public Vector3 vc拡大縮小倍率;
69          public string filename;          public string filename;
70            public string label; // DTXMania rev:2033adeeee1e46267cf36b50919c9ecee8804076
71    
72                  // 画面が変わるたび以下のプロパティを設定し治すこと。                  // 画面が変わるたび以下のプロパティを設定し治すこと。
73    
# Line 93  namespace FDK Line 94  namespace FDK
94                          this.fZ軸中心回転 = 0f;                          this.fZ軸中心回転 = 0f;
95                          this.vc拡大縮小倍率 = new Vector3( 1f, 1f, 1f );                          this.vc拡大縮小倍率 = new Vector3( 1f, 1f, 1f );
96              this.filename = ""; // DTXMania rev:693bf14b0d83efc770235c788117190d08a4e531              this.filename = ""; // DTXMania rev:693bf14b0d83efc770235c788117190d08a4e531
97                this.label = ""; // DTXMania rev:2033adeeee1e46267cf36b50919c9ecee8804076
98  //                      this._txData = null;  //                      this._txData = null;
99                  }                  }
100                                    
# Line 107  namespace FDK Line 109  namespace FDK
109                  /// <param name="bitmap">作成元のビットマップ。</param>                  /// <param name="bitmap">作成元のビットマップ。</param>
110                  /// <param name="format">テクスチャのフォーマット。</param>                  /// <param name="format">テクスチャのフォーマット。</param>
111                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>
112                  public CTexture( Device device, Bitmap bitmap, Format format )                  public CTexture( Device device, Bitmap bitmap, Format format, string _label = "" )
113                          : this()                          : this()
114                  {                  {
115                          try                          try
116                          {                          {
117                                  this.Format = format;                                  this.Format = format;
118                    this.label = _label;
119                                  this.sz画像サイズ = new Size( bitmap.Width, bitmap.Height );                                  this.sz画像サイズ = new Size( bitmap.Width, bitmap.Height );
120                                  this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );                                  this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );
121                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );
# Line 146  namespace FDK Line 149  namespace FDK
149                  /// <param name="n高さ">テクスチャの高さ(希望値)。</param>                  /// <param name="n高さ">テクスチャの高さ(希望値)。</param>
150                  /// <param name="format">テクスチャのフォーマット。</param>                  /// <param name="format">テクスチャのフォーマット。</param>
151                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>
152                  public CTexture( Device device, int n幅, int n高さ, Format format )                  public CTexture( Device device, int n幅, int n高さ, Format format, string _label = "" )
153                          : this( device, n幅, n高さ, format, Pool.Managed )                          : this( device, n幅, n高さ, format, Pool.Managed, _label )
154                  {                  {
155                  }                  }
156                                    
# Line 160  namespace FDK Line 163  namespace FDK
163                  /// <param name="format">テクスチャのフォーマット。</param>                  /// <param name="format">テクスチャのフォーマット。</param>
164                  /// <param name="b黒を透過する">画像の黒(0xFFFFFFFF)を透過させるなら true。</param>                  /// <param name="b黒を透過する">画像の黒(0xFFFFFFFF)を透過させるなら true。</param>
165                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>
166                  public CTexture( Device device, string strファイル名, Format format, bool b黒を透過する )                  public CTexture( Device device, string strファイル名, Format format, bool b黒を透過する, string _label = "" )
167                          : this( device, strファイル名, format, b黒を透過する, Pool.Managed )                          : this( device, strファイル名, format, b黒を透過する, Pool.Managed, _label )
168                  {                  {
169                  }                  }
170                  public CTexture( Device device, byte[] txData, Format format, bool b黒を透過する )                  public CTexture( Device device, byte[] txData, Format format, bool b黒を透過する, string _label = "" )
171                          : this( device, txData, format, b黒を透過する, Pool.Managed )                          : this( device, txData, format, b黒を透過する, Pool.Managed, _label )
172                  {                  {
173                  }                  }
174                  public CTexture( Device device, Bitmap bitmap, Format format, bool b黒を透過する )                  public CTexture( Device device, Bitmap bitmap, Format format, bool b黒を透過する, string _label = "" )
175                          : this( device, bitmap, format, b黒を透過する, Pool.Managed )                          : this( device, bitmap, format, b黒を透過する, Pool.Managed, _label )
176                  {                  {
177                  }                  }
178                                    
# Line 187  namespace FDK Line 190  namespace FDK
190                  /// <param name="format">テクスチャのフォーマット。</param>                  /// <param name="format">テクスチャのフォーマット。</param>
191                  /// <param name="pool">テクスチャの管理方法。</param>                  /// <param name="pool">テクスチャの管理方法。</param>
192                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>
193                  public CTexture( Device device, int n幅, int n高さ, Format format, Pool pool )                  public CTexture( Device device, int n幅, int n高さ, Format format, Pool pool, string _label = "" )
194                          : this( device, n幅, n高さ, format, pool, Usage.None )                          : this( device, n幅, n高さ, format, pool, Usage.None, _label )
195                  {                  {
196                  }                  }
197                                    
198                  public CTexture( Device device, int n幅, int n高さ, Format format, Pool pool, Usage usage )                  public CTexture( Device device, int n幅, int n高さ, Format format, Pool pool, Usage usage, string _label = "" )
199                          : this()                          : this()
200                  {                  {
201                          try                          try
202                          {                          {
203                                  this.Format = format;                                  this.Format = format;
204                    this.label = _label;
205                                  this.sz画像サイズ = new Size( n幅, n高さ );                                  this.sz画像サイズ = new Size( n幅, n高さ );
206                                  this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );                                  this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );
207                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );
# Line 241  namespace FDK Line 245  namespace FDK
245                  /// <param name="b黒を透過する">画像の黒(0xFFFFFFFF)を透過させるなら true。</param>                  /// <param name="b黒を透過する">画像の黒(0xFFFFFFFF)を透過させるなら true。</param>
246                  /// <param name="pool">テクスチャの管理方法。</param>                  /// <param name="pool">テクスチャの管理方法。</param>
247                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>                  /// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>
248                  public CTexture( Device device, string strファイル名, Format format, bool b黒を透過する, Pool pool )                  public CTexture( Device device, string strファイル名, Format format, bool b黒を透過する, Pool pool, string _label = "" )
249                          : this()                          : this()
250                  {                  {
251                          MakeTexture( device, strファイル名, format, b黒を透過する, pool );                          MakeTexture( device, strファイル名, format, b黒を透過する, pool, _label );
252                  }                  }
253                  public void MakeTexture( Device device, string strファイル名, Format format, bool b黒を透過する, Pool pool )                  public void MakeTexture( Device device, string strファイル名, Format format, bool b黒を透過する, Pool pool, string _label = "" )
254                  {                  {
255                          if ( !File.Exists( strファイル名 ) )               // #27122 2012.1.13 from: ImageInformation では FileNotFound 例外は返ってこないので、ここで自分でチェックする。わかりやすいログのために。                          if ( !File.Exists( strファイル名 ) )               // #27122 2012.1.13 from: ImageInformation では FileNotFound 例外は返ってこないので、ここで自分でチェックする。わかりやすいログのために。
256                                  throw new FileNotFoundException( string.Format( "ファイルが存在しません。\n[{0}]", strファイル名 ) );                                  throw new FileNotFoundException( string.Format( "ファイルが存在しません。\n[{0}]", strファイル名 ) );
257    
258                          Byte[] _txData = File.ReadAllBytes( strファイル名 );                          Byte[] _txData = File.ReadAllBytes( strファイル名 );
259              this.filename = Path.GetFileName( strファイル名 );              this.filename = Path.GetFileName( strファイル名 );
260                          MakeTexture( device, _txData, format, b黒を透過する, pool );                          MakeTexture( device, _txData, format, b黒を透過する, pool, _label );
261                  }                  }
262    
263                  public CTexture( Device device, byte[] txData, Format format, bool b黒を透過する, Pool pool )                  public CTexture( Device device, byte[] txData, Format format, bool b黒を透過する, Pool pool, string _label = "" )
264                          : this()                          : this()
265                  {                  {
266                          MakeTexture( device, txData, format, b黒を透過する, pool );                          MakeTexture( device, txData, format, b黒を透過する, pool, _label );
267                  }                  }
268                  public void MakeTexture( Device device, byte[] txData, Format format, bool b黒を透過する, Pool pool )                  public void MakeTexture( Device device, byte[] txData, Format format, bool b黒を透過する, Pool pool, string _label = "" )
269                  {                  {
270                          try                          try
271                          {                          {
272                                  var information = ImageInformation.FromMemory( txData );                                  var information = ImageInformation.FromMemory( txData );
273                                  this.Format = format;                                  this.Format = format;
274                    this.label = _label;
275                                  this.sz画像サイズ = new Size( information.Width, information.Height );                                  this.sz画像サイズ = new Size( information.Width, information.Height );
276                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );
277                                  int colorKey = ( b黒を透過する ) ? unchecked( (int) 0xFF000000 ) : 0;                                  int colorKey = ( b黒を透過する ) ? unchecked( (int) 0xFF000000 ) : 0;
# Line 290  namespace FDK Line 295  namespace FDK
295                          }                          }
296                  }                  }
297    
298                  public CTexture( Device device, Bitmap bitmap, Format format, bool b黒を透過する, Pool pool )                  public CTexture( Device device, Bitmap bitmap, Format format, bool b黒を透過する, Pool pool, string _label = "" )
299                          : this()                          : this()
300                  {                  {
301                          MakeTexture( device, bitmap, format, b黒を透過する, pool );                          MakeTexture( device, bitmap, format, b黒を透過する, pool, _label );
302                  }                  }
303                  public void MakeTexture( Device device, Bitmap bitmap, Format format, bool b黒を透過する, Pool pool )                  public void MakeTexture( Device device, Bitmap bitmap, Format format, bool b黒を透過する, Pool pool, string _label = "" )
304                  {                  {
305                          try                          try
306                          {                          {
307                                  this.Format = format;                                  this.Format = format;
308                    this.label = _label;
309                                  this.sz画像サイズ = new Size( bitmap.Width, bitmap.Height );                                  this.sz画像サイズ = new Size( bitmap.Width, bitmap.Height );
310                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );                                  this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );
311                                  int colorKey = ( b黒を透過する ) ? unchecked( (int) 0xFF000000 ) : 0;                                  int colorKey = ( b黒を透過する ) ? unchecked( (int) 0xFF000000 ) : 0;
# Line 777  namespace FDK Line 783  namespace FDK
783                          // CTextureのDispose漏れと見做して警告をログ出力する                          // CTextureのDispose漏れと見做して警告をログ出力する
784                          if (!this.bSlimDXTextureDispose完了済み)                          if (!this.bSlimDXTextureDispose完了済み)
785                          {                          {
786                  Trace.TraceWarning("CTexture: Dispose漏れを検出しました。(Size=({0}, {1}), filename={2})", sz画像サイズ.Width, sz画像サイズ.Height, filename );                  Trace.TraceWarning("CTexture: Dispose漏れを検出しました。(Size=({0}, {1}), filename={2}, label={3})", sz画像サイズ.Width, sz画像サイズ.Height, filename, label );
787                          }                          }
788                          this.Dispose(false);                          this.Dispose(false);
789                  }                  }

Legend:
Removed from v.574  
changed lines
  Added in v.581

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26