public List <byte[]> GenerateMipList(STCompressionMode CompressionMode, bool multiThread, int SurfaceLevel = 0) { Bitmap Image = BitmapExtension.GetBitmap(DecompressedData[SurfaceLevel], (int)TexWidth, (int)TexHeight); if (GammaFix) { Image = BitmapExtension.AdjustGamma(Image, 2.2f); } List <byte[]> mipmaps = new List <byte[]>(); for (int mipLevel = 0; mipLevel < MipCount; mipLevel++) { int MipWidth = Math.Max(1, (int)TexWidth >> mipLevel); int MipHeight = Math.Max(1, (int)TexHeight >> mipLevel); if (mipLevel != 0) { Image = BitmapExtension.ResizeImage(Image, MipWidth, MipHeight); } mipmaps.Add(STGenericTexture.CompressBlock(BitmapExtension.ImageToByte(Image), Image.Width, Image.Height, TextureData.ConvertFormat(Format), alphaRef, multiThread, CompressionMode)); } Image.Dispose(); return(mipmaps); }
private void UpdateImage() { if (activeImage == null) { return; } newImage = BitmapExtension.ResizeImage( activeImage, (int)widthUD.Value, (int)heightUD.Value, (InterpolationMode)resampleCB.SelectedItem); pictureBoxCustom1.Image = newImage; }
private void UpdateImage() { if (activeImage == null) { return; } IsUpdating = true; int ImageWidth = (int)widthUD.Value; int ImageHeight = (int)heightUD.Value; if (chkKeepAspectRatio.Checked) { ApplyRatio((int)widthUD.Value, (int)heightUD.Value, out ImageWidth, out ImageHeight); } if (ImageHeight <= 0) { ImageHeight = 1; } if (ImageWidth <= 0) { ImageWidth = 1; } widthUD.Value = ImageWidth; heightUD.Value = ImageHeight; newImage = BitmapExtension.ResizeImage( activeImage, ImageWidth, ImageHeight, (InterpolationMode)resampleCB.SelectedItem); pictureBoxCustom1.Image = newImage; IsUpdating = false; }