示例#1
0
 void Terminate()
 {
     if (psd != null)
     {
         psd.Terminate();
     }
     psd = null;
 }
 public void Terminate()
 {
     if (psd != null)
     {
         psd.Terminate();
     }
     psd = null;
 }
示例#3
0
 public ToolScene()
 {
     psd       = new PSD();
     psdLayers = new List <Layer>();
 }
            public unsafe Layer(PSD.Layer layer)
            {
                this.layer = layer;

                Name = layer.Name;
                Rect = layer.Rect;

                var wi = new System.Drawing.Bitmap(Rect.Width, Rect.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

                fixed (Color* p = layer.Pixels)
                {
                    var acc = wi.LockBits(new System.Drawing.Rectangle(0, 0, wi.Width, wi.Height),
                        System.Drawing.Imaging.ImageLockMode.ReadWrite,
                        System.Drawing.Imaging.PixelFormat.Format32bppArgb);

                    for (int y = 0; y < Rect.Height; y++)
                    {
                        for (int x = 0; x < Rect.Width; x++)
                        {
                            var src = *(p + x + y * Rect.Width);
                            var dst = (Color*)acc.Scan0 + x + y * Rect.Width;

                            var r = src.R;
                            var b = src.B;
                            src.B = r;
                            src.R = b;

                            *dst = src;
                        }
                    }

                    wi.UnlockBits(acc);
                }

                Image = wi;
            }