mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
commit
bc4d3145e9
|
@ -41,7 +41,7 @@ ImagingHistogramNew(Imaging im)
|
||||||
|
|
||||||
/* Create histogram descriptor */
|
/* Create histogram descriptor */
|
||||||
h = calloc(1, sizeof(struct ImagingHistogramInstance));
|
h = calloc(1, sizeof(struct ImagingHistogramInstance));
|
||||||
strcpy(h->mode, im->mode);
|
strncpy(h->mode, im->mode, IMAGING_MODE_LENGTH);
|
||||||
h->bands = im->bands;
|
h->bands = im->bands;
|
||||||
h->histogram = calloc(im->pixelsize, 256 * sizeof(long));
|
h->histogram = calloc(im->pixelsize, 256 * sizeof(long));
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,12 @@ typedef struct ImagingPaletteInstance* ImagingPalette;
|
||||||
#define IMAGING_TYPE_FLOAT32 2
|
#define IMAGING_TYPE_FLOAT32 2
|
||||||
#define IMAGING_TYPE_SPECIAL 3 /* check mode for details */
|
#define IMAGING_TYPE_SPECIAL 3 /* check mode for details */
|
||||||
|
|
||||||
|
#define IMAGING_MODE_LENGTH 6+1 /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "BGR;xy") */
|
||||||
|
|
||||||
struct ImagingMemoryInstance {
|
struct ImagingMemoryInstance {
|
||||||
|
|
||||||
/* Format */
|
/* Format */
|
||||||
char mode[6+1]; /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "BGR;xy") */
|
char mode[IMAGING_MODE_LENGTH]; /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "BGR;xy") */
|
||||||
int type; /* Data type (IMAGING_TYPE_*) */
|
int type; /* Data type (IMAGING_TYPE_*) */
|
||||||
int depth; /* Depth (ignored in this version) */
|
int depth; /* Depth (ignored in this version) */
|
||||||
int bands; /* Number of bands (1, 2, 3, or 4) */
|
int bands; /* Number of bands (1, 2, 3, or 4) */
|
||||||
|
@ -127,7 +129,7 @@ struct ImagingAccessInstance {
|
||||||
struct ImagingHistogramInstance {
|
struct ImagingHistogramInstance {
|
||||||
|
|
||||||
/* Format */
|
/* Format */
|
||||||
char mode[4+1]; /* Band names (of corresponding source image) */
|
char mode[IMAGING_MODE_LENGTH]; /* Band names (of corresponding source image) */
|
||||||
int bands; /* Number of bands (1, 3, or 4) */
|
int bands; /* Number of bands (1, 3, or 4) */
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
|
@ -139,7 +141,7 @@ struct ImagingHistogramInstance {
|
||||||
struct ImagingPaletteInstance {
|
struct ImagingPaletteInstance {
|
||||||
|
|
||||||
/* Format */
|
/* Format */
|
||||||
char mode[4+1]; /* Band names */
|
char mode[IMAGING_MODE_LENGTH]; /* Band names */
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
UINT8 palette[1024];/* Palette data (same format as image data) */
|
UINT8 palette[1024];/* Palette data (same format as image data) */
|
||||||
|
|
|
@ -37,7 +37,7 @@ ImagingPaletteNew(const char* mode)
|
||||||
if (!palette)
|
if (!palette)
|
||||||
return (ImagingPalette) ImagingError_MemoryError();
|
return (ImagingPalette) ImagingError_MemoryError();
|
||||||
|
|
||||||
strcpy(palette->mode, mode);
|
strncpy(palette->mode, mode, IMAGING_MODE_LENGTH);
|
||||||
|
|
||||||
/* Initialize to ramp */
|
/* Initialize to ramp */
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user