Exemple #1
0
        public static void Draw(FastBitmap src, FastBitmap dst, Rectangle dstRect)
        {
            int x, y, width, height;

            if (!Drawer2DExt.ClampCoords(dst, dstRect, out x, out y, out width, out height))
            {
                return;
            }

            for (int yy = 0; yy < height; yy++)
            {
                int *srcRow = src.GetRowPtr(yy);
                int *dstRow = dst.GetRowPtr(y + yy);

                for (int xx = 0; xx < width; xx++)
                {
                    dstRow[x + xx] = srcRow[xx];
                }
            }
        }
Exemple #2
0
        public static void DrawTiled(FastBitmap src, FastBitmap dst,
                                     Rectangle srcRect, Rectangle dstRect)
        {
            int srcX = srcRect.X, srcWidth = srcRect.Width, srcHeight = srcRect.Height;
            int x, y, width, height;

            if (!Drawer2DExt.ClampCoords(dst, dstRect, out x, out y, out width, out height))
            {
                return;
            }

            for (int yy = 0; yy < height; yy++)
            {
                // srcY is always 0 so we don't need to add
                int *srcRow = src.GetRowPtr(((yy + y) % srcHeight));
                int *dstRow = dst.GetRowPtr(y + yy);

                for (int xx = 0; xx < width; xx++)
                {
                    dstRow[x + xx] = srcRow[srcX + ((xx + x) % srcWidth)];
                }
            }
        }