public void saveAllLevels(String outputFolder, String baseName, String format) { uint numMips = NumMipmaps; uint width = Width; uint height = Height; for (uint mip = 0; mip < numMips; ++mip) { using (var srcBox = getPixelBox(0, mip)) { using (var blitBitmap = new Image(width, height, 1, Format, 1, 0)) { using (var destBox = blitBitmap.getPixelBox()) { PixelBox.BulkPixelConversion(srcBox, destBox); } String fileName = String.Format("{0}_{1}.{2}", baseName, mip, format); fileName = Path.Combine(outputFolder, fileName); blitBitmap.save(fileName); } width >>= 1; height >>= 1; } } }
/// <summary> /// Copy the given RenderTarget with the specified format. /// </summary> /// <param name="bitmap"></param> /// <param name="renderTarget"></param> /// <param name="format"></param> public static void copyFromRenderTarget(this FreeImageBitmap bitmap, RenderTarget renderTarget, OgrePlugin.PixelFormat format) { using (PixelBox pixelBox = bitmap.createPixelBox(format)) { renderTarget.copyContentsToMemory(pixelBox, RenderTarget.FrameBuffer.FB_AUTO); } bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); }
/// <summary> /// Add an image to this page, will return true if the image was sucessfully added to the page. /// </summary> /// <param name="name"></param> /// <param name="image"></param> /// <returns></returns> internal unsafe bool addImage(String name, FreeImageBitmap image) { ImagePackTreeNode node = rootNode.insert(name, image); if (node != null) { using (PixelBox pixelBox = new PixelBox(0, 0, image.Width, image.Height, OgreDrawingUtility.getOgreFormat(image.PixelFormat), image.GetScanlinePointer(0).ToPointer())) { Rectangle locationRect = node.LocationRect; bufferPtr.Value.blitFromMemory(pixelBox, new IntRect(locationRect.Left, locationRect.Top, locationRect.Right, locationRect.Bottom)); imageInfo.Add(name, node); } return(true); } else { return(false); } }
public static void BulkPixelConversion(PixelBox src, PixelBox dst) { PixelUtil_bulkPixelConversion(src.OgreBox, dst.OgreBox); }
public void blitStagingToMemory(PixelBox dst) { HardwarePixelBuffer_blitStagingToMemory(hardwareBuffer, dst.OgreBox); }
/// <summary> /// Copies a region of this pixelbuffer to normal memory. /// </summary> /// <param name="srcBox"></param> /// <param name="dst"></param> public void blitToMemory(IntRect srcBox, PixelBox dst) { HardwarePixelBuffer_blitToMemory(hardwareBuffer, dst.OgreBox, srcBox.Left, srcBox.Top, srcBox.Right, srcBox.Bottom); }
/// <summary> /// Copies a region of this pixelbuffer to normal memory. /// </summary> /// <param name="dst"></param> public void blitToMemory(PixelBox dst) { HardwarePixelBuffer_blitToMemoryFill(hardwareBuffer, dst.OgreBox); }
/// <summary> /// Copies a region from normal memory to a region of this pixelbuffer. /// </summary> /// <param name="src"></param> public void blitFromMemory(PixelBox src) { HardwarePixelBuffer_blitFromMemoryFill(hardwareBuffer, src.OgreBox); }
/// <summary> /// Copies a region from normal memory to a region of this pixelbuffer. /// </summary> public void blitFromMemory(PixelBox src, IntRect dest) { HardwarePixelBuffer_blitFromMemory(hardwareBuffer, src.OgreBox, dest.Left, dest.Top, dest.Right, dest.Bottom); }
public static void Scale(PixelBox src, PixelBox dst, Filter filter = Filter.FILTER_BILINEAR) { Image_scale(src.OgreBox, dst.OgreBox, filter); }
/// <summary> /// Copies the current contents of the render target to a pixelbox. /// <para> /// See suggestPixelFormat for a tip as to the best pixel format to extract /// into, although you can use whatever format you like and the results will /// be converted. /// </para> /// </summary> /// <param name="dest">The PixelBox to write the results to.</param> /// <param name="buffer">The frame buffer to copy the contents from.</param> public void copyContentsToMemory(PixelBox dest, FrameBuffer buffer) { RenderTarget_copyContentsToMemoryBuffer(renderTarget, dest.OgreBox, buffer); }
/// <summary> /// Copies the current contents of the render target to a pixelbox. /// <para> /// See suggestPixelFormat for a tip as to the best pixel format to extract /// into, although you can use whatever format you like and the results will /// be converted. /// </para> /// </summary> /// <param name="dest">The PixelBox to write the results to.</param> public void copyContentsToMemory(PixelBox dest) { RenderTarget_copyContentsToMemory(renderTarget, dest.OgreBox); }
public void copyContentsToMemory(PixelBox pixelBox, RenderTarget.FrameBuffer buffer) { OgreRenderTarget.copyContentsToMemory(pixelBox, buffer); }