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; }
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 override void Read(EndianBinaryReader er) { texImageParam = er.ReadUInt32(); Offset = (texImageParam & 0xFFFF) << 3; S = (UInt16)(8 << (int)((texImageParam & 0x700000) >> 20)); T = (UInt16)(8 << (int)((texImageParam & 0x3800000) >> 23)); Fmt = (Textures.ImageFormat)((texImageParam & 0x1C000000) >> 26); TransparentColor = ((texImageParam >> 29) & 1) == 1; extraParam = er.ReadUInt32(); }
public PixelBasedTexture(EndianBinaryReader er) : base(er) { Height = er.ReadUInt32(); Width = er.ReadUInt32(); GLFormat = er.ReadUInt32(); Type = er.ReadUInt32(); NrLevels = er.ReadUInt32(); TextureObject = er.ReadUInt32(); LocationFlag = er.ReadUInt32(); HWFormat = (Textures.ImageFormat)er.ReadUInt32(); }