本文整理汇总了C++中InheritException函数的典型用法代码示例。如果您正苦于以下问题:C++ InheritException函数的具体用法?C++ InheritException怎么用?C++ InheritException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InheritException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClonePixelView
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e P i x e l V i e w %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ClonePixelView() makes a copy of the specified pixel view.
%
% The format of the ClonePixelView method is:
%
% PixelView *ClonePixelView(const PixelView *pixel_view)
%
% A description of each parameter follows:
%
% o pixel_view: the pixel view.
%
*/
WandExport PixelView *ClonePixelView(const PixelView *pixel_view)
{
PixelView
*clone_view;
register long
i;
assert(pixel_view != (PixelView *) NULL);
assert(pixel_view->signature == WandSignature);
if (pixel_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",pixel_view->name);
clone_view=(PixelView *) AcquireMagickMemory(sizeof(*clone_view));
if (clone_view == (PixelView *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
pixel_view->name);
(void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
clone_view->id=AcquireWandId();
(void) FormatMagickString(clone_view->name,MaxTextExtent,"%s-%lu",PixelViewId,
clone_view->id);
clone_view->exception=AcquireExceptionInfo();
InheritException(clone_view->exception,pixel_view->exception);
clone_view->view=CloneCacheView(pixel_view->view);
clone_view->region=pixel_view->region;
clone_view->number_threads=pixel_view->number_threads;
for (i=0; i < (long) pixel_view->number_threads; i++)
clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **)
pixel_view->pixel_wands[i],pixel_view->region.width);
clone_view->debug=pixel_view->debug;
if (clone_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_view->name);
clone_view->signature=WandSignature;
return(clone_view);
}
示例2: MagickQueryMultilineFontMetrics
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k Q u e r y M u l t i l i n e F o n t M e t r i c s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickQueryMultilineFontMetrics() returns a 13 element array representing the
% following font metrics:
%
% Element Description
% -------------------------------------------------
% 0 character width
% 1 character height
% 2 ascender
% 3 descender
% 4 text width
% 5 text height
% 6 maximum horizontal advance
% 7 bounding box: x1
% 8 bounding box: y1
% 9 bounding box: x2
% 10 bounding box: y2
% 11 origin: x
% 12 origin: y
%
% This method is like MagickQueryFontMetrics() but it returns the maximum text
% width and height for multiple lines of text.
%
% The format of the MagickQueryFontMetrics method is:
%
% double *MagickQueryMultilineFontMetrics(MagickWand *wand,
% const DrawingWand *drawing_wand,const char *text)
%
% A description of each parameter follows:
%
% o wand: The Magick wand.
%
% o drawing_wand: The drawing wand.
%
% o text: The text.
%
*/
WandExport double *MagickQueryMultilineFontMetrics(MagickWand *wand,
const DrawingWand *drawing_wand,const char *text)
{
double
*font_metrics;
DrawInfo
*draw_info;
MagickBooleanType
status;
TypeMetric
metrics;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
assert(drawing_wand != (const DrawingWand *) NULL);
if (wand->images == (Image *) NULL)
{
(void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
"ContainsNoImages","`%s'",wand->name);
return((double *) NULL);
}
font_metrics=(double *) AcquireQuantumMemory(13UL,sizeof(*font_metrics));
if (font_metrics == (double *) NULL)
return((double *) NULL);
draw_info=PeekDrawingWand(drawing_wand);
if (draw_info == (DrawInfo *) NULL)
{
font_metrics=(double *) RelinquishMagickMemory(font_metrics);
return((double *) NULL);
}
(void) CloneString(&draw_info->text,text);
(void) ResetMagickMemory(&metrics,0,sizeof(metrics));
status=GetMultilineTypeMetrics(wand->images,draw_info,&metrics);
draw_info=DestroyDrawInfo(draw_info);
if (status == MagickFalse)
{
InheritException(wand->exception,&wand->images->exception);
font_metrics=(double *) RelinquishMagickMemory(font_metrics);
return((double *) NULL);
}
font_metrics[0]=metrics.pixels_per_em.x;
font_metrics[1]=metrics.pixels_per_em.y;
font_metrics[2]=metrics.ascent;
font_metrics[3]=metrics.descent;
font_metrics[4]=metrics.width;
font_metrics[5]=metrics.height;
font_metrics[6]=metrics.max_advance;
font_metrics[7]=metrics.bounds.x1;
//.........这里部分代码省略.........
示例3: CloneMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneMagickWand() makes an exact copy of the specified wand.
%
% The format of the CloneMagickWand method is:
%
% MagickWand *CloneMagickWand(const MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
*/
WandExport MagickWand *CloneMagickWand(const MagickWand *wand)
{
MagickWand
*clone_wand;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
if (clone_wand == (MagickWand *) NULL)
{
char
*message;
message=GetExceptionMessage(errno);
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
message);
message=DestroyString(message);
}
(void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
clone_wand->id=AcquireWandId();
(void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu",
MagickWandId,clone_wand->id);
clone_wand->exception=AcquireExceptionInfo();
InheritException(clone_wand->exception,wand->exception);
clone_wand->image_info=CloneImageInfo(wand->image_info);
clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
clone_wand->images=CloneImageList(wand->images,clone_wand->exception);
clone_wand->debug=IsEventLogging();
if (clone_wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
clone_wand->signature=WandSignature;
return(clone_wand);
}
示例4: CloneMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneMagickWand() makes an exact copy of the specified wand.
%
% The format of the CloneMagickWand method is:
%
% MagickWand *CloneMagickWand(const MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
*/
WandExport MagickWand *CloneMagickWand(const MagickWand *wand)
{
MagickWand
*clone_wand;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
if (clone_wand == (MagickWand *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
wand->name);
(void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
clone_wand->id=AcquireWandId();
(void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
MagickWandId,(double) clone_wand->id);
clone_wand->exception=AcquireExceptionInfo();
InheritException(clone_wand->exception,wand->exception);
clone_wand->image_info=CloneImageInfo(wand->image_info);
clone_wand->images=CloneImageList(wand->images,clone_wand->exception);
clone_wand->insert_before=MagickFalse;
clone_wand->image_pending=MagickFalse;
clone_wand->debug=IsEventLogging();
if (clone_wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
clone_wand->signature=WandSignature;
return(clone_wand);
}
示例5: ConstituteImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C o n s t i t u t e I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ConstituteImage() returns an image from the pixel data you supply.
% The pixel data must be in scanline order top-to-bottom. The data can be
% char, short int, int, float, or double. Float and double require the
% pixels to be normalized [0..1], otherwise [0..QuantumRange]. For example, to
% create a 640x480 image from unsigned red-green-blue character data, use:
%
% image = ConstituteImage(640,480,"RGB",CharPixel,pixels,&exception);
%
% The format of the ConstituteImage method is:
%
% Image *ConstituteImage(const unsigned long columns,
% const unsigned long rows,const char *map,const StorageType storage,
% const void *pixels,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o columns: width in pixels of the image.
%
% o rows: height in pixels of the image.
%
% o map: This string reflects the expected ordering of the pixel array.
% It can be any combination or order of R = red, G = green, B = blue,
% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
% P = pad.
%
% o storage: Define the data type of the pixels. Float and double types are
% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose
% from these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
% LongPixel, QuantumPixel, or ShortPixel.
%
% o pixels: This array of values contain the pixel components as defined by
% map and type. You must preallocate this array where the expected
% length varies depending on the values of width, height, map, and type.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *ConstituteImage(const unsigned long columns,
const unsigned long rows,const char *map,const StorageType storage,
const void *pixels,ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
status;
/*
Allocate image structure.
*/
assert(map != (const char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",map);
assert(pixels != (void *) NULL);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
image=AcquireImage((ImageInfo *) NULL);
if (image == (Image *) NULL)
return((Image *) NULL);
if ((columns == 0) || (rows == 0))
ThrowImageException(OptionError,"NonZeroWidthAndHeightRequired");
image->columns=columns;
image->rows=rows;
(void) SetImageBackgroundColor(image);
status=ImportImagePixels(image,0,0,columns,rows,map,storage,pixels);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
image=DestroyImage(image);
}
return(image);
}
示例6: CloneWandView
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e W a n d V i e w %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneWandView() makes a copy of the specified wand view.
%
% The format of the CloneWandView method is:
%
% WandView *CloneWandView(const WandView *wand_view)
%
% A description of each parameter follows:
%
% o wand_view: the wand view.
%
*/
WandExport WandView *CloneWandView(const WandView *wand_view)
{
WandView
*clone_view;
register ssize_t
i;
assert(wand_view != (WandView *) NULL);
assert(wand_view->signature == WandSignature);
if (wand_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand_view->name);
clone_view=(WandView *) AcquireMagickMemory(sizeof(*clone_view));
if (clone_view == (WandView *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
wand_view->name);
(void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
clone_view->id=AcquireWandId();
(void) FormatLocaleString(clone_view->name,MaxTextExtent,"%s-%.20g",
WandViewId,(double) clone_view->id);
clone_view->description=ConstantString(wand_view->description);
clone_view->view=CloneCacheView(wand_view->view);
clone_view->extent=wand_view->extent;
clone_view->number_threads=wand_view->number_threads;
clone_view->exception=AcquireExceptionInfo();
InheritException(clone_view->exception,wand_view->exception);
for (i=0; i < (ssize_t) wand_view->number_threads; i++)
clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **)
wand_view->pixel_wands[i],wand_view->extent.width);
clone_view->debug=wand_view->debug;
if (clone_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_view->name);
clone_view->signature=WandSignature;
return(clone_view);
}
示例7: ClonePixelIterator
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e P i x e l I t e r a t o r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ClonePixelIterator() makes an exact copy of the specified iterator.
%
% The format of the ClonePixelIterator method is:
%
% PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
%
% A description of each parameter follows:
%
% o iterator: the magick iterator.
%
*/
WandExport PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
{
PixelIterator
*clone_iterator;
assert(iterator != (PixelIterator *) NULL);
assert(iterator->signature == WandSignature);
if (iterator->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
clone_iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*clone_iterator));
if (clone_iterator == (PixelIterator *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
iterator->name);
(void) ResetMagickMemory(clone_iterator,0,sizeof(*clone_iterator));
clone_iterator->id=AcquireWandId();
(void) FormatMagickString(clone_iterator->name,MaxTextExtent,"%s-%lu",
PixelIteratorId,clone_iterator->id);
clone_iterator->exception=AcquireExceptionInfo();
InheritException(clone_iterator->exception,iterator->exception);
clone_iterator->view=CloneCacheView(iterator->view);
clone_iterator->region=iterator->region;
clone_iterator->active=iterator->active;
clone_iterator->y=iterator->y;
clone_iterator->pixel_wands=ClonePixelWands((const PixelWand **)
iterator->pixel_wands,iterator->region.width);
clone_iterator->debug=iterator->debug;
if (clone_iterator->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
clone_iterator->name);
clone_iterator->signature=WandSignature;
return(clone_iterator);
}
示例8: PixelSyncIterator
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% P i x e l S y n c I t e r a t o r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PixelSyncIterator() syncs the pixel iterator.
%
% The format of the PixelSyncIterator method is:
%
% MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
%
% A description of each parameter follows:
%
% o iterator: the pixel iterator.
%
*/
WandExport MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
{
ExceptionInfo
*exception;
register IndexPacket
*restrict indexes;
register ssize_t
x;
register PixelPacket
*restrict pixels;
assert(iterator != (const PixelIterator *) NULL);
assert(iterator->signature == WandSignature);
if (iterator->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
if (SetCacheViewStorageClass(iterator->view,DirectClass) == MagickFalse)
return(MagickFalse);
exception=iterator->exception;
pixels=GetCacheViewAuthenticPixels(iterator->view,iterator->region.x,
iterator->region.y+iterator->y,iterator->region.width,1,exception);
if (pixels == (PixelPacket *) NULL)
{
InheritException(iterator->exception,GetCacheViewException(
iterator->view));
return(MagickFalse);
}
indexes=GetCacheViewAuthenticIndexQueue(iterator->view);
for (x=0; x < (ssize_t) iterator->region.width; x++)
PixelGetQuantumColor(iterator->pixel_wands[x],pixels+x);
if (GetCacheViewColorspace(iterator->view) == CMYKColorspace)
for (x=0; x < (ssize_t) iterator->region.width; x++)
SetPixelBlack(indexes+x,PixelGetBlackQuantum(
iterator->pixel_wands[x]));
if (SyncCacheViewAuthenticPixels(iterator->view,exception) == MagickFalse)
{
InheritException(iterator->exception,GetCacheViewException(
iterator->view));
return(MagickFalse);
}
return(MagickTrue);
}
示例9: PixelSyncIterator
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% P i x e l S y n c I t e r a t o r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PixelSyncIterator() syncs the pixel iterator.
%
% The format of the PixelSyncIterator method is:
%
% MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
%
% A description of each parameter follows:
%
% o iterator: the pixel iterator.
%
*/
WandExport MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
{
IndexPacket
*indexes;
register long
x;
register PixelPacket
*p;
assert(iterator != (const PixelIterator *) NULL);
assert(iterator->signature == WandSignature);
if (iterator->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
if (SetCacheViewStorageClass(iterator->view,DirectClass) == MagickFalse)
return(MagickFalse);
p=GetCacheViewPixels(iterator->view,iterator->region.x,iterator->region.y+
iterator->y,iterator->region.width,1);
if (p == (PixelPacket *) NULL)
{
InheritException(iterator->exception,GetCacheViewException(
iterator->view));
return(MagickFalse);
}
indexes=GetCacheViewIndexes(iterator->view);
for (x=0; x < (long) iterator->region.width; x++)
{
PixelGetQuantumColor(iterator->pixel_wands[x],p);
if (GetCacheViewColorspace(iterator->view) == CMYKColorspace)
indexes[x]=PixelGetBlackQuantum(iterator->pixel_wands[x]);
else
if (GetCacheViewStorageClass(iterator->view) == PseudoClass)
indexes[x]=PixelGetIndex(iterator->pixel_wands[x]);
p++;
}
if (SyncCacheView(iterator->view) == MagickFalse)
{
InheritException(iterator->exception,GetCacheViewException(
iterator->view));
return(MagickFalse);
}
return(MagickTrue);
}
示例10: CloneExceptionInfo
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e E x c e p t i o n I n f o %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneExceptionInfo() clones the ExceptionInfo structure.
%
% The format of the CloneExceptionInfo method is:
%
% ExceptionInfo *CloneException(ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o exception: the exception info.
%
*/
MagickExport ExceptionInfo *CloneExceptionInfo(ExceptionInfo *exception)
{
ExceptionInfo
*clone_exception;
clone_exception=(ExceptionInfo *) AcquireMagickMemory(sizeof(*exception));
if (clone_exception == (ExceptionInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
GetExceptionInfo(clone_exception);
InheritException(clone_exception,exception);
exception->relinquish=MagickTrue;
return(exception);
}
示例11: CloneImageView
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e I m a g e V i e w %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneImageView() makes a copy of the specified image view.
%
% The format of the CloneImageView method is:
%
% ImageView *CloneImageView(const ImageView *image_view)
%
% A description of each parameter follows:
%
% o image_view: the image view.
%
*/
MagickExport ImageView *CloneImageView(const ImageView *image_view)
{
ImageView
*clone_view;
assert(image_view != (ImageView *) NULL);
assert(image_view->signature == MagickSignature);
clone_view=(ImageView *) AcquireMagickMemory(sizeof(*clone_view));
if (clone_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
clone_view->description=ConstantString(image_view->description);
clone_view->extent=image_view->extent;
clone_view->view=CloneCacheView(image_view->view);
clone_view->exception=AcquireExceptionInfo();
InheritException(clone_view->exception,image_view->exception);
clone_view->debug=image_view->debug;
clone_view->signature=MagickSignature;
return(clone_view);
}
示例12: rm_check_image_exception
/*
Extern: rm_check_image_exception
Purpose: If an ExceptionInfo struct in a list of images indicates a warning,
issue a warning message. If an ExceptionInfo struct indicates an
error, raise an exception and optionally destroy the images.
*/
void
rm_check_image_exception(Image *imglist, ErrorRetention retention)
{
ExceptionInfo exception;
Image *badboy = NULL;
Image *image;
if (imglist == NULL)
{
return;
}
GetExceptionInfo(&exception);
// Find the image with the highest severity
image = GetFirstImageInList(imglist);
while (image)
{
if (image->exception.severity != UndefinedException)
{
if (!badboy || image->exception.severity > badboy->exception.severity)
{
badboy = image;
InheritException(&exception, &badboy->exception);
}
ClearMagickException(&image->exception);
}
image = GetNextImageInList(image);
}
if (badboy)
{
rm_check_exception(&exception, imglist, retention);
}
(void) DestroyExceptionInfo(&exception);
}
示例13: MagickSetIteratorIndex
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k S e t I t e r a t o r I n d e x %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickSetIteratorIndex() set the iterator to the given position in the
% image list specified with the index parameter. A zero index will set
% the first image as current, and so on. Negative indexes can be used
% to specify an image relative to the end of the images in the wand, with
% -1 being the last image in the wand.
%
% If the index is invalid (range too large for number of images in wand)
% the function will return MagickFalse, but no 'exception' will be raised,
% as it is not actually an error. In that case the current image will not
% change.
%
% After using any images added to the wand using MagickAddImage() or
% MagickReadImage() will be added after the image indexed, regardless
% of if a zero (first image in list) or negative index (from end) is used.
%
% Jumping to index 0 is similar to MagickResetIterator() but differs in how
% MagickNextImage() behaves afterward.
%
% The format of the MagickSetIteratorIndex method is:
%
% MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
% const ssize_t index)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
% o index: the scene number.
%
*/
WandExport MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
const ssize_t index)
{
Image
*image;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
return(MagickFalse);
image=GetImageFromList(wand->images,index);
if (image == (Image *) NULL)
{
InheritException(wand->exception,&wand->images->exception);
return(MagickFalse);
}
wand->images=image;
wand->insert_before=MagickFalse; /* Insert/Add after (this) image */
wand->image_pending=MagickFalse; /* NextImage will set next image */
return(MagickTrue);
}
示例14: MagickSetIteratorIndex
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a g i c k S e t I t e r a t o r I n d e x %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickSetIteratorIndex() set the iterator to the position in the image list
% specified with the index parameter.
%
% The format of the MagickSetIteratorIndex method is:
%
% MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
% const long index)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
% o index: The scene number.
%
*/
WandExport MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
const long index)
{
Image
*image;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
return(MagickFalse);
image=GetImageFromList(wand->images,index);
if (image == (Image *) NULL)
{
InheritException(wand->exception,&wand->images->exception);
return(MagickFalse);
}
wand->active=MagickTrue;
wand->pend=MagickFalse;
wand->images=image;
return(MagickTrue);
}
示例15: ReadGRAYImage
//.........这里部分代码省略.........
Allocate memory for a pixels.
*/
packet_size=(size_t) (image->depth+7)/8;
pixels=(unsigned char *) AcquireQuantumMemory(image->extract_info.width,
packet_size*sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image_info->number_scenes != 0)
while (image->scene < image_info->scene)
{
/*
Skip to next image.
*/
image->scene++;
for (y=0; y < (long) image->rows; y++)
{
count=ReadBlob(image,packet_size*image->extract_info.width,pixels);
if (count != (ssize_t) (packet_size*image->extract_info.width))
break;
}
}
offset=(MagickOffsetType) (packet_size*image->extract_info.x);
do
{
/*
Convert raster image to pixel packets.
*/
GetQuantumInfo(image_info,&quantum_info);
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
if (SetImageExtent(image,0,0) == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
for (y=0; y < image->extract_info.y; y++)
{
count=ReadBlob(image,packet_size*image->extract_info.width,pixels);
if (count != (ssize_t) (packet_size*image->extract_info.width))
break;
}
for (y=0; y < (long) image->rows; y++)
{
if ((y > 0) || (GetPreviousImageInList(image) == (Image *) NULL))
{
count=ReadBlob(image,packet_size*image->extract_info.width,pixels);
if (count != (ssize_t) (packet_size*image->extract_info.width))
break;
}
q=SetImagePixels(image,0,y,image->columns,1);
if (q == (PixelPacket *) NULL)
break;
(void) ExportQuantumPixels(image,&quantum_info,GrayQuantum,pixels+offset);
if (SyncImagePixels(image) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
(QuantumTick(y,image->rows) != MagickFalse))
{
status=image->progress_monitor(LoadImageTag,y,image->rows,
image->client_data);
if (status == MagickFalse)
break;
}
}