mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Merge branch 'master' into get-channel
This commit is contained in:
		
						commit
						04ebc23939
					
				
							
								
								
									
										2
									
								
								_webp.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								_webp.c
									
									
									
									
									
								
							|  | @ -247,7 +247,7 @@ PyObject* WebPDecoderVersion_wrapper(PyObject* self, PyObject* args){ | ||||||
|  * The version of webp that ships with (0.1.3) Ubuntu 12.04 doesn't handle alpha well. |  * The version of webp that ships with (0.1.3) Ubuntu 12.04 doesn't handle alpha well. | ||||||
|  * Files that are valid with 0.3 are reported as being invalid. |  * Files that are valid with 0.3 are reported as being invalid. | ||||||
|  */ |  */ | ||||||
| int WebPDecoderBuggyAlpha() { | int WebPDecoderBuggyAlpha(void) { | ||||||
|     return WebPGetDecoderVersion()==0x0103; |     return WebPGetDecoderVersion()==0x0103; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -30,14 +30,14 @@ ImagingGetBand(Imaging imIn, int band) | ||||||
| 
 | 
 | ||||||
|     /* Check arguments */ |     /* Check arguments */ | ||||||
|     if (!imIn || imIn->type != IMAGING_TYPE_UINT8) |     if (!imIn || imIn->type != IMAGING_TYPE_UINT8) | ||||||
| 	return (Imaging) ImagingError_ModeError(); |         return (Imaging) ImagingError_ModeError(); | ||||||
| 
 | 
 | ||||||
|     if (band < 0 || band >= imIn->bands) |     if (band < 0 || band >= imIn->bands) | ||||||
| 	return (Imaging) ImagingError_ValueError("band index out of range"); |         return (Imaging) ImagingError_ValueError("band index out of range"); | ||||||
| 
 | 
 | ||||||
|     /* Shortcuts */ |     /* Shortcuts */ | ||||||
|     if (imIn->bands == 1) |     if (imIn->bands == 1) | ||||||
| 	return ImagingCopy(imIn); |         return ImagingCopy(imIn); | ||||||
| 
 | 
 | ||||||
|     /* Special case for LXXA etc */ |     /* Special case for LXXA etc */ | ||||||
|     if (imIn->bands == 2 && band == 1) |     if (imIn->bands == 2 && band == 1) | ||||||
|  | @ -45,16 +45,16 @@ ImagingGetBand(Imaging imIn, int band) | ||||||
| 
 | 
 | ||||||
|     imOut = ImagingNew("L", imIn->xsize, imIn->ysize); |     imOut = ImagingNew("L", imIn->xsize, imIn->ysize); | ||||||
|     if (!imOut) |     if (!imOut) | ||||||
| 	return NULL; |         return NULL; | ||||||
| 
 | 
 | ||||||
|     /* Extract band from image */ |     /* Extract band from image */ | ||||||
|     for (y = 0; y < imIn->ysize; y++) { |     for (y = 0; y < imIn->ysize; y++) { | ||||||
| 	UINT8* in = (UINT8*) imIn->image[y] + band; |         UINT8* in = (UINT8*) imIn->image[y] + band; | ||||||
| 	UINT8* out = imOut->image8[y]; |         UINT8* out = imOut->image8[y]; | ||||||
| 	for (x = 0; x < imIn->xsize; x++) { |         for (x = 0; x < imIn->xsize; x++) { | ||||||
| 	    out[x] = *in; |             out[x] = *in; | ||||||
| 	    in += 4; |             in += 4; | ||||||
| 	} |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return imOut; |     return imOut; | ||||||
|  | @ -67,19 +67,19 @@ ImagingPutBand(Imaging imOut, Imaging imIn, int band) | ||||||
| 
 | 
 | ||||||
|     /* Check arguments */ |     /* Check arguments */ | ||||||
|     if (!imIn || imIn->bands != 1 || !imOut) |     if (!imIn || imIn->bands != 1 || !imOut) | ||||||
| 	return (Imaging) ImagingError_ModeError(); |         return (Imaging) ImagingError_ModeError(); | ||||||
| 
 | 
 | ||||||
|     if (band < 0 || band >= imOut->bands) |     if (band < 0 || band >= imOut->bands) | ||||||
| 	return (Imaging) ImagingError_ValueError("band index out of range"); |         return (Imaging) ImagingError_ValueError("band index out of range"); | ||||||
| 
 | 
 | ||||||
|     if (imIn->type  != imOut->type  || |     if (imIn->type  != imOut->type  || | ||||||
| 	imIn->xsize != imOut->xsize || |         imIn->xsize != imOut->xsize || | ||||||
| 	imIn->ysize != imOut->ysize) |         imIn->ysize != imOut->ysize) | ||||||
| 	return (Imaging) ImagingError_Mismatch(); |         return (Imaging) ImagingError_Mismatch(); | ||||||
| 
 | 
 | ||||||
|     /* Shortcuts */ |     /* Shortcuts */ | ||||||
|     if (imOut->bands == 1) |     if (imOut->bands == 1) | ||||||
| 	return ImagingCopy2(imOut, imIn); |         return ImagingCopy2(imOut, imIn); | ||||||
| 
 | 
 | ||||||
|     /* Special case for LXXA etc */ |     /* Special case for LXXA etc */ | ||||||
|     if (imOut->bands == 2 && band == 1) |     if (imOut->bands == 2 && band == 1) | ||||||
|  | @ -87,12 +87,12 @@ ImagingPutBand(Imaging imOut, Imaging imIn, int band) | ||||||
| 
 | 
 | ||||||
|     /* Insert band into image */ |     /* Insert band into image */ | ||||||
|     for (y = 0; y < imIn->ysize; y++) { |     for (y = 0; y < imIn->ysize; y++) { | ||||||
| 	UINT8* in = imIn->image8[y]; |         UINT8* in = imIn->image8[y]; | ||||||
| 	UINT8* out = (UINT8*) imOut->image[y] + band; |         UINT8* out = (UINT8*) imOut->image[y] + band; | ||||||
| 	for (x = 0; x < imIn->xsize; x++) { |         for (x = 0; x < imIn->xsize; x++) { | ||||||
| 	    *out = in[x]; |             *out = in[x]; | ||||||
| 	    out += 4; |             out += 4; | ||||||
| 	} |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return imOut; |     return imOut; | ||||||
|  | @ -105,10 +105,10 @@ ImagingFillBand(Imaging imOut, int band, int color) | ||||||
| 
 | 
 | ||||||
|     /* Check arguments */ |     /* Check arguments */ | ||||||
|     if (!imOut || imOut->type != IMAGING_TYPE_UINT8) |     if (!imOut || imOut->type != IMAGING_TYPE_UINT8) | ||||||
| 	return (Imaging) ImagingError_ModeError(); |         return (Imaging) ImagingError_ModeError(); | ||||||
| 
 | 
 | ||||||
|     if (band < 0 || band >= imOut->bands) |     if (band < 0 || band >= imOut->bands) | ||||||
| 	return (Imaging) ImagingError_ValueError("band index out of range"); |         return (Imaging) ImagingError_ValueError("band index out of range"); | ||||||
| 
 | 
 | ||||||
|     /* Special case for LXXA etc */ |     /* Special case for LXXA etc */ | ||||||
|     if (imOut->bands == 2 && band == 1) |     if (imOut->bands == 2 && band == 1) | ||||||
|  | @ -118,11 +118,11 @@ ImagingFillBand(Imaging imOut, int band, int color) | ||||||
| 
 | 
 | ||||||
|     /* Insert color into image */ |     /* Insert color into image */ | ||||||
|     for (y = 0; y < imOut->ysize; y++) { |     for (y = 0; y < imOut->ysize; y++) { | ||||||
| 	UINT8* out = (UINT8*) imOut->image[y] + band; |         UINT8* out = (UINT8*) imOut->image[y] + band; | ||||||
| 	for (x = 0; x < imOut->xsize; x++) { |         for (x = 0; x < imOut->xsize; x++) { | ||||||
| 	    *out = (UINT8) color; |             *out = (UINT8) color; | ||||||
| 	    out += 4; |             out += 4; | ||||||
| 	} |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return imOut; |     return imOut; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user