コード例 #1
0
        private unsafe void CopyToArgbAlpha8(SurfaceData surfaceData)
        {
            fixed(byte *dataPointer = data)
            fixed(ArgbColor * palettePointer = palette)
            {
                byte *destinationRowPointer = (byte *)surfaceData.DataPointer;
                byte *sourceColorPointer    = dataPointer;
                byte *sourceAlphaPointer    = dataPointer + Width * Height;

                for (int i = Height; i-- != 0; destinationRowPointer += surfaceData.Stride)
                {
                    ArgbColor *destinationPointer = (ArgbColor *)destinationRowPointer;

                    for (int j = Width; j-- != 0;)
                    {
                        ArgbColor.CopyWithAlpha(destinationPointer++, palettePointer + *sourceColorPointer++, *sourceAlphaPointer++);
                    }
                }
            }
        }
コード例 #2
0
        private unsafe void CopyToArgbTransparent(SurfaceData surfaceData)
        {
            int rowLength = Width;

            fixed(byte *dataPointer = data)
            fixed(ArgbColor * palettePointer = palette)
            {
                byte *destinationRowPointer = (byte *)surfaceData.DataPointer;
                byte *sourcePointer         = dataPointer;

                for (int i = Height; i-- != 0; destinationRowPointer += surfaceData.Stride)
                {
                    ArgbColor *destinationPointer = (ArgbColor *)destinationRowPointer;

                    for (int j = Width; j-- != 0;)
                    {
                        *destinationPointer++ = palettePointer[*sourcePointer++];
                    }
                }
            }
        }
コード例 #3
0
        protected unsafe override void CopyToArgbInternal(SurfaceData surfaceData)
        {
            switch (AlphaBitCount)
            {
            case 0: CopyToArgbOpaque(surfaceData); break;

            case 1: CopyToArgbAlpha1(surfaceData); break;

            case 4: CopyToArgbAlpha4(surfaceData); break;

            case 8: if (separateAlpha)
                {
                    CopyToArgbAlpha8(surfaceData);
                }
                else
                {
                    CopyToArgbTransparent(surfaceData);
                } break;

            default: throw new NotSupportedException();                     // Should never happen…
            }
        }
コード例 #4
0
 protected override void CopyToArgbInternal(SurfaceData surfaceData)
 {
     throw new NotSupportedException();
 }