Example #1
0
        public unsafe void SetRawData(uint[] rawData)
        {
            if (rawData.Length != _width * _height)
                throw new ArgumentException("rawData size mismatch; should be width*height");

            fixed(uint *srcPtr = &rawData[0])
            TpsGraphWrapper.CopyMemoryCrt(_dataPtr + SizeofSpriteHeader, (uint)srcPtr, _sizeInBytes);
        }
Example #2
0
        public void CopyPixelsTo(uint targetPtr)
        {
            //TpsGraphWrapper.MemCopyMmx(_dataPtr + SizeofSpriteHeader, targetPtr, _sizeInBytesForMmx);
            //TpsGraphWrapper.MemCopy(_dataPtr + SizeofSpriteHeader, targetPtr, _sizeInBytesForMmx);
            TpsGraphWrapper.CopyMemoryCrt(targetPtr, _dataPtr + SizeofSpriteHeader, _sizeInBytes);

            // http://stackoverflow.com/questions/14834108/speed-copy-bitmap-data-into-array-or-work-with-it-directly
            // http://stackoverflow.com/questions/13511661/create-bitmap-from-double-two-dimentional-array
            // http://stackoverflow.com/questions/8104461/pixelformat-format32bppargb-seems-to-have-wrong-byte-order
            // http://code.google.com/p/renderterrain/source/browse/trunk/Utilities/FastBitmap.cs?r=18
            // Yeah! http://msdn.microsoft.com/en-us/library/system.windows.interop.imaging.createbitmapsourcefrommemorysection.aspx
        }