本文整理汇总了C++中GetPixelBlue函数 的典型用法代码示例。如果您正苦于以下问题:C++ GetPixelBlue函数的具体用法?C++ GetPixelBlue怎么用?C++ GetPixelBlue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPixelBlue函数 的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: SetImageAlphaChannel
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% S e t I m a g e A l p h a C h a n n e l %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha
% channel.
%
% The format of the SetImageAlphaChannel method is:
%
% MagickBooleanType SetImageAlphaChannel(Image *image,
% const AlphaChannelType alpha_type)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o alpha_type: The alpha channel type: ActivateAlphaChannel,
% AssociateAlphaChannel, CopyAlphaChannel, Disassociate,
% DeactivateAlphaChannel, ExtractAlphaChannel, OpaqueAlphaChannel,
% ResetAlphaChannel, SetAlphaChannel, ShapeAlphaChannel, and
% TransparentAlphaChannel.
%
*/
MagickExport MagickBooleanType SetImageAlphaChannel(Image *image,
const AlphaChannelType alpha_type)
{
CacheView
*image_view;
ExceptionInfo
*exception;
MagickBooleanType
status;
ssize_t
y;
assert(image != (Image *) NULL);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image->signature == MagickSignature);
exception=(&image->exception);
status=MagickTrue;
switch (alpha_type)
{
case ActivateAlphaChannel:
{
image->matte=MagickTrue;
break;
}
case AssociateAlphaChannel:
{
/*
Associate alpha.
*/
status=SetImageStorageClass(image,DirectClass);
if (status == MagickFalse)
break;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
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;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
double
alpha,
gamma;
alpha=QuantumScale*GetPixelAlpha(q);
gamma=alpha;
SetPixelRed(q,ClampToQuantum(gamma*GetPixelRed(q)));
SetPixelGreen(q,ClampToQuantum(gamma*GetPixelGreen(q)));
SetPixelBlue(q,ClampToQuantum(gamma*GetPixelBlue(q)));
q++;
//.........这里部分代码省略.........
开发者ID:JohnHeywardOBrien, 项目名称:photogram, 代码行数:101, 代码来源:channel.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: WriteHISTOGRAMImage
//.........这里部分代码省略.........
else
(void) ParseAbsoluteGeometry(image_info->density,&geometry);
histogram_image=CloneImage(image,geometry.width,geometry.height,MagickTrue,
exception);
if (histogram_image == (Image *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) SetImageStorageClass(histogram_image,DirectClass,exception);
/*
Allocate histogram count arrays.
*/
length=MagickMax((size_t) ScaleQuantumToChar(QuantumRange)+1UL,
histogram_image->columns);
histogram=(PixelInfo *) AcquireQuantumMemory(length,sizeof(*histogram));
if (histogram == (PixelInfo *) NULL)
{
histogram_image=DestroyImage(histogram_image);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
/*
Initialize histogram count arrays.
*/
(void) ResetMagickMemory(histogram,0,length*sizeof(*histogram));
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 ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
histogram[ScaleQuantumToChar(GetPixelRed(image,p))].red++;
if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
histogram[ScaleQuantumToChar(GetPixelGreen(image,p))].green++;
if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
histogram[ScaleQuantumToChar(GetPixelBlue(image,p))].blue++;
p+=GetPixelChannels(image);
}
}
maximum=histogram[0].red;
for (x=0; x < (ssize_t) histogram_image->columns; x++)
{
if (((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) &&
(maximum < histogram[x].red))
maximum=histogram[x].red;
if (((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) &&
(maximum < histogram[x].green))
maximum=histogram[x].green;
if (((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) &&
(maximum < histogram[x].blue))
maximum=histogram[x].blue;
}
scale=0.0;
if (fabs(maximum) >= MagickEpsilon)
scale=(double) histogram_image->rows/maximum;
/*
Initialize histogram image.
*/
(void) QueryColorCompliance("#000000",AllCompliance,
&histogram_image->background_color,exception);
(void) SetImageBackgroundColor(histogram_image,exception);
for (x=0; x < (ssize_t) histogram_image->columns; x++)
{
q=GetAuthenticPixels(histogram_image,x,0,1,histogram_image->rows,exception);
if (q == (Quantum *) NULL)
break;
if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
开发者ID:278443820, 项目名称:ImageMagick, 代码行数:67, 代码来源:histogram.c
示例9: RaiseImage
//.........这里部分代码省略.........
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*
(QuantumRange-ShadowFactor))));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
开发者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].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)
if (grays[i].index != ~0U)
grays[(ssize_t) gray.index++].index=grays[i].index;
if (image->matte != MagickFalse)
if (grays[i].opacity != ~0U)
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:67, 代码来源:feature.c
示例12: ReadYCBCRImage
//.........这里部分代码省略.........
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
};
/*
Line interlacing: YYY...CbCbCb...CrCrCr...YYY...CbCbCb...CrCrCr...
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:67, 代码来源:ycbcr.c
示例13: WriteJP2Image
//.........这里部分代码省略.........
}
/*
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)
{
(void) ConcatenateString(&options,key+4);
if (*option != '\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: StatisticsComponentsStatistics
static MagickBooleanType StatisticsComponentsStatistics(const Image *image,
const Image *component_image,const size_t number_objects,
ExceptionInfo *exception)
{
CacheView
*component_view,
*image_view;
CCObject
*object;
MagickBooleanType
status;
register ssize_t
i;
ssize_t
y;
/*
Collect statistics on unique objects.
*/
object=(CCObject *) AcquireQuantumMemory(number_objects,sizeof(*object));
if (object == (CCObject *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
return(MagickFalse);
}
(void) ResetMagickMemory(object,0,number_objects*sizeof(*object));
for (i=0; i < (ssize_t) number_objects; i++)
{
object[i].id=i;
object[i].bounding_box.x=(ssize_t) component_image->columns;
object[i].bounding_box.y=(ssize_t) component_image->rows;
GetPixelInfo(image,&object[i].color);
}
status=MagickTrue;
image_view=AcquireVirtualCacheView(image,exception);
component_view=AcquireVirtualCacheView(component_image,exception);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p,
*magick_restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
q=GetCacheViewVirtualPixels(component_view,0,y,component_image->columns,1,
exception);
if ((p == (const Quantum *) NULL) || (q == (const Quantum *) NULL))
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
i=(ssize_t) GetPixelIntensity(image,q);
if (x < object[i].bounding_box.x)
object[i].bounding_box.x=x;
if (x > (ssize_t) object[i].bounding_box.width)
object[i].bounding_box.width=(size_t) x;
if (y < object[i].bounding_box.y)
object[i].bounding_box.y=y;
if (y > (ssize_t) object[i].bounding_box.height)
object[i].bounding_box.height=(size_t) y;
object[i].color.red+=GetPixelRed(image,p);
object[i].color.green+=GetPixelGreen(image,p);
object[i].color.blue+=GetPixelBlue(image,p);
object[i].color.alpha+=GetPixelAlpha(image,p);
object[i].color.black+=GetPixelBlack(image,p);
object[i].centroid.x+=x;
object[i].centroid.y+=y;
object[i].area++;
p+=GetPixelChannels(image);
q+=GetPixelChannels(component_image);
}
}
for (i=0; i < (ssize_t) number_objects; i++)
{
object[i].bounding_box.width-=(object[i].bounding_box.x-1);
object[i].bounding_box.height-=(object[i].bounding_box.y-1);
object[i].color.red=object[i].color.red/object[i].area;
object[i].color.green=object[i].color.green/object[i].area;
object[i].color.blue=object[i].color.blue/object[i].area;
object[i].color.alpha=object[i].color.alpha/object[i].area;
object[i].color.black=object[i].color.black/object[i].area;
object[i].centroid.x=object[i].centroid.x/object[i].area;
object[i].centroid.y=object[i].centroid.y/object[i].area;
}
component_view=DestroyCacheView(component_view);
image_view=DestroyCacheView(image_view);
/*
Report statistics on unique objects.
*/
//.........这里部分代码省略.........
开发者ID:WilfR, 项目名称:ImageMagick, 代码行数:101, 代码来源:vision.c
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18273| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9677| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8179| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8549| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8457| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9393| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8430| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7865| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8415| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7394| 2022-11-06
请发表评论