{\r
try\r
{\r
+ var format = Format.A8R8G8B8;\r
+ switch( surface.Description.Format ) // バックバッファ用フォーマットで X を持つのはこれだけ。\r
+ {\r
+ case Format.X4R4G4B4: format = Format.A4R4G4B4; break;\r
+ case Format.X8B8G8R8: format = Format.A8R8G8B8; break;\r
+ case Format.X8R8G8B8: format = Format.A8R8G8B8; break;\r
+ }\r
+\r
this.txBGA = new CTexture( CDTXMania.Instance.Device,\r
size基準.Width,\r
size基準.Height,\r
- surface.Description.Format,\r
+ format,\r
Pool.Default,\r
- Usage.RenderTarget );\r
+ Usage.RenderTarget,\r
+ true );\r
\r
txBGA.vc拡大縮小倍率 = new Vector3(\r
(float) CDTXMania.Instance.Coordinates.Movie.W / size基準.Width,\r
/// <param name="pool">テクスチャの管理方法。</param>\r
/// <exception cref="CTextureCreateFailedException">テクスチャの作成に失敗しました。</exception>\r
public CTexture( Device device, int n幅, int n高さ, Format format, Pool pool )\r
- : this( device, n幅, n高さ, format, pool, Usage.None )\r
+ : this( device, n幅, n高さ, format, pool, Usage.None, false )\r
{\r
}\r
\r
- public CTexture( Device device, int n幅, int n高さ, Format format, Pool pool, Usage usage )\r
+ public CTexture( Device device, int n幅, int n高さ, Format format, Pool pool, Usage usage, bool b黒を透過する )\r
: this()\r
{\r
try\r
this.sz画像サイズ = new Size( n幅, n高さ );\r
this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );\r
this.rc全画像 = new Rectangle( 0, 0, this.sz画像サイズ.Width, this.sz画像サイズ.Height );\r
- \r
- using ( var bitmap = new Bitmap( 1, 1 ) )\r
+ int colorKey = ( b黒を透過する ) ? unchecked((int) 0xFF000000) : 0;\r
+\r
+ using( var bitmap = new Bitmap( 1, 1 ) )\r
{\r
using ( var graphics = Graphics.FromImage( bitmap ) )\r
{\r
pool = poolvar;\r
#endif\r
// 中で更にメモリ読み込みし直していて無駄なので、Streamを使うのは止めたいところ\r
- this.texture = Texture.FromStream( device, stream, n幅, n高さ, 1, usage, format, pool, Filter.Point, Filter.None, 0 );\r
+ this.texture = Texture.FromStream( device, stream, n幅, n高さ, 1, usage, format, pool, Filter.Point, Filter.None, colorKey );\r
}\r
}\r
}\r