mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 18:07:51 +03:00 
			
		
		
		
	[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
		
							parent
							
								
									4a71709b37
								
							
						
					
					
						commit
						787d899a37
					
				| 
						 | 
					@ -199,9 +199,9 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (im->bands == 1) {
 | 
					    if (im->bands == 1) {
 | 
				
			||||||
        retval = export_named_type(schema,
 | 
					        retval = export_named_type(
 | 
				
			||||||
                                   im->modedata->arrow_band_format,
 | 
					            schema, im->modedata->arrow_band_format, im->modedata->band_names[0]
 | 
				
			||||||
                                   im->modedata->band_names[0]);
 | 
					        );
 | 
				
			||||||
        if (retval != 0) {
 | 
					        if (retval != 0) {
 | 
				
			||||||
            return retval;
 | 
					            return retval;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,112 +9,128 @@
 | 
				
			||||||
const ModeData MODES[] = {
 | 
					const ModeData MODES[] = {
 | 
				
			||||||
    [IMAGING_MODE_UNKNOWN] = {""},
 | 
					    [IMAGING_MODE_UNKNOWN] = {""},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [IMAGING_MODE_1] = {
 | 
					    [IMAGING_MODE_1] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "1",
 | 
					            .name = "1",
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 1,
 | 
					            .pixelsize = 1,
 | 
				
			||||||
            .band_names = {"1"},
 | 
					            .band_names = {"1"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_CMYK] = {
 | 
					    [IMAGING_MODE_CMYK] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "CMYK",
 | 
					            .name = "CMYK",
 | 
				
			||||||
            .bands = 4,
 | 
					            .bands = 4,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"C", "M", "Y", "K"},
 | 
					            .band_names = {"C", "M", "Y", "K"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_F] = {
 | 
					    [IMAGING_MODE_F] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "F",
 | 
					            .name = "F",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "f",
 | 
					            .arrow_band_format = "f",
 | 
				
			||||||
            .band_names = {"F"},
 | 
					            .band_names = {"F"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_HSV] = {
 | 
					    [IMAGING_MODE_HSV] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "HSV",
 | 
					            .name = "HSV",
 | 
				
			||||||
            .bands = 3,
 | 
					            .bands = 3,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"H", "S", "V", "X"},
 | 
					            .band_names = {"H", "S", "V", "X"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_I] = {
 | 
					    [IMAGING_MODE_I] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "I",
 | 
					            .name = "I",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "i",
 | 
					            .arrow_band_format = "i",
 | 
				
			||||||
            .band_names = {"I"},
 | 
					            .band_names = {"I"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_L] = {
 | 
					    [IMAGING_MODE_L] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "L",
 | 
					            .name = "L",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 1,
 | 
					            .pixelsize = 1,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"L"},
 | 
					            .band_names = {"L"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_LA] = {
 | 
					    [IMAGING_MODE_LA] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "LA",
 | 
					            .name = "LA",
 | 
				
			||||||
            .bands = 2,
 | 
					            .bands = 2,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"L", "X", "X", "A"},
 | 
					            .band_names = {"L", "X", "X", "A"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_LAB] = {
 | 
					    [IMAGING_MODE_LAB] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "LAB",
 | 
					            .name = "LAB",
 | 
				
			||||||
            .bands = 3,
 | 
					            .bands = 3,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"L", "a", "b", "X"},
 | 
					            .band_names = {"L", "a", "b", "X"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_La] = {
 | 
					    [IMAGING_MODE_La] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "La",
 | 
					            .name = "La",
 | 
				
			||||||
            .bands = 2,
 | 
					            .bands = 2,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"L", "X", "X", "a"},
 | 
					            .band_names = {"L", "X", "X", "a"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_P] = {
 | 
					    [IMAGING_MODE_P] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "P",
 | 
					            .name = "P",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 1,
 | 
					            .pixelsize = 1,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"P"},
 | 
					            .band_names = {"P"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_PA] = {
 | 
					    [IMAGING_MODE_PA] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "PA",
 | 
					            .name = "PA",
 | 
				
			||||||
            .bands = 2,
 | 
					            .bands = 2,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"P", "X", "X", "A"},
 | 
					            .band_names = {"P", "X", "X", "A"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_RGB] = {
 | 
					    [IMAGING_MODE_RGB] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "RGB",
 | 
					            .name = "RGB",
 | 
				
			||||||
            .bands = 3,
 | 
					            .bands = 3,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"R", "G", "B", "X"},
 | 
					            .band_names = {"R", "G", "B", "X"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_RGBA] = {
 | 
					    [IMAGING_MODE_RGBA] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "RGBA",
 | 
					            .name = "RGBA",
 | 
				
			||||||
            .bands = 4,
 | 
					            .bands = 4,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"R", "G", "B", "A"},
 | 
					            .band_names = {"R", "G", "B", "A"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_RGBX] = {
 | 
					    [IMAGING_MODE_RGBX] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "RGBX",
 | 
					            .name = "RGBX",
 | 
				
			||||||
            .bands = 4,
 | 
					            .bands = 4,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"R", "G", "B", "X"},
 | 
					            .band_names = {"R", "G", "B", "X"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_RGBa] = {
 | 
					    [IMAGING_MODE_RGBa] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "RGBa",
 | 
					            .name = "RGBa",
 | 
				
			||||||
            .bands = 4,
 | 
					            .bands = 4,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
            .arrow_band_format = "C",
 | 
					            .arrow_band_format = "C",
 | 
				
			||||||
            .band_names = {"R", "G", "B", "a"},
 | 
					            .band_names = {"R", "G", "B", "a"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_YCbCr] = {
 | 
					    [IMAGING_MODE_YCbCr] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "YCbCr",
 | 
					            .name = "YCbCr",
 | 
				
			||||||
            .bands = 3,
 | 
					            .bands = 3,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
| 
						 | 
					@ -122,35 +138,40 @@ const ModeData MODES[] = {
 | 
				
			||||||
            .band_names = {"Y", "Cb", "Cr", "X"},
 | 
					            .band_names = {"Y", "Cb", "Cr", "X"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [IMAGING_MODE_I_16] = {
 | 
					    [IMAGING_MODE_I_16] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "I;16",
 | 
					            .name = "I;16",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 2,
 | 
					            .pixelsize = 2,
 | 
				
			||||||
            .arrow_band_format = "s",
 | 
					            .arrow_band_format = "s",
 | 
				
			||||||
            .band_names = {"I"},
 | 
					            .band_names = {"I"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_I_16L] = {
 | 
					    [IMAGING_MODE_I_16L] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "I;16L",
 | 
					            .name = "I;16L",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 2,
 | 
					            .pixelsize = 2,
 | 
				
			||||||
            .arrow_band_format = "s",
 | 
					            .arrow_band_format = "s",
 | 
				
			||||||
            .band_names = {"I"},
 | 
					            .band_names = {"I"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_I_16B] = {
 | 
					    [IMAGING_MODE_I_16B] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "I;16B",
 | 
					            .name = "I;16B",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 2,
 | 
					            .pixelsize = 2,
 | 
				
			||||||
            .arrow_band_format = "s",
 | 
					            .arrow_band_format = "s",
 | 
				
			||||||
            .band_names = {"I"},
 | 
					            .band_names = {"I"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_I_16N] = {
 | 
					    [IMAGING_MODE_I_16N] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "I;16N",
 | 
					            .name = "I;16N",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 2,
 | 
					            .pixelsize = 2,
 | 
				
			||||||
            .arrow_band_format = "s",
 | 
					            .arrow_band_format = "s",
 | 
				
			||||||
            .band_names = {"I"},
 | 
					            .band_names = {"I"},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    [IMAGING_MODE_I_32L] = {
 | 
					    [IMAGING_MODE_I_32L] =
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            .name = "I;32L",
 | 
					            .name = "I;32L",
 | 
				
			||||||
            .bands = 1,
 | 
					            .bands = 1,
 | 
				
			||||||
            .pixelsize = 4,
 | 
					            .pixelsize = 4,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,7 +130,6 @@ ImagingNewPrologueSubtype(const ModeID mode, int xsize, int ysize, int size) {
 | 
				
			||||||
        return (Imaging)ImagingError_ValueError("unrecognized image mode");
 | 
					        return (Imaging)ImagingError_ValueError("unrecognized image mode");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Setup image descriptor */
 | 
					    /* Setup image descriptor */
 | 
				
			||||||
    im->mode = mode;
 | 
					    im->mode = mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user