public TrueColorTexture(ITextureId id, string name, uint width, uint height, uint[] palette, byte[] pixels) { if (palette == null) { throw new ArgumentNullException(nameof(palette)); } if (pixels == null) { throw new ArgumentNullException(nameof(pixels)); } Id = id; Name = name; IsDirty = true; Width = width; Height = height; _pixelData = new uint[Width * Height]; for (uint j = 0; j < Height; j++) { for (uint i = 0; i < Width; i++) { uint index = j * Width + i; byte palettePixel = pixels[index]; _pixelData[index] = palette[palettePixel]; } } _subImage = new SubImage( Vector2.Zero, new Vector2(Width, Height), new Vector2(Width, Height), 0); }
public DateTimeJsonConverterTest() { _img = new SubImage() { ShotTime = DateTime.Now }; }
private void DisplayImagePaint(object sender, PaintEventArgs e) { if (ImageManager.Instance.image == null) { return; } Graphics g = e.Graphics; Bitmap image = ImageManager.Instance.GetImage(); g.DrawImage(image, 0, 0); for (int i = 0; i < SubImageManager.Instance.subImageList.Count(); i++) { SubImage subImage = SubImageManager.Instance.subImageList[i]; int top = 0, bottom = 0, left = 0, right = 0, width = 0, height = 0; foreach (var property in subImage.properties) { if (property.name == "top") { top = Convert.ToInt32(property.value); } if (property.name == "bottom") { bottom = Convert.ToInt32(property.value); } if (property.name == "left") { left = Convert.ToInt32(property.value); } if (property.name == "right") { right = Convert.ToInt32(property.value); } } width = right - left; height = bottom - top; Rectangle rect = Rectangle.FromLTRB(left, top, right, bottom); Pen pen; if (SubImageManager.Instance.selectedSubIndex == i) { pen = new Pen(Color.Green, 2); } else { pen = new Pen(Color.Red, 1); } g.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); } }
public TrueColorTexture(string name, uint width, uint height, uint[] pixels) { Name = name; IsDirty = true; Width = width; Height = height; ApiUtil.Assert(pixels.Length == width * height); _pixelData = pixels; _subImage = new SubImage( Vector2.Zero, new Vector2(Width, Height), new Vector2(Width, Height), 0); }
public ImageSharpTrueColorTexture(string name, Image <Rgba32> image) { Name = name; ImageSharpTexture imageSharpTexture = new ImageSharpTexture(image, false); _texture = imageSharpTexture; IsDirty = true; _subImage = new SubImage( Vector2.Zero, new Vector2(_texture.Width, _texture.Height), new Vector2(_texture.Width, _texture.Height), 0); }
/// <summary> /// Initializes a new instance of the <see cref="TexImage"/> class. /// </summary> internal TexImage(){ MipmapCount = 1; ArraySize = 1; FaceCount = 1; Depth = 1; Dimension = TextureDimension.Texture2D; Name = ""; SubImageArray = new SubImage[1]; Format = SiliconStudio.Paradox.Graphics.PixelFormat.B8G8R8A8_UNorm; LibraryData = new Dictionary<ITexLibrary, ITextureLibraryData>(); Disposed = false; }
// Main constructor SpriteInstanceData(Vector3 position, Vector2 size, SubImage subImage, SpriteFlags flags) { BuildTransform(position, size, flags, out Matrix4x4 transform); Transform1 = new Vector3(transform.M11, transform.M12, transform.M13); Transform2 = new Vector3(transform.M21, transform.M22, transform.M23); Transform3 = new Vector3(transform.M31, transform.M32, transform.M33); Transform4 = new Vector3(transform.M41, transform.M42, transform.M43); // Assume right column is always 0,0,0,1 TexPosition = subImage.TexOffset; TexSize = subImage.TexSize; TexLayer = subImage.Layer; Flags = flags; }
public void SetCurrentSprite(String key) { if (key == CurrentKey) return; SubImage sprite; if (SpriteSet.TryGetValue(key, out sprite)) { CurrentSprite = sprite; CurrentKey = key; } else { //TODO: Throw exception or something... } }
/// <summary> /// Initializes a new instance of the <see cref="TexImage"/> class. /// </summary> internal TexImage() { MipmapCount = 1; ArraySize = 1; FaceCount = 1; Depth = 1; Dimension = TextureDimension.Texture2D; Name = ""; SubImageArray = new SubImage[1]; Format = SiliconStudio.Paradox.Graphics.PixelFormat.B8G8R8A8_UNorm; LibraryData = new Dictionary <ITexLibrary, ITextureLibraryData>(); Disposed = false; }
void Rebuild(int width, int height, DrawLayer order) { var shadowSubImage = new SubImage(Vector2.Zero, Vector2.Zero, Vector2.One, 0); var window = Resolve <IWindowManager>(); var sm = Resolve <ISpriteManager>(); var factory = Resolve <ICoreFactory>(); { // Check if we need to rebuild var normSize = window.UiToNormRelative(width, height); var pixelSize = window.NormToPixelRelative(normSize); if ((pixelSize - _lastPixelSize).LengthSquared() < float.Epsilon && _sprite?.RenderOrder == order) { return; } _lastPixelSize = pixelSize; } var assets = Resolve <IAssetManager>(); var multi = factory.CreateMultiTexture(AssetId.None, $"Background {width}x{height}", new DummyPaletteManager(assets.LoadPalette(Base.Palette.Inventory))); // Background var background = assets.LoadTexture(Base.CoreSprite.UiBackground); multi.AddTexture(1, background, 0, 0, 0, true, (uint)width, (uint)height); var subImage = multi.GetSubImageDetails(multi.GetSubImageAtTime(1, 0)); var normalisedSize = window.UiToNormRelative(subImage.Size); var key = new SpriteKey(multi, order, SpriteKeyFlags.NoTransform); _sprite?.Dispose(); var lease = sm.Borrow(key, 2, this); var flags = SpriteFlags.None.SetOpacity(0.5f); var instances = lease.Access(); var shadowPosition = new Vector3(window.UiToNormRelative(10, 10), 0); var shadowSize = window.UiToNormRelative(subImage.Size - new Vector2(10, 10)); instances[0] = SpriteInstanceData.TopLeft(shadowPosition, shadowSize, shadowSubImage, flags); // Drop shadow instances[1] = SpriteInstanceData.TopLeft(Vector3.Zero, normalisedSize, subImage, 0); // DialogFrame _sprite = new PositionedSpriteBatch(lease, normalisedSize); }
/// <summary> /// Initializes a new instance of the <see cref="TexImage"/> class. /// </summary> internal TexImage() { MipmapCount = 1; ArraySize = 1; FaceCount = 1; Depth = 1; Dimension = TextureDimension.Texture2D; Name = ""; OriginalAlphaDepth = -1; SubImageArray = new SubImage[1]; Format = PixelFormat.R8G8B8A8_UNorm; LibraryData = new Dictionary <ITexLibrary, ITextureLibraryData>(); Disposed = false; }
public TrueColorTexture(string name, uint width, uint height, uint[] pixels) { if (pixels == null) { throw new ArgumentNullException(nameof(pixels)); } Name = name; IsDirty = true; Width = width; Height = height; ApiUtil.Assert(pixels.Length == width * height); _pixelData = pixels; _subImage = new SubImage( Vector2.Zero, new Vector2(Width, Height), new Vector2(Width, Height), 0); }
public void SetCurrentSprite(String key) { if (key == CurrentKey) { return; } SubImage sprite; if (SpriteSet.TryGetValue(key, out sprite)) { CurrentSprite = sprite; CurrentKey = key; } else { //TODO: Throw exception or something... } }
public ActionResult Edit(MainImage model, HttpPostedFileBase file) { string FileExtension = (file.FileName.Split('.')[1]).ToLower(); List <string> KnowExtensions = new List <string>() { "jpg", "jpeg", "png", "tif" }; if (!KnowExtensions.Any(x => x == FileExtension)) { ModelState.AddModelError("file", "Invalid file format"); } if (ModelState.IsValid) { string filePath = Server.MapPath("~/images/") + model.Customer.Name.ToLower().Replace(" ", "_") + "/" + model.CustomerId + "/sub/"; if (!System.IO.Directory.Exists(filePath)) { System.IO.Directory.CreateDirectory(filePath); } file.SaveAs(filePath + file.FileName); SubImage image = new SubImage() { MainImageId = model.Id, Name = model.Customer.Name.ToLower().Replace(" ", "_") + "/" + model.CustomerId + "/sub/" + file.FileName }; using (var entities = new DB_WebgalleryEntities()) { entities.SubImages.Add(image); entities.SaveChanges(); } return(RedirectToAction("gallery")); } return(View(model)); }
public TrueColorTexture(string name, uint width, uint height, uint[] palette, byte[] pixels) { Name = name; IsDirty = true; Width = width; Height = height; _pixelData = new uint[Width * Height]; for (uint j = 0; j < Height; j++) { for (uint i = 0; i < Width; i++) { uint index = j * Width + i; byte palettePixel = pixels[index]; _pixelData[index] = palette[palettePixel]; } } _subImage = new SubImage( Vector2.Zero, new Vector2(Width, Height), new Vector2(Width, Height), 0); }
public void BuildImageCollection(int tileSize, int offsetX, int offsetY, int subImageIndex) { this.ImageOffset = new Point(offsetX, offsetY); this.TileSize = tileSize; this.allSubImages = new List<SubImage>(); //Bitmap canvas = Program.LoadImage(path); //int imageWidth = canvas.Width; //int imageHeight = canvas.Height; //int croppedWidth = TileSize * ((imageWidth - offsetX) / TileSize); //int croppedHeight = TileSize * ((imageHeight - offsetY) / TileSize); //if (croppedWidth != imageWidth || croppedHeight != imageHeight) //{ // Rectangle rect = new Rectangle(offsetX, offsetY, croppedWidth, croppedHeight); // Bitmap croppedImage = canvas.Clone(rect, PixelFormat.Format24bppRgb); // canvas = croppedImage; //} int imageWidth = CroppedImageSize.Width; int imageHeight = CroppedImageSize.Height; int widthDivisor = 1; int heightDivisor = 1; while (imageWidth / widthDivisor > 256) { widthDivisor *= 2; } while (imageHeight / heightDivisor > 256) { heightDivisor *= 2; } this.subImagesWide = widthDivisor; int subImageWidth = imageWidth / widthDivisor; if (subImageWidth % tileSize != 0) { float tilesWide = subImageWidth / (float)tileSize; subImageWidth = (int)Math.Ceiling(tilesWide) * tileSize; } int subImageHeight = imageHeight / heightDivisor; if (subImageHeight % tileSize != 0) { float tilesHigh = subImageHeight / (float)tileSize; subImageHeight = (int)Math.Ceiling(tilesHigh) * tileSize; } int lastColumn = widthDivisor - 1; int lastRow = heightDivisor - 1; int totalSubImages = widthDivisor * heightDivisor; for (int i = 0; i < totalSubImages; i++) { int width = subImageWidth; if (i % widthDivisor == lastColumn) { width = imageWidth - lastColumn * subImageWidth; } int height = subImageHeight; if (i / widthDivisor == lastRow) { height = imageHeight - lastRow * subImageHeight; } SubImage subImageToAdd = new SubImage(i, width, height); allSubImages.Add(subImageToAdd); } //this.CurrentSubImage = null; this.CurrentSubImageIndex = subImageIndex; Bitmap image = GetImage(); SetSubImageByRefFromImage(ref image, 0); image.Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="TexImage"/> class. /// </summary> internal TexImage(){ MipmapCount = 1; ArraySize = 1; FaceCount = 1; Depth = 1; Dimension = TextureDimension.Texture2D; Name = ""; OriginalAlphaDepth = -1; SubImageArray = new SubImage[1]; Format = PixelFormat.R8G8B8A8_UNorm; LibraryData = new Dictionary<ITexLibrary, ITextureLibraryData>(); Disposed = false; }
/// <summary> /// Initializes a new instance of the <see cref="TexImage"/> class. /// </summary> /// <param name="data">The data.</param> /// <param name="dataSize">Size of the data.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="format">The format.</param> /// <param name="mipmapCount">The mipmap count.</param> /// <param name="arraySize">Size of the array.</param> /// <param name="dimension">The dimension.</param> /// <param name="faceCount">The face count (multiple of 6 if Texture Cube, 1 otherwise).</param> /// <param name="alphaDepth">The depth of the alpha channel</param> public TexImage(IntPtr data, int dataSize, int width, int height, int depth, PixelFormat format, int mipmapCount, int arraySize, TextureDimension dimension, int faceCount = 1, int alphaDepth = -1) { Data = data; DataSize = dataSize; Width = width; Height = height; Depth = depth; Format = format; MipmapCount = mipmapCount; ArraySize = arraySize; Dimension = dimension; FaceCount = faceCount; OriginalAlphaDepth = alphaDepth; Name = ""; int imageCount; if (Dimension == TextureDimension.Texture3D) { int subImagePerArrayElementCount = 0; int curDepth = Depth; for (int i = 0; i < MipmapCount; ++i) { subImagePerArrayElementCount += curDepth; curDepth = curDepth > 1 ? curDepth >>= 1 : curDepth; } imageCount = (int)(ArraySize * FaceCount * subImagePerArrayElementCount); } else { imageCount = (int)(ArraySize * FaceCount * MipmapCount); } SubImageArray = new SubImage[imageCount]; int ct = 0; int rowPitch, slicePitch, curHeight, curWidth; Tools.ComputePitch(Format, Width, Height, out rowPitch, out slicePitch); RowPitch = rowPitch; SlicePitch = slicePitch; for (uint i = 0; i < FaceCount; ++i) { for (uint j = 0; j < ArraySize; ++j) { depth = Depth; for (uint k = 0; k < MipmapCount; ++k) { curWidth = Width; curHeight = Height; Tools.ComputePitch(Format, curWidth, curHeight, out rowPitch, out slicePitch); for (int l = 0; l < depth; ++l) { SubImageArray[ct] = new TexImage.SubImage(); SubImageArray[ct].Width = curWidth; SubImageArray[ct].Height = curHeight; SubImageArray[ct].RowPitch = rowPitch; SubImageArray[ct].SlicePitch = slicePitch; SubImageArray[ct].DataSize = slicePitch; SubImageArray[ct].Data = new IntPtr(Data.ToInt64() + l * slicePitch); ++ct; } depth = depth > 1 ? depth >>= 1 : depth; } } } LibraryData = new Dictionary<ITexLibrary, ITextureLibraryData>(); Disposed = false; }
public static SpriteInstanceData MidLeft(Vector3 position, Vector2 size, SubImage subImage, SpriteFlags flags) => new SpriteInstanceData(position, size, subImage, flags | SpriteFlags.LeftAligned | SpriteFlags.MidAligned);
public static SpriteInstanceData TopMid(Vector3 position, Vector2 size, SubImage subImage, SpriteFlags flags) => new SpriteInstanceData(position, size, subImage, flags);
public static SpriteInstanceData BottomMid(Vector3 position, Vector2 size, SubImage subImage, SpriteFlags flags) => new SpriteInstanceData(position, size, subImage, flags | SpriteFlags.BottomAligned);
void Rebuild(int width, int height, DrawLayer order) { var window = Resolve <IWindowManager>(); var sm = Resolve <ISpriteManager>(); var factory = Resolve <ICoreFactory>(); { // Check if we need to rebuild var normSize = window.UiToNormRelative(width, height); var pixelSize = window.NormToPixelRelative(normSize); if ((pixelSize - _lastPixelSize).LengthSquared() < float.Epsilon && _sprite?.RenderOrder == order) { return; } _lastPixelSize = pixelSize; } var assets = Resolve <IAssetManager>(); var multi = factory.CreateMultiTexture($"DialogFrame {width}x{height}", new DummyPaletteManager(assets.LoadPalette(PaletteId.Inventory))); void DrawLine(uint y) { uint x = TileSize; uint n = 0; while (x < width - TileSize) { var texture = assets.LoadTexture((CoreSpriteId)((int)CoreSpriteId.UiBackgroundLines1 + n % 4)); uint?w = x + 2 * TileSize > width ? (uint)(width - TileSize - x) : (uint?)null; multi.AddTexture(1, texture, x, y, 0, true, w); n++; x += TileSize; } } void DrawVerticalLine(uint x) { uint y = TileSize; uint n = 0; var texture = assets.LoadTexture((CoreSpriteId)((int)CoreSpriteId.UiBackgroundLines1 + n % 4)); texture = CoreUtil.BuildRotatedTexture(factory, (EightBitTexture)texture); while (y < height - TileSize) { uint?h = y + 2 * TileSize > height ? (uint)(height - TileSize - y) : (uint?)null; multi.AddTexture(1, texture, x, y, 0, true, null, h); n++; y += TileSize; } } // Background switch (Background) { case DialogFrameBackgroundStyle.MainMenuPattern: { var background = assets.LoadTexture(CoreSpriteId.UiBackground); multi.AddTexture(1, background, FrameOffsetX, FrameOffsetY, 0, true, (uint)width - FrameOffsetX * 2, (uint)height - FrameOffsetY * 2); break; } case DialogFrameBackgroundStyle.DarkTint: { var colors = Resolve <ICommonColors>(); multi.AddTexture(1, colors.BorderTexture, FrameOffsetX, FrameOffsetY, 0, false, (uint)width - FrameOffsetX * 2, (uint)height - FrameOffsetY * 2, 128); break; } } // Corners multi.AddTexture(1, assets.LoadTexture(CoreSpriteId.UiWindowTopLeft), 0, 0, 0, true); multi.AddTexture(1, assets.LoadTexture(CoreSpriteId.UiWindowTopRight), (uint)width - TileSize, 0, 0, true); multi.AddTexture(1, assets.LoadTexture(CoreSpriteId.UiWindowBottomLeft), 0, (uint)height - TileSize, 0, true); multi.AddTexture(1, assets.LoadTexture(CoreSpriteId.UiWindowBottomRight), (uint)width - TileSize, (uint)height - TileSize, 0, true); DrawLine(4); // Left DrawLine((uint)height - FrameOffsetY); // Right DrawVerticalLine(4); // Top DrawVerticalLine((uint)width - FrameOffsetX); // Bottom var subImage = multi.GetSubImageDetails(multi.GetSubImageAtTime(1, 0)); var normalisedSize = window.UiToNormRelative(subImage.Size); var key = new SpriteKey(multi, order, SpriteKeyFlags.NoTransform); _sprite?.Dispose(); var lease = sm.Borrow(key, 3, this); var flags = SpriteFlags.None.SetOpacity(0.5f); var instances = lease.Access(); var shadowSubImage = new SubImage(Vector2.Zero, Vector2.Zero, Vector2.One, 0); var bottomShadowPosition = new Vector3(window.UiToNormRelative( ShadowX, subImage.Size.Y - ShadowY), 0); var sideShadowPosition = new Vector3(window.UiToNormRelative( subImage.Size.X - ShadowX, ShadowY), 0); var bottomShadowSize = window.UiToNormRelative(subImage.Size.X - ShadowX, ShadowY); var sideShadowSize = window.UiToNormRelative(ShadowX, subImage.Size.Y - ShadowY * 2); instances[0] = SpriteInstanceData.TopLeft(bottomShadowPosition, bottomShadowSize, shadowSubImage, flags); instances[1] = SpriteInstanceData.TopLeft(sideShadowPosition, sideShadowSize, shadowSubImage, flags); instances[2] = SpriteInstanceData.TopLeft(Vector3.Zero, normalisedSize, subImage, 0); _sprite = new PositionedSpriteBatch(lease, normalisedSize); }
public object Process(ICoreFactory factory, AssetId key, object asset) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } if (asset == null) { throw new ArgumentNullException(nameof(asset)); } var sprite = (AlbionSprite)asset; SubImage[] subImages; // TODO: Put exemptions into assets.json if (key.Type == AssetType.Font || key.Type == AssetType.AutomapGraphics || sprite.UniformFrames && sprite.Frames.Count >= 256) { const int buffer = 1; // For things like tilemaps etc we repack into a texture atlas with buffer pixels. int srcTileWidth = sprite.Width; int srcTileHeight = sprite.Height / sprite.Frames.Count; int destTileWidth = srcTileWidth + buffer * 2; int destTileHeight = srcTileHeight + buffer * 2; var(width, height) = GetAtlasSize(destTileWidth, destTileHeight, sprite.Frames.Count); byte[] pixelData = new byte[width * height]; subImages = new SubImage[sprite.Frames.Count]; int curX = 0; int curY = 0; for (int n = 0; n < sprite.Frames.Count; n++) { for (int j = 0; j < destTileHeight; j++) { for (int i = 0; i < destTileWidth; i++) { var sourceX = Math.Clamp(i - buffer, 0, srcTileWidth - buffer); var sourceY = Math.Clamp(j - buffer, 0, srcTileHeight - buffer) + n * srcTileHeight; var destX = curX + i; var destY = curY + j; pixelData[destY * width + destX] = sprite.PixelData[sourceX + sourceY * srcTileWidth]; } } subImages[n] = new SubImage( new Vector2(curX + buffer, curY + buffer), new Vector2(sprite.Frames[n].Width, sprite.Frames[n].Height), new Vector2(width, height), 0); curX += destTileWidth; if (curX + destTileWidth > width) { curX = 0; curY += destTileHeight; } } return(factory.CreateEightBitTexture( key, sprite.Name, (uint)width, (uint)height, 1, 1, pixelData, subImages)); } /* * else if (sprite.UniformFrames) // For reasonably sized uniform sprites use layers to simplify mip mapping / tiling etc * { * int tileWidth = sprite.Width; * int tileHeight = sprite.Height / sprite.Frames.Count; * subImages = sprite.Frames * .Select((x, i) => new EightBitTexture.SubImage(0, 0, x.Width, x.Height, i)) * .ToArray(); * * return new EightBitTexture( * sprite.Name, * (uint)tileWidth, * (uint)tileHeight, * 1, * (uint)subImages.Length, * sprite.PixelData, subImages); * }*/ else // For non-uniforms just use the on-disk packing { subImages = sprite.Frames .Select(x => new SubImage( new Vector2(x.X, x.Y), new Vector2(x.Width, x.Height), new Vector2(sprite.Width, sprite.Height), 0)) .ToArray(); return(factory.CreateEightBitTexture( key, sprite.Name, (uint)sprite.Width, (uint)sprite.Height, 1, 1, sprite.PixelData, subImages)); } }
/// <summary> /// Initializes a new instance of the <see cref="TexImage"/> class. /// </summary> /// <param name="data">The data.</param> /// <param name="dataSize">Size of the data.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="format">The format.</param> /// <param name="mipmapCount">The mipmap count.</param> /// <param name="arraySize">Size of the array.</param> /// <param name="dimension">The dimension.</param> /// <param name="faceCount">The face count (multiple of 6 if Texture Cube, 1 otherwise).</param> /// <param name="alphaDepth">The depth of the alpha channel</param> public TexImage(IntPtr data, int dataSize, int width, int height, int depth, PixelFormat format, int mipmapCount, int arraySize, TextureDimension dimension, int faceCount = 1, int alphaDepth = -1) { Data = data; DataSize = dataSize; Width = width; Height = height; Depth = depth; Format = format; MipmapCount = mipmapCount; ArraySize = arraySize; Dimension = dimension; FaceCount = faceCount; OriginalAlphaDepth = alphaDepth; Name = ""; int imageCount; if (Dimension == TextureDimension.Texture3D) { int subImagePerArrayElementCount = 0; int curDepth = Depth; for (int i = 0; i < MipmapCount; ++i) { subImagePerArrayElementCount += curDepth; curDepth = curDepth > 1 ? curDepth >>= 1 : curDepth; } imageCount = (int)(ArraySize * FaceCount * subImagePerArrayElementCount); } else { imageCount = (int)(ArraySize * FaceCount * MipmapCount); } SubImageArray = new SubImage[imageCount]; int ct = 0; int rowPitch, slicePitch, curHeight, curWidth; Tools.ComputePitch(Format, Width, Height, out rowPitch, out slicePitch); RowPitch = rowPitch; SlicePitch = slicePitch; for (uint i = 0; i < FaceCount; ++i) { for (uint j = 0; j < ArraySize; ++j) { depth = Depth; for (uint k = 0; k < MipmapCount; ++k) { curWidth = Width; curHeight = Height; Tools.ComputePitch(Format, curWidth, curHeight, out rowPitch, out slicePitch); for (int l = 0; l < depth; ++l) { SubImageArray[ct] = new TexImage.SubImage(); SubImageArray[ct].Width = curWidth; SubImageArray[ct].Height = curHeight; SubImageArray[ct].RowPitch = rowPitch; SubImageArray[ct].SlicePitch = slicePitch; SubImageArray[ct].DataSize = slicePitch; SubImageArray[ct].Data = new IntPtr(Data.ToInt64() + l * slicePitch); ++ct; } depth = depth > 1 ? depth >>= 1 : depth; } } } LibraryData = new Dictionary <ITexLibrary, ITextureLibraryData>(); Disposed = false; }