本文整理汇总了C++中GetPixelRed函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPixelRed函数的具体用法?C++ GetPixelRed怎么用?C++ GetPixelRed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPixelRed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sanpera_magick_pixel_to_doubles
// Same story for MagickPixelPacket, which is different in ways beyond my
// understanding
void sanpera_magick_pixel_to_doubles(MagickPixelPacket *pixel, double out[4]) {
out[0] = (double)(GetPixelRed(pixel)) / QuantumRange;
out[1] = (double)(GetPixelGreen(pixel)) / QuantumRange;
out[2] = (double)(GetPixelBlue(pixel)) / QuantumRange;
// Distinct from "opacity", which treats 0 as opaque
out[3] = (double)(GetPixelAlpha(pixel)) / QuantumRange;
}
开发者ID:harvimt,项目名称:sanpera,代码行数:9,代码来源:_api.c
示例2: load_tile_rle
static MagickBooleanType load_tile_rle(Image *image,Image *tile_image,
XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length)
{
ExceptionInfo
*exception;
MagickOffsetType
size;
register PixelPacket
*q;
size_t
length;
ssize_t
bytes_per_pixel,
count,
i,
j;
unsigned char
data,
pixel,
*xcfdata,
*xcfodata,
*xcfdatalimit;
bytes_per_pixel=(ssize_t) inDocInfo->bytes_per_pixel;
xcfdata=(unsigned char *) AcquireQuantumMemory(data_length,sizeof(*xcfdata));
if (xcfdata == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
xcfodata=xcfdata;
count=ReadBlob(image, (size_t) data_length, xcfdata);
xcfdatalimit = xcfodata+count-1;
exception=(&image->exception);
for (i=0; i < (ssize_t) bytes_per_pixel; i++)
{
q=GetAuthenticPixels(tile_image,0,0,tile_image->columns,tile_image->rows,
exception);
size=(MagickOffsetType) tile_image->rows*tile_image->columns;
while (size > 0)
{
if (xcfdata > xcfdatalimit)
goto bogus_rle;
pixel=(*xcfdata++);
length=(size_t) pixel;
if (length >= 128)
{
length=255-(length-1);
if (length == 128)
{
if (xcfdata >= xcfdatalimit)
goto bogus_rle;
length=(size_t) ((*xcfdata << 8) + xcfdata[1]);
xcfdata+=2;
}
size-=length;
if (size < 0)
goto bogus_rle;
if (&xcfdata[length-1] > xcfdatalimit)
goto bogus_rle;
while (length-- > 0)
{
data=(*xcfdata++);
switch (i)
{
case 0:
{
SetPixelRed(q,ScaleCharToQuantum(data));
if (inDocInfo->image_type != GIMP_GRAY)
{
SetPixelGreen(q,ScaleCharToQuantum(data));
SetPixelBlue(q,ScaleCharToQuantum(data));
SetPixelAlpha(q,ScaleCharToQuantum(
(unsigned char) inLayerInfo->opacity));
}
else
{
SetPixelGreen(q,GetPixelRed(q));
SetPixelBlue(q,GetPixelRed(q));
SetPixelAlpha(q,ScaleCharToQuantum(
(unsigned char) inLayerInfo->opacity));
}
break;
}
case 1:
{
SetPixelGreen(q,ScaleCharToQuantum(data));
break;
}
case 2:
{
SetPixelBlue(q,ScaleCharToQuantum(data));
break;
}
case 3:
{
SetPixelAlpha(q,data == 0 ? OpaqueOpacity :
//.........这里部分代码省略.........
开发者ID:evandespault,项目名称:PlanPlus-Charts-Demo,代码行数:101,代码来源:xcf.c
示例3: SeparateImageChannel
MagickExport MagickBooleanType SeparateImageChannel(Image *image,
const ChannelType channel)
{
#define SeparateImageTag "Separate/Image"
CacheView
*image_view;
ExceptionInfo
*exception;
MagickBooleanType
status;
MagickOffsetType
progress;
ssize_t
y;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
if (channel == GrayChannels)
image->matte=MagickTrue;
/*
Separate image channels.
*/
status=MagickTrue;
progress=0;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
register PixelPacket
*restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
switch (channel)
{
case RedChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelGreen(q,GetPixelRed(q));
SetPixelBlue(q,GetPixelRed(q));
q++;
}
break;
}
case GreenChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelGreen(q));
SetPixelBlue(q,GetPixelGreen(q));
q++;
}
break;
}
case BlueChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelBlue(q));
SetPixelGreen(q,GetPixelBlue(q));
q++;
}
break;
}
case OpacityChannel:
{
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelOpacity(q));
SetPixelGreen(q,GetPixelOpacity(q));
SetPixelBlue(q,GetPixelOpacity(q));
q++;
}
//.........这里部分代码省略.........
开发者ID:abzolute0,项目名称:Ruby_Blog,代码行数:101,代码来源:channel.c
示例4: CropImageToHBITMAP
//.........这里部分代码省略.........
*q;
RGBQUAD
*bitmap_bits;
ssize_t
y;
/*
Check crop geometry.
*/
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(geometry != (const RectangleInfo *) NULL);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
if (((geometry->x+(ssize_t) geometry->width) < 0) ||
((geometry->y+(ssize_t) geometry->height) < 0) ||
(geometry->x >= (ssize_t) image->columns) ||
(geometry->y >= (ssize_t) image->rows))
ThrowImageException(OptionError,"GeometryDoesNotContainImage");
page=(*geometry);
if ((page.x+(ssize_t) page.width) > (ssize_t) image->columns)
page.width=image->columns-page.x;
if ((page.y+(ssize_t) page.height) > (ssize_t) image->rows)
page.height=image->rows-page.y;
if (page.x < 0)
{
page.width+=page.x;
page.x=0;
}
if (page.y < 0)
{
page.height+=page.y;
page.y=0;
}
if ((page.width == 0) || (page.height == 0))
ThrowImageException(OptionError,"GeometryDimensionsAreZero");
/*
Initialize crop image attributes.
*/
bitmap.bmType = 0;
bitmap.bmWidth = (LONG) page.width;
bitmap.bmHeight = (LONG) page.height;
bitmap.bmWidthBytes = bitmap.bmWidth * 4;
bitmap.bmPlanes = 1;
bitmap.bmBitsPixel = 32;
bitmap.bmBits = NULL;
bitmap_bitsH=(HANDLE) GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,page.width*
page.height*bitmap.bmBitsPixel);
if (bitmap_bitsH == NULL)
return(NULL);
bitmap_bits=(RGBQUAD *) GlobalLock((HGLOBAL) bitmap_bitsH);
if ( bitmap.bmBits == NULL )
bitmap.bmBits = bitmap_bits;
if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
SetImageColorspace(image,sRGBColorspace);
/*
Extract crop image.
*/
q=bitmap_bits;
for (y=0; y < (ssize_t) page.height; y++)
{
register ssize_t
x;
p=GetVirtualPixels(image,page.x,page.y+y,page.width,1,exception);
if (p == (const PixelPacket *) NULL)
break;
/* Transfer pixels, scaling to Quantum */
for( x=(ssize_t) page.width ; x> 0 ; x-- )
{
q->rgbRed = ScaleQuantumToChar(GetPixelRed(p));
q->rgbGreen = ScaleQuantumToChar(GetPixelGreen(p));
q->rgbBlue = ScaleQuantumToChar(GetPixelBlue(p));
q->rgbReserved = 0;
p++;
q++;
}
proceed=SetImageProgress(image,CropImageTag,y,page.height);
if (proceed == MagickFalse)
break;
}
if (y < (ssize_t) page.height)
{
GlobalUnlock((HGLOBAL) bitmap_bitsH);
GlobalFree((HGLOBAL) bitmap_bitsH);
return((void *) NULL);
}
bitmap.bmBits=bitmap_bits;
bitmapH=CreateBitmapIndirect(&bitmap);
GlobalUnlock((HGLOBAL) bitmap_bitsH);
GlobalFree((HGLOBAL) bitmap_bitsH);
return((void *) bitmapH);
}
开发者ID:CamiloBenavides,项目名称:SnoutPoint-Web,代码行数:101,代码来源:nt-feature.c
示例5: ReadVIFFImage
//.........这里部分代码省略.........
break;
}
}
}
else if (image->storage_class == PseudoClass)
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelIndex(image,*p++,q);
q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
else
{
/*
Convert DirectColor scanline.
*/
number_pixels=(MagickSizeType) image->columns*image->rows;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(image,ScaleCharToQuantum(*p),q);
SetPixelGreen(image,ScaleCharToQuantum(*(p+number_pixels)),q);
SetPixelBlue(image,ScaleCharToQuantum(*(p+2*number_pixels)),q);
if (image->colors != 0)
{
SetPixelRed(image,image->colormap[(ssize_t)
GetPixelRed(image,q)].red,q);
SetPixelGreen(image,image->colormap[(ssize_t)
GetPixelGreen(image,q)].green,q);
SetPixelBlue(image,image->colormap[(ssize_t)
GetPixelBlue(image,q)].blue,q);
}
SetPixelAlpha(image,image->alpha_trait == BlendPixelTrait ?
ScaleCharToQuantum(*(p+number_pixels*3)) : OpaqueAlpha,q);
p++;
q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
}
viff_pixels=(unsigned char *) RelinquishMagickMemory(viff_pixels);
if (image->storage_class == PseudoClass)
(void) SyncImage(image,exception);
if (EOFBlob(image) != MagickFalse)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
break;
}
/*
Proceed to next image.
*/
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
count=ReadBlob(image,1,&viff_info.identifier);
if ((count != 0) && (viff_info.identifier == 0xab))
{
/*
Allocate next image structure.
*/
AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
image=SyncNextImageInList(image);
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
GetBlobSize(image));
if (status == MagickFalse)
break;
}
} while ((count != 0) && (viff_info.identifier == 0xab));
开发者ID:verma-manish58,项目名称:ImageMagick,代码行数:101,代码来源:viff.c
示例6: WriteEXRImage
//.........这里部分代码省略.........
compression;
MagickBooleanType
status;
register const Quantum
*p;
register ssize_t
x;
ssize_t
y;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
write_info=CloneImageInfo(image_info);
(void) AcquireUniqueFilename(write_info->filename);
hdr_info=ImfNewHeader();
ImfHeaderSetDataWindow(hdr_info,0,0,(int) image->columns-1,(int)
image->rows-1);
ImfHeaderSetDisplayWindow(hdr_info,0,0,(int) image->columns-1,(int)
image->rows-1);
compression=IMF_NO_COMPRESSION;
if (write_info->compression == ZipSCompression)
compression=IMF_ZIPS_COMPRESSION;
if (write_info->compression == ZipCompression)
compression=IMF_ZIP_COMPRESSION;
if (write_info->compression == PizCompression)
compression=IMF_PIZ_COMPRESSION;
if (write_info->compression == Pxr24Compression)
compression=IMF_PXR24_COMPRESSION;
#if defined(B44Compression)
if (write_info->compression == B44Compression)
compression=IMF_B44_COMPRESSION;
#endif
#if defined(B44ACompression)
if (write_info->compression == B44ACompression)
compression=IMF_B44A_COMPRESSION;
#endif
ImfHeaderSetCompression(hdr_info,compression);
ImfHeaderSetLineOrder(hdr_info,IMF_INCREASING_Y);
file=ImfOpenOutputFile(write_info->filename,hdr_info,IMF_WRITE_RGBA);
ImfDeleteHeader(hdr_info);
if (file == (ImfOutputFile *) NULL)
{
ThrowFileException(exception,BlobError,"UnableToOpenBlob",
ImfErrorMessage());
write_info=DestroyImageInfo(write_info);
return(MagickFalse);
}
scanline=(ImfRgba *) AcquireQuantumMemory(image->columns,sizeof(*scanline));
if (scanline == (ImfRgba *) NULL)
{
(void) ImfCloseOutputFile(file);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
ImfFloatToHalf(QuantumScale*GetPixelRed(image,p),&half_quantum);
scanline[x].r=half_quantum;
ImfFloatToHalf(QuantumScale*GetPixelGreen(image,p),&half_quantum);
scanline[x].g=half_quantum;
ImfFloatToHalf(QuantumScale*GetPixelBlue(image,p),&half_quantum);
scanline[x].b=half_quantum;
if (image->matte == MagickFalse)
ImfFloatToHalf(1.0,&half_quantum);
else
ImfFloatToHalf(QuantumScale*GetPixelAlpha(image,p),&half_quantum);
scanline[x].a=half_quantum;
p+=GetPixelChannels(image);
}
ImfOutputSetFrameBuffer(file,scanline-(y*image->columns),1,image->columns);
ImfOutputWritePixels(file,1);
}
(void) ImfCloseOutputFile(file);
scanline=(ImfRgba *) RelinquishMagickMemory(scanline);
(void) FileToImage(image,write_info->filename,exception);
(void) RelinquishUniqueFileResource(write_info->filename);
write_info=DestroyImageInfo(write_info);
(void) CloseBlob(image);
return(MagickTrue);
}
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:101,代码来源:exr.c
示例7: InverseFourier
static MagickBooleanType InverseFourier(FourierInfo *fourier_info,
const Image *magnitude_image,const Image *phase_image,fftw_complex *fourier,
ExceptionInfo *exception)
{
CacheView
*magnitude_view,
*phase_view;
double
*magnitude,
*phase,
*magnitude_source,
*phase_source;
MagickBooleanType
status;
register const IndexPacket
*indexes;
register const PixelPacket
*p;
register ssize_t
i,
x;
ssize_t
y;
/*
Inverse fourier - read image and break down into a double array.
*/
magnitude_source=(double *) AcquireQuantumMemory((size_t)
fourier_info->height,fourier_info->width*sizeof(*magnitude_source));
if (magnitude_source == (double *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
magnitude_image->filename);
return(MagickFalse);
}
phase_source=(double *) AcquireQuantumMemory((size_t) fourier_info->height,
fourier_info->width*sizeof(*phase_source));
if (phase_source == (double *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
magnitude_image->filename);
magnitude_source=(double *) RelinquishMagickMemory(magnitude_source);
return(MagickFalse);
}
i=0L;
magnitude_view=AcquireVirtualCacheView(magnitude_image,exception);
for (y=0L; y < (ssize_t) fourier_info->height; y++)
{
p=GetCacheViewVirtualPixels(magnitude_view,0L,y,fourier_info->width,1UL,
exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewAuthenticIndexQueue(magnitude_view);
for (x=0L; x < (ssize_t) fourier_info->width; x++)
{
switch (fourier_info->channel)
{
case RedChannel:
default:
{
magnitude_source[i]=QuantumScale*GetPixelRed(p);
break;
}
case GreenChannel:
{
magnitude_source[i]=QuantumScale*GetPixelGreen(p);
break;
}
case BlueChannel:
{
magnitude_source[i]=QuantumScale*GetPixelBlue(p);
break;
}
case OpacityChannel:
{
magnitude_source[i]=QuantumScale*GetPixelOpacity(p);
break;
}
case IndexChannel:
{
magnitude_source[i]=QuantumScale*GetPixelIndex(indexes+x);
break;
}
case GrayChannels:
{
magnitude_source[i]=QuantumScale*GetPixelGray(p);
break;
}
}
i++;
p++;
}
//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,代码来源:fourier.c
示例8: assert
//.........这里部分代码省略.........
/*
Verify that required image information is defined.
*/
if (comment != (char *) NULL)
{
(void) SetImageProperty(image,"comment",comment);
comment=DestroyString(comment);
}
if (EOFBlob(image) != MagickFalse)
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
number_pixels=(MagickSizeType) fits_info.columns*fits_info.rows;
if ((fits_info.simple == MagickFalse) || (fits_info.number_axes < 1) ||
(fits_info.number_axes > 4) || (number_pixels == 0))
ThrowReaderException(CorruptImageError,"ImageTypeNotSupported");
for (scene=0; scene < (ssize_t) fits_info.number_planes; scene++)
{
image->columns=(size_t) fits_info.columns;
image->rows=(size_t) fits_info.rows;
image->depth=(size_t) (fits_info.bits_per_pixel < 0 ? -1 : 1)*
fits_info.bits_per_pixel;
image->endian=fits_info.endian;
image->scene=(size_t) scene;
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
/*
Initialize image structure.
*/
if ((fits_info.min_data != 0.0) || (fits_info.max_data != 0.0))
{
if ((fits_info.bits_per_pixel != 0) && (fits_info.max_data == 0.0))
fits_info.max_data=GetFITSPixelRange((size_t)
fits_info.bits_per_pixel);
}
else
GetFITSPixelExtrema(image,fits_info.bits_per_pixel,&fits_info.min_data,
&fits_info.max_data);
/*
Convert FITS pixels to pixel packets.
*/
scale=(double) QuantumRange/(fits_info.scale*(fits_info.max_data-
fits_info.min_data)+fits_info.zero);
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=GetFITSPixel(image,fits_info.bits_per_pixel);
SetPixelRed(q,ClampToQuantum(scale*(fits_info.scale*(pixel-
fits_info.min_data)+fits_info.zero)));
SetPixelGreen(q,GetPixelRed(q));
SetPixelBlue(q,GetPixelRed(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
if (EOFBlob(image) != MagickFalse)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
break;
}
/*
Proceed to next image.
*/
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
if (scene < (ssize_t) (fits_info.number_planes-1))
{
/*
Allocate next image structure.
*/
AcquireNextImage(image_info,image);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
image=SyncNextImageInList(image);
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
GetBlobSize(image));
if (status == MagickFalse)
break;
}
}
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
开发者ID:Deni-al,项目名称:Android-ImageMagick,代码行数:101,代码来源:fits.c
示例9: RaiseImage
//.........这里部分代码省略.........
}
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
/*
Raise image.
*/
status=MagickTrue;
progress=0;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,1,1)
#endif
for (y=0; y < (ssize_t) raise_info->height; y++)
{
register ssize_t
x;
register PixelPacket
*restrict q;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < y; x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*HighlightFactor+(MagickRealType) foreground*
(QuantumRange-HighlightFactor))));
q++;
}
for ( ; x < (ssize_t) (image->columns-y); x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*AccentuateFactor+(MagickRealType) foreground*
(QuantumRange-AccentuateFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*AccentuateFactor+(MagickRealType) foreground*
(QuantumRange-AccentuateFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*AccentuateFactor+(MagickRealType) foreground*
(QuantumRange-AccentuateFactor))));
q++;
}
for ( ; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelRed(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelGreen(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelGreen(q)*ShadowFactor+(MagickRealType) background*
(QuantumRange-ShadowFactor))));
SetPixelBlue(q,ClampToQuantum(QuantumScale*((MagickRealType)
GetPixelBlue(q)*ShadowFactor+(MagickRealType) background*
开发者ID:AlexiaChen,项目名称:ImageMagick_Cmake,代码行数:67,代码来源:decorate.c
示例10: WriteVIPSImage
//.........这里部分代码省略.........
else
(void) WriteBlobLSBLong(image,VIPS_MAGIC_MSB);
(void) WriteBlobLong(image,(unsigned int) image->columns);
(void) WriteBlobLong(image,(unsigned int) image->rows);
(void) SetImageStorageClass(image,DirectClass);
channels=image->matte ? 4 : 3;
if (SetImageGray(image,&image->exception) != MagickFalse)
channels=image->matte ? 2 : 1;
else if (image->colorspace == CMYKColorspace)
channels=image->matte ? 5 : 4;
(void) WriteBlobLong(image,channels);
(void) WriteBlobLong(image,0);
if (image->depth == 16)
(void) WriteBlobLong(image,(unsigned int) VIPSBandFormatUSHORT);
else
{
image->depth=8;
(void) WriteBlobLong(image,(unsigned int) VIPSBandFormatUCHAR);
}
(void) WriteBlobLong(image,VIPSCodingNONE);
switch(image->colorspace)
{
case CMYKColorspace:
(void) WriteBlobLong(image,VIPSTypeCMYK);
break;
case GRAYColorspace:
if (image->depth == 16)
(void) WriteBlobLong(image, VIPSTypeGREY16);
else
(void) WriteBlobLong(image, VIPSTypeB_W);
break;
case RGBColorspace:
if (image->depth == 16)
(void) WriteBlobLong(image, VIPSTypeRGB16);
else
(void) WriteBlobLong(image, VIPSTypeRGB);
break;
default:
case sRGBColorspace:
(void) SetImageColorspace(image,sRGBColorspace);
(void) WriteBlobLong(image,VIPSTypesRGB);
break;
}
if (image->units == PixelsPerCentimeterResolution)
{
(void) WriteBlobFloat(image,(image->x_resolution / 10));
(void) WriteBlobFloat(image,(image->y_resolution / 10));
}
else if (image->units == PixelsPerInchResolution)
{
(void) WriteBlobFloat(image,(image->x_resolution / 25.4));
(void) WriteBlobFloat(image,(image->y_resolution / 25.4));
}
else
{
(void) WriteBlobLong(image,0);
(void) WriteBlobLong(image,0);
}
/*
Legacy, Offsets, Future
*/
for (y=0; y < 24; y++)
(void) WriteBlobByte(image,0);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
WriteVIPSPixel(image,GetPixelRed(p));
if (channels == 2)
WriteVIPSPixel(image,GetPixelAlpha(p));
else
{
WriteVIPSPixel(image,GetPixelGreen(p));
WriteVIPSPixel(image,GetPixelBlue(p));
if (channels >= 4)
{
if (image->colorspace == CMYKColorspace)
WriteVIPSPixel(image,GetPixelIndex(indexes+x));
else
WriteVIPSPixel(image,GetPixelAlpha(p));
}
else if (channels == 5)
{
WriteVIPSPixel(image,GetPixelIndex(indexes+x));
WriteVIPSPixel(image,GetPixelAlpha(p));
}
}
p++;
}
}
metadata=GetImageProperty(image,"vips:metadata");
if (metadata != (const char*) NULL)
WriteBlobString(image,metadata);
(void) CloseBlob(image);
return(status);
}
开发者ID:JohnHeywardOBrien,项目名称:photogram,代码行数:101,代码来源:vips.c
示例11: assert
//.........这里部分代码省略.........
grays[i].red=(~0U);
grays[i].green=(~0U);
grays[i].blue=(~0U);
grays[i].opacity=(~0U);
grays[i].index=(~0U);
}
status=MagickTrue;
image_view=AcquireCacheView(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register const IndexPacket
*restrict indexes;
register const PixelPacket
*restrict p;
register ssize_t
x;
if (status == MagickFalse)
continue;
p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewVirtualIndexQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
{
grays[ScaleQuantumToMap(GetPixelRed(p))].red=
ScaleQuantumToMap(GetPixelRed(p));
grays[ScaleQuantumToMap(GetPixelGreen(p))].green=
ScaleQuantumToMap(GetPixelGreen(p));
grays[ScaleQuantumToMap(GetPixelBlue(p))].blue=
ScaleQuantumToMap(GetPixelBlue(p));
if (image->colorspace == CMYKColorspace)
grays[ScaleQuantumToMap(GetPixelIndex(indexes+x))].index=
ScaleQuantumToMap(GetPixelIndex(indexes+x));
if (image->matte != MagickFalse)
grays[ScaleQuantumToMap(GetPixelOpacity(p))].opacity=
ScaleQuantumToMap(GetPixelOpacity(p));
p++;
}
}
image_view=DestroyCacheView(image_view);
if (status == MagickFalse)
{
grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
channel_features=(ChannelFeatures *) RelinquishMagickMemory(
channel_features);
return(channel_features);
}
(void) ResetMagickMemory(&gray,0,sizeof(gray));
for (i=0; i <= (ssize_t) MaxMap; i++)
{
if (grays[i].red != ~0U)
grays[(ssize_t) gray.red++].red=grays[i].red;
if (grays[i].green != ~0U)
grays[(ssize_t) gray.green++].green=grays[i].green;
if (grays[i].blue != ~0U)
grays[(ssize_t) gray.blue++].blue=grays[i].blue;
if (image->colorspace == CMYKColorspace)
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,代码来源:feature.c
示例12: ReadYCBCRImage
//.........这里部分代码省略.........
if (scene == 0)
{
length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
count=ReadBlob(image,length,pixels);
}
for (y=0; y < (ssize_t) image->extract_info.height; y++)
{
if (count != (ssize_t) length)
{
ThrowFileException(exception,CorruptImageError,
"UnexpectedEndOfFile",image->filename);
break;
}
q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
break;
length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
quantum_info,quantum_type,pixels,exception);
if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
break;
if (((y-image->extract_info.y) >= 0) &&
((y-image->extract_info.y) < (ssize_t) image->rows))
{
p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
canvas_image->columns,1,exception);
q=QueueAuthenticPixels(image,0,y-image->extract_info.y,
image->columns,1,exception);
if ((p == (const PixelPacket *) NULL) ||
(q == (PixelPacket *) NULL))
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelRed(p));
SetPixelGreen(q,GetPixelGreen(p));
SetPixelBlue(q,GetPixelBlue(p));
if (image->matte != MagickFalse)
SetPixelOpacity(q,GetPixelOpacity(p));
p++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
count=ReadBlob(image,length,pixels);
}
break;
}
case LineInterlace:
{
static QuantumType
quantum_types[4] =
{
RedQuantum,
GreenQuantum,
BlueQuantum,
OpacityQuantum
};
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:66,代码来源:ycbcr.c
示例13: WriteJP2Image
//.........这里部分代码省略.........
if (number_components == 4)
jas_image_setcmpttype(jp2_image,3,JAS_IMAGE_CT_OPACITY);
break;
}
}
/*
Convert to JPEG 2000 pixels.
*/
for (i=0; i < (ssize_t) number_components; i++)
{
pixels[i]=jas_matrix_create(1,(int) image->columns);
if (pixels[i] == (jas_matrix_t *) NULL)
{
for (x=0; x < i; x++)
jas_matrix_destroy(pixels[x]);
jas_image_destroy(jp2_image);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
}
range=GetQuantumRange((size_t) component_info[0].prec);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
if (number_components == 1)
jas_matrix_setv(pixels[0],x,(jas_seqent_t) ScaleQuantumToAny(
GetPixelIntensity(image,p),range));
else
{
jas_matrix_setv(pixels[0],x,(jas_seqent_t) ScaleQuantumToAny(
GetPixelRed(image,p),range));
jas_matrix_setv(pixels[1],x,(jas_seqent_t) ScaleQuantumToAny(
GetPixelGreen(image,p),range));
jas_matrix_setv(pixels[2],x,(jas_seqent_t) ScaleQuantumToAny(
GetPixelBlue(image,p),range));
if (number_components > 3)
jas_matrix_setv(pixels[3],x,(jas_seqent_t) ScaleQuantumToAny(
GetPixelAlpha(image,p),range));
}
p+=GetPixelChannels(image);
}
for (i=0; i < (ssize_t) number_components; i++)
(void) jas_image_writecmpt(jp2_image,(short) i,0,(unsigned int) y,
(unsigned int) image->columns,1,pixels[i]);
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
(void) CopyMagickString(magick,image_info->magick,MaxTextExtent);
if (LocaleCompare(magick,"J2C") == 0)
(void) CopyMagickString(magick,"JPC",MaxTextExtent);
LocaleLower(magick);
format=jas_image_strtofmt(magick);
options=(char *) NULL;
ResetImageOptionIterator(image_info);
key=GetNextImageOption(image_info);
for ( ; key != (char *) NULL; key=GetNextImageOption(image_info))
{
option=GetImageOption(image_info,key);
if (option == (const char *) NULL)
continue;
if (LocaleNCompare(key,"jp2:",4) == 0)
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,代码来源:jp2.c
示例14: WriteSGIImage
static MagickBooleanType WriteSGIImage(const ImageInfo *image_info,Image *image)
{
CompressionType
compression;
const char
*value;
MagickBooleanType
status;
MagickOffsetType
scene;
MagickSizeType
number_pixels;
MemoryInfo
*pixel_info;
SGIInfo
iris_info;
register const PixelPacket
*p;
register ssize_t
i,
x;
register unsigned char
*q;
ssize_t
y,
z;
unsigned char
*pixels,
*packets;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if ((image->columns > 65535UL) || (image->rows > 65535UL))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
scene=0;
do
{
/*
Initialize SGI raster file header.
*/
(void) TransformImageColorspace(image,sRGBColorspace);
(void) ResetMagickMemory(&iris_info,0,sizeof(iris_info));
iris_info.magic=0x01DA;
compression=image->compression;
if (image_info->compression != UndefinedCompression)
compression=image_info->compression;
if (image->depth > 8)
compression=NoCompression;
if (compression == NoCompression)
iris_info.storage=(unsigned char) 0x00;
else
iris_info.storage=(unsigned char) 0x01;
iris_info.bytes_per_pixel=(unsigned char) (image->depth > 8 ? 2 : 1);
iris_info.dimension=3;
iris_info.columns=(unsigned short) image->columns;
iris_info.rows=(unsigned short) image->rows;
if (image->matte != MagickFalse)
iris_info.depth=4;
else
{
if ((image_info->type != TrueColorType) &&
(SetImageGray(image,&image->exception) != MagickFalse))
{
iris_info.dimension=2;
iris_info.depth=1;
}
else
iris_info.depth=3;
}
iris_info.minimum_value=0;
iris_info.maximum_value=(size_t) (image->depth <= 8 ?
1UL*ScaleQuantumToChar(QuantumRange) :
1UL*ScaleQuantumToShort(QuantumRange));
/*
Write SGI header.
*/
(void) WriteBlobMSBShort(image,iris_info.magic);
(void) WriteBlobByte(image,iris_info.storage);
(void) WriteBlobByte(image,iris_info.bytes_per_pixel);
//.........这里部分代码省略.........
开发者ID:acal,项目名称:alchemy,代码行数:101,代码来源:sgi.c
示例15: assert
//.........这里部分代码省略.........
}
}
image->depth=maximum_component_depth;
if (image_info->ping != MagickFalse)
{
(void) jas_stream_close(jp2_stream);
jas_image_destroy(jp2_image);
return(GetFirstImageInList(image));
}
for (i=0; i < (ssize_t) number_components; i++)
range[i]=GetQuantumRange((size_t) jas_image_cmptprec(jp2_image,
components[i]));
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (i=0; i < (ssize_t) number_components; i++)
(void) jas_image_readcmpt(jp2_image,(short) components[i],0,
(jas_image_coord_t) (y/y_step[i]),(jas_image_coord_t) (image->columns/
x_step[i]),1,pixels[i]);
switch (number_components)
{
case 1:
{
/*
Grayscale.
*/
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=(QuantumAny) jas_matrix_getv(pixels[0],x/x_step[0]);
SetPixelRed(q,ScaleAnyToQuantum((QuantumAny) pixel,
range[0]));
SetPixelGreen(q,GetPixelRed(q));
SetPixelBlue(q,GetPixelRed(q));
q++;
}
break;
}
case 3:
{
/*
RGB.
*/
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=(QuantumAny) jas_matrix_getv(pixels[0],x/x_step[0]);
SetPixelRed(q,ScaleAnyToQuantum((QuantumAny) pixel,range[0]));
pixel=(QuantumAny) jas_matrix_getv(pixels[1],x/x_step[1]);
SetPixelGreen(q,ScaleAnyToQuantum((QuantumAny) pixel,range[1]));
pixel=(QuantumAny) jas_matrix_getv(pixels[2],x/x_step[2]);
SetPixelBlue(q,ScaleAnyToQuantum((QuantumAny) pixel,range[2]));
q++;
}
break;
}
case 4:
{
/*
RGBA.
*/
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=(QuantumAny) jas_matrix_getv(pixels[0],x/x_step[0]);
SetPixelRed(q,ScaleAnyToQuantum((QuantumAny) pixel,range[0]));
pixel=(QuantumAny) jas_matrix_getv(pixels[1],x/x_step[1]);
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,代码来源:jp2.c
|
请发表评论