Esempio n. 1
0
        PixelInfo[] TranslatePixelInfo(PixelInfo[] srcPixelInfos, Matrix drawMatrix)
        {
            int x = (int)(drawMatrix.M41 + 0.5);
            int y = (int)(drawMatrix.M42 + 0.5);
            PixelInfo.xPixelCoordAtComplexOrigin += x;
            PixelInfo.yPixelCoordAtComplexOrigin += y;
            PixelInfo[] dstPixelInfos = new PixelInfo[srcPixelInfos.Length];

            for (int dstY = 0; dstY < PixelInfo.pixelHeight; dstY++)
            {
                int srcY = dstY - y;
                int srcRow = srcY * PixelInfo.pixelWidth;
                int dstRow = dstY * PixelInfo.pixelWidth;

                for (int dstX = 0; dstX < PixelInfo.pixelWidth; dstX++)
                {
                    int srcX = dstX - x;
                    int dstIndex = dstRow + dstX;

                    if (srcX >= 0 && srcX < PixelInfo.pixelWidth &&
                        srcY >= 0 && srcY < PixelInfo.pixelHeight)
                    {
                        int srcIndex = srcRow + srcX;
                        dstPixelInfos[dstIndex] = pixelInfos[srcIndex];
                    }
                    else
                    {
                        dstPixelInfos[dstIndex] = new PixelInfo(dstIndex, null);
                    }
                }
            }
            return dstPixelInfos;
        }
Esempio n. 2
0
        void InitializePixelInfo(uint[] pixels)
        {
            for (int index = 0; index < pixelInfos.Length; index++)
            {
                pixelInfos[index] = new PixelInfo(index, pixels);
            }

            PixelInfo.hasNewColors = true;
            PixelInfo.firstNewIndex = 0;
            PixelInfo.lastNewIndex = pixelInfos.Length - 1;
        }