/// <summary> /// Unloads data that is no longer needed. /// </summary> protected override void UnloadHighLevelImpl() { if (microcode != null) { microcode.Close(); microcode = null; } if (constantTable != null) { constantTable.Dispose(); constantTable = null; } }
private Bitmap getImage(string fileName) { Microsoft.DirectX.GraphicsStream gs = null; Microsoft.DirectX.Direct3D.Texture tx = null; try { this.invertAlpha.Enabled = false; System.IO.MemoryStream mSr = getMemStream(fileName); mSr.Seek(0, 0); tx = TextureLoader.FromStream(device, mSr); mSr.Seek(0, 0); ImageInformation imInfo = TextureLoader.ImageInformationFromStream(mSr); mSr.Close(); fillTxtBx(imInfo); gs = TextureLoader.SaveToStream(ImageFileFormat.Dib, tx); Bitmap btmap = new Bitmap(gs); if (hasAlpha) { aChk.Enabled = true; invertAlpha.Enabled = true; fixBitmapAlpha(gs, btmap, imInfo); } return(btmap); } catch (Exception e) { if (gs != null) { gs.Close(); gs.Dispose(); } if (tx != null) { tx.Dispose(); } if (pp != null) { pp = null; pp = new PresentParameters(); pp.Windowed = true; pp.SwapEffect = SwapEffect.Copy; } if (device != null) { device.Dispose(); device = null; device = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, pp); } return(null); } }