public sFrameSizeEnum frameSizeFirst(ePixelFormat pixelFormat) { sFrameSizeEnum fse = new sFrameSizeEnum(); fse.pixelFormat = pixelFormat; file.call(eControlCode.ENUM_FRAMESIZES, ref fse); return(fse); }
internal sImageFormat(ref sImageFormatDescription src) { bufferType = src.type; index = src.index; description = src.description; pixelFormat = src.pixelFormat; flags = src.flags; }
/// <summary> /// Initializes a new instance of the <see cref="ATextureRenderData" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public ATextureRenderData(NiFile file, BinaryReader reader) : base(file, reader) { this.PixelFormat = (ePixelFormat)reader.ReadUInt32(); if (base.Version <= eNifVersion.VER_10_2_0_0) { this.RedMask = reader.ReadUInt32(); this.GreenMask = reader.ReadUInt32(); this.BlueMask = reader.ReadUInt32(); this.AlphaMask = reader.ReadUInt32(); this.BitsPerPixel = reader.ReadByte(); this.Unkown3Bytes = new byte[3]; for (int i = 0; i < this.Unkown3Bytes.Length; i++) { this.Unkown3Bytes[i] = reader.ReadByte(); } this.Unkown8Bytes = new byte[8]; for (int j = 0; j < this.Unkown8Bytes.Length; j++) { this.Unkown8Bytes[j] = reader.ReadByte(); } } if (base.Version >= eNifVersion.VER_10_0_1_0 && base.Version <= eNifVersion.VER_10_2_0_0) { this.UnkownInt = reader.ReadUInt32(); } if (base.Version >= eNifVersion.VER_20_0_0_4) { this.BitsPerPixel = reader.ReadByte(); this.UnkownInt2 = reader.ReadUInt32(); this.UnkownInt3 = reader.ReadUInt32(); this.Flags = reader.ReadByte(); this.UnkownInt4 = reader.ReadUInt32(); } if (base.Version >= eNifVersion.VER_20_3_0_6) { this.UnkownByte1 = reader.ReadByte(); } if (base.Version >= eNifVersion.VER_20_0_0_4) { this.ChannelData = new ChannelData[4]; for (int k = 0; k < 4; k++) { this.ChannelData[k] = new ChannelData(file, reader); } } this.Palette = new NiRef <NiPalette>(reader); this.NumMipMaps = reader.ReadUInt32(); this.BytesPerPixel = reader.ReadUInt32(); this.MipMaps = new MipMap[this.NumMipMaps]; int num = 0; while ((long)num < (long)((ulong)this.NumMipMaps)) { this.MipMaps[num] = new MipMap(file, reader); num++; } }
public IEnumerable <sFrameSizeEnum> frameSizeEnum(ePixelFormat pixelFormat) { sFrameSizeEnum fse = new sFrameSizeEnum(); fse.pixelFormat = pixelFormat; for (int i = 0; true; i++) { fse.index = i; if (!file.enumerate(eControlCode.ENUM_FRAMESIZES, ref fse)) { yield break; } yield return(fse); } }
public static SizeSupported query(VideoDevice device, ePixelFormat pixelFormat) { sFrameSizeEnum fse = device.frameSizeFirst(pixelFormat); switch (fse.type) { case eFrameSizeType.Discrete: break; case eFrameSizeType.Continuous: case eFrameSizeType.Stepwise: return(new ContinuousSizes(ref fse)); default: throw new ApplicationException(); } return(new DiscreteSizes(device.frameSizeEnum(pixelFormat))); }
/// <summary> /// Gets the directX pixelformat for the specified pixelformat /// </summary> /// <param name="e">ePixelFormat</param> /// <returns>DirectX PixelFormat</returns> public static PixelFormat GetPixelFormat(ePixelFormat e) { PixelFormat pixelFormat = new PixelFormat(); switch (e) { case ePixelFormat.RGB32: pixelFormat.Rgb = true; pixelFormat.RgbBitCount = 32; pixelFormat.RBitMask = 0xFF0000; pixelFormat.GBitMask = 0x00FF00; pixelFormat.BBitMask = 0x0000FF; break; case ePixelFormat.YUY2: pixelFormat.FourCC = 0x32595559; pixelFormat.FourCcIsValid = true; break; } return pixelFormat; }
/// <summary> /// Initializes a new instance of the <see cref="ATextureRenderData" /> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public ATextureRenderData(NiFile file, BinaryReader reader) : base(file, reader) { this.PixelFormat = (ePixelFormat)reader.ReadUInt32(); if (base.Version <= eNifVersion.VER_10_2_0_0) { this.RedMask = reader.ReadUInt32(); this.GreenMask = reader.ReadUInt32(); this.BlueMask = reader.ReadUInt32(); this.AlphaMask = reader.ReadUInt32(); this.BitsPerPixel = reader.ReadByte(); this.Unkown3Bytes = new byte[3]; for (int i = 0; i < this.Unkown3Bytes.Length; i++) { this.Unkown3Bytes[i] = reader.ReadByte(); } this.Unkown8Bytes = new byte[8]; for (int j = 0; j < this.Unkown8Bytes.Length; j++) { this.Unkown8Bytes[j] = reader.ReadByte(); } } if (base.Version >= eNifVersion.VER_10_0_1_0 && base.Version <= eNifVersion.VER_10_2_0_0) { this.UnkownInt = reader.ReadUInt32(); } if (base.Version >= eNifVersion.VER_20_0_0_4) { this.BitsPerPixel = reader.ReadByte(); this.UnkownInt2 = reader.ReadUInt32(); this.UnkownInt3 = reader.ReadUInt32(); this.Flags = reader.ReadByte(); this.UnkownInt4 = reader.ReadUInt32(); } if (base.Version >= eNifVersion.VER_20_3_0_6) { this.UnkownByte1 = reader.ReadByte(); } if (base.Version >= eNifVersion.VER_20_0_0_4) { this.ChannelData = new ChannelData[4]; for (int k = 0; k < 4; k++) { this.ChannelData[k] = new ChannelData(file, reader); } } this.Palette = new NiRef<NiPalette>(reader); this.NumMipMaps = reader.ReadUInt32(); this.BytesPerPixel = reader.ReadUInt32(); this.MipMaps = new MipMap[this.NumMipMaps]; int num = 0; while ((long)num < (long)((ulong)this.NumMipMaps)) { this.MipMaps[num] = new MipMap(file, reader); num++; } }
public ATextureRenderData(NiFile file, BinaryReader reader) : base(file, reader) { PixelFormat = (ePixelFormat)reader.ReadUInt32(); if (Version <= eNifVersion.VER_10_2_0_0) { RedMask = reader.ReadUInt32(); GreenMask = reader.ReadUInt32(); BlueMask = reader.ReadUInt32(); AlphaMask = reader.ReadUInt32(); BitsPerPixel = reader.ReadByte(); Unkown3Bytes = new byte[3]; for (var i = 0; i < Unkown3Bytes.Length; i++) { Unkown3Bytes[i] = reader.ReadByte(); } Unkown8Bytes = new byte[8]; for (var i = 0; i < Unkown8Bytes.Length; i++) { Unkown8Bytes[i] = reader.ReadByte(); } } if (Version >= eNifVersion.VER_10_0_1_0 && Version <= eNifVersion.VER_10_2_0_0) { UnkownInt = reader.ReadUInt32(); } if (Version >= eNifVersion.VER_20_0_0_4) { BitsPerPixel = reader.ReadByte(); UnkownInt2 = reader.ReadUInt32(); UnkownInt3 = reader.ReadUInt32(); Flags = reader.ReadByte(); UnkownInt4 = reader.ReadUInt32(); } if (Version >= eNifVersion.VER_20_3_0_6) { UnkownByte1 = reader.ReadByte(); } if (Version >= eNifVersion.VER_20_0_0_4) { ChannelData = new ChannelData[4]; for (var i = 0; i < 4; i++) { ChannelData[i] = new ChannelData(file, reader); } } Palette = new NiRef <NiPalette>(reader); NumMipMaps = reader.ReadUInt32(); BytesPerPixel = reader.ReadUInt32(); MipMaps = new MipMap[NumMipMaps]; for (var i = 0; i < NumMipMaps; i++) { MipMaps[i] = new MipMap(file, reader); } }