public ImageTextureCtr(String Name, Bitmap Tex, Textures.ImageFormat Format) : base() { Type = 0x20000011; this.Name = Name; Width = (uint)Tex.Width; Height = (uint)Tex.Height; HWFormat = Format; GLFormat = GLFormats[(int)Format]; GLType = GLTypes[(int)Format]; NrLevels = 1; TextureImage = new PixelBasedImageCtr(Tex, Format); }
private void bitmapFromPngSelect(ref byte[] texturedata, Textures.ImageFormat imageFormat, int fullWidth, int fullHeight, int displayWidth, int displayHeight) { MessageBox.Show("Please choose a " + fullWidth + "x" + fullHeight + " size image, only " + displayWidth + "x" + displayHeight + " will be displayed on the 3ds!"); OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "PNG Files (*.png)|*.png"; DialogResult result = dialog.ShowDialog(); Console.WriteLine(result.ToString() + " " + dialog.FileName.Length); if (result == DialogResult.OK && dialog.FileName.Length > 0) { Bitmap bitmap = new Bitmap(new MemoryStream(File.ReadAllBytes(dialog.FileName))); texturedata = Textures.FromBitmap(bitmap, imageFormat, true); loadImages(); } }
public PixelBasedImageCtr(Bitmap Tex, Textures.ImageFormat Format) { Width = (uint)Tex.Width; Height = (uint)Tex.Height; BitsPerPixel = (uint)Textures.GetBpp(Format); Data = Textures.FromBitmap(Tex, Format); DataSize = (uint)Data.Length; }