示例#1
0
        private static void YbrTripletToArgb(
            byte[] ybrPixelData,
            byte[] argbPixelData,
            int sizeInPixels,
            PhotometricInterpretation photometricInterpretation)
        {
            fixed(byte *pYbrPixelData = ybrPixelData)
            {
                fixed(byte *pArgbPixelData = argbPixelData)
                {
                    int src = 0;
                    int dst = 0;

                    YbrToRgb converter = GetYbrToRgbConverter(photometricInterpretation);

                    for (int i = 0; i < sizeInPixels; i++)
                    {
                        int rgb = converter(
                            pYbrPixelData[src],
                            pYbrPixelData[src + 1],
                            pYbrPixelData[src + 2]);

                        pArgbPixelData[dst]     = Color.FromArgb(rgb).B;
                        pArgbPixelData[dst + 1] = Color.FromArgb(rgb).G;
                        pArgbPixelData[dst + 2] = Color.FromArgb(rgb).R;
                        pArgbPixelData[dst + 3] = 0xff;

                        src += 3;
                        dst += 4;
                    }
                }
            }
        }
示例#2
0
        private static YbrToRgb GetYbrToRgbConverter(PhotometricInterpretation photometricInterpretation)
        {
            YbrToRgb converter;

            if (photometricInterpretation == PhotometricInterpretation.YbrFull)
            {
                converter = new YbrToRgb(YbrFullToRgb);
            }
            else if (photometricInterpretation == PhotometricInterpretation.YbrFull422)
            {
                converter = new YbrToRgb(YbrFull422ToRgb);
            }
            else if (photometricInterpretation == PhotometricInterpretation.YbrIct)
            {
                converter = new YbrToRgb(YbrIctToRgb);
            }
            else if (photometricInterpretation == PhotometricInterpretation.YbrPartial422)
            {
                converter = new YbrToRgb(YbrPartial422ToRgb);
            }
            else
            {
                converter = new YbrToRgb(YbrRctToRgb);
            }

            return(converter);
        }
示例#3
0
		private static YbrToRgb GetYbrToRgbConverter(PhotometricInterpretation photometricInterpretation)
		{
			YbrToRgb converter;

			if (photometricInterpretation == PhotometricInterpretation.YbrFull)
				converter = new YbrToRgb(YbrFullToRgb);
			else if (photometricInterpretation == PhotometricInterpretation.YbrFull422)
				converter = new YbrToRgb(YbrFull422ToRgb);
			else if (photometricInterpretation == PhotometricInterpretation.YbrIct)
				converter = new YbrToRgb(YbrIctToRgb);
			else if (photometricInterpretation == PhotometricInterpretation.YbrPartial422)
				converter = new YbrToRgb(YbrPartial422ToRgb);
			else
				converter = new YbrToRgb(YbrRctToRgb);

			return converter;
		}