/// <summary> /// リソースを処分します /// </summary> protected override void DisposeResource() { if (texture != null) { texture.Dispose(); texture = null; } if (vertices != null) { vertices.Dispose(); vertices = null; } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="device"></param> /// <param name="stream"></param> /// <param name="pa"></param> public ImageResource(PPDDevice device, Stream stream, bool pa) { try { var ii = ImageInformation.FromStream(stream); this.width = ii.Width; this.height = ii.Height; this.halfPixel = new Vector2(0.5f / this.width, 0.5f / this.height); this.texture = (Texture.DX9.Texture)TextureFactoryManager.Factory.FromStream(device, stream, this.width, this.height, pa); CreateVertexBuffer(device); } catch { MessageBox.Show(PPDExceptionContentProvider.Provider.GetContent(PPDExceptionType.ImageReadError)); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="device"></param> /// <param name="filename">ファイルパス</param> /// <param name="pa"></param> public ImageResource(PPDDevice device, string filename, bool pa) { try { this.filename = filename; var ii = ImageInformation.FromFile(filename); this.width = ii.Width; this.height = ii.Height; this.halfPixel = new Vector2(0.5f / this.width, 0.5f / this.height); this.texture = (Texture.DX9.Texture)TextureFactoryManager.Factory.FromFile(device, filename, this.width, this.height, pa); CreateVertexBuffer(device); } catch { MessageBox.Show(PPDExceptionContentProvider.Provider.GetContent(PPDExceptionType.ImageReadError) + System.Environment.NewLine + filename); } }