CreateStream() public abstract method

Creates a stream for accessing the surface data.
The returned stream can be used for reading the surface data, and, for some surface formats, to modify the surface data.
public abstract CreateStream ( ) : Stream
return Stream
示例#1
0
        private Bitmap SurfaceToBitmap(Surface surface)
        {
            if (surface is JpegSurface)
            {
                var bitmap = new Bitmap(surface.CreateStream());

                SwapRedAndBlueChannels(bitmap);

                return bitmap;
            }
            else
            {
                var bitmap = new Bitmap(surface.Width, surface.Height, PixelFormat.Format32bppArgb);

                try
                {
                    var bitmapData = bitmap.LockBits(new Rectangle(0, 0, surface.Width, surface.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);

                    surface.CopyToArgb(new SurfaceData(bitmapData.Width, bitmapData.Height, bitmapData.Scan0, bitmapData.Stride));

                    bitmap.UnlockBits(bitmapData);

                    return bitmap;
                }
                catch { bitmap.Dispose(); throw; }
            }
        }
示例#2
0
 public sealed override Stream CreateStream()
 {
     return(@this.CreateStream());
 }