Lines 18-24
Link Here
|
18 |
% M M A A P % |
18 |
% M M A A P % |
19 |
% % |
19 |
% % |
20 |
% % |
20 |
% % |
21 |
% Read/Write Image Colormaps As An Image File % |
21 |
% Read/Write Image Colormaps And Image File % |
22 |
% % |
22 |
% % |
23 |
% % |
23 |
% % |
24 |
% Software Design % |
24 |
% Software Design % |
Lines 349-364
Link Here
|
349 |
/* |
349 |
/* |
350 |
Allocate colormap. |
350 |
Allocate colormap. |
351 |
*/ |
351 |
*/ |
352 |
if (!IsPaletteImage(image,&image->exception)) |
352 |
if (SetImageType(image,PaletteType) == MagickFail) |
353 |
(void) SetImageType(image,PaletteType); |
353 |
ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image); |
354 |
packet_size=image->depth > 8 ? 2 : 1; |
354 |
packet_size=image->depth > 8 ? 2 : 1; |
355 |
pixels=MagickAllocateMemory(unsigned char *,image->columns*packet_size); |
355 |
pixels=MagickAllocateArray(unsigned char *,image->columns,packet_size); |
356 |
if (pixels == (unsigned char *) NULL) |
356 |
if (pixels == (unsigned char *) NULL) |
357 |
ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image); |
357 |
ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image); |
358 |
packet_size=image->colors > 256 ? 6 : 3; |
358 |
packet_size=image->colors > 256 ? 6 : 3; |
359 |
colormap=MagickAllocateMemory(unsigned char *,packet_size*image->colors); |
359 |
colormap=MagickAllocateArray(unsigned char *,packet_size,image->colors); |
360 |
if (colormap == (unsigned char *) NULL) |
360 |
if (colormap == (unsigned char *) NULL) |
361 |
ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image); |
361 |
ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image); |
|
|
362 |
|
362 |
/* |
363 |
/* |
363 |
Write colormap to file. |
364 |
Write colormap to file. |
364 |
*/ |
365 |
*/ |