Example #1
0
        public void DrawImage(Image16 src, Rectangle srcRect, int posX, int posY, bool resizeIfNeeded = false)
        {
            if (resizeIfNeeded)
            {
                int neededWidth  = Math.Max(posX + srcRect.Width, Width);
                int neededHeight = Math.Max(posY + srcRect.Height, Height);

                if (neededWidth > Width || neededHeight > Height)
                {
                    Resize(neededWidth, neededHeight);
                }
            }

            int targetX = Math.Max(posX, 0);
            int lenX    = Math.Min(srcRect.Width, Width - targetX);

            if (lenX > 0)
            {
                for (int y = srcRect.Y; y < srcRect.Height; y++)
                {
                    int targetY = y + posY;
                    if (targetY >= 0 && targetY < Height)
                    {
                        Buffer.BlockCopy(src.data [y], srcRect.X * sizeof(ushort), data [targetY], targetX * sizeof(ushort), lenX * sizeof(ushort));
                    }
                }
                dirty = true;
            }
        }
Example #2
0
 public ImageAssembler(int width, int height, ulong epoch = 0)
 {
     image         = new Image16(width, height);
     posY          = 0;
     segmentHeight = 0;
     this.epoch    = epoch;
 }
Example #3
0
 public void DrawImage(Image16 src, int posX, int posY, bool resizeIfNeeded = false)
 {
     DrawImage(src, new Rectangle(0, 0, src.Width, src.Height), posX, posY, resizeIfNeeded);
 }
Example #4
0
 public void DrawAt(Image16 img, int x, int y, bool resizeIfNeeded = false)
 {
     image.DrawImage(img, x, y, resizeIfNeeded);
 }