AdvancedLauncher.Tools.Imaging.TargaImage.GetPixelFormat C# (CSharp) Метод

GetPixelFormat() приватный Метод

Gets the PixelFormat to be used by the Image based on the Targa file's attributes
private GetPixelFormat ( ) : PixelFormat
Результат PixelFormat
        private PixelFormat GetPixelFormat()
        {
            PixelFormat pfTargaPixelFormat = PixelFormat.Undefined;

            // first off what is our Pixel Depth (bits per pixel)
            switch (this.objTargaHeader.PixelDepth) {
                case 8:
                    pfTargaPixelFormat = PixelFormat.Format8bppIndexed;
                    break;

                case 16:
                    //PixelFormat.Format16bppArgb1555
                    //PixelFormat.Format16bppRgb555
                    if (this.Format == TGAFormat.NEW_TGA) {
                        switch (this.objTargaExtensionArea.AttributesType) {
                            case 0:
                            case 1:
                            case 2: // no alpha data
                                pfTargaPixelFormat = PixelFormat.Format16bppRgb555;
                                break;

                            case 3: // useful alpha data
                                pfTargaPixelFormat = PixelFormat.Format16bppArgb1555;
                                break;
                        }
                    } else {
                        pfTargaPixelFormat = PixelFormat.Format16bppRgb555;
                    }

                    break;

                case 24:
                    pfTargaPixelFormat = PixelFormat.Format24bppRgb;
                    break;

                case 32:
                    //PixelFormat.Format32bppArgb
                    //PixelFormat.Format32bppPArgb
                    //PixelFormat.Format32bppRgb
                    if (this.Format == TGAFormat.NEW_TGA) {
                        switch (this.objTargaExtensionArea.AttributesType) {
                            case 1:
                            case 2: // no alpha data
                                pfTargaPixelFormat = PixelFormat.Format32bppRgb;
                                break;

                            case 0:
                            case 3: // useful alpha data
                                pfTargaPixelFormat = PixelFormat.Format32bppArgb;
                                break;

                            case 4: // premultiplied alpha data
                                pfTargaPixelFormat = PixelFormat.Format32bppPArgb;
                                break;
                        }
                    } else {
                        pfTargaPixelFormat = PixelFormat.Format32bppRgb;
                        break;
                    }

                    break;
            }

            return pfTargaPixelFormat;
        }