当前位置: 首页>>代码示例>>C++>>正文


C++ GetExceptionInfo函数代码示例

本文整理汇总了C++中GetExceptionInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetExceptionInfo函数的具体用法?C++ GetExceptionInfo怎么用?C++ GetExceptionInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetExceptionInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initGraphicsMagick

void ScImgDataLoader_GMagick::loadEmbeddedProfile(const QString& fn, int /*page*/)
{
	initGraphicsMagick();
	m_embeddedProfile.resize(0);
	m_profileComponents = 0;
	if (!QFile::exists(fn)) return;

	ExceptionInfo exception;
	GetExceptionInfo(&exception);
	ImageInfo *image_info = CloneImageInfo(0);
	strcpy(image_info->filename, fn.toUtf8().data());
	image_info->units = PixelsPerInchResolution;
	Image *image = ReadImage(image_info, &exception);
	if (exception.severity != UndefinedException)
		CatchException(&exception);
	if (!image) {
		qCritical() << "Failed to read image" << fn;
		return;
	}

	size_t length = 0;
	const unsigned char *src = GetImageProfile(image, "ICM", &length);
	char *dest = m_embeddedProfile.data();

	if (image->colorspace == CMYKColorspace) {
		m_profileComponents = 4;
	} else if (image->colorspace == RGBColorspace) {
		m_profileComponents = 3;
	}

	m_embeddedProfile.resize(length);
	memcpy(dest, src, length);
}
开发者ID:Sheikha443,项目名称:scribus,代码行数:33,代码来源:scimgdataloader_gmagick.cpp

示例2: exmagick_init_handle

static
ERL_NIF_TERM exmagick_init_handle (ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
  ERL_NIF_TERM result;

  EXM_INIT;
  ErlNifResourceType *type = (ErlNifResourceType *) enif_priv_data(env);
  exm_resource_t *resource = enif_alloc_resource(type, sizeof(exm_resource_t));
  if (resource == NULL)
  { EXM_FAIL(ehandler, "enif_alloc_resource"); }

  /* initializes exception to default values (badly named function) */
  GetExceptionInfo(&resource->e_info);

  resource->image  = NULL;
  resource->i_info = CloneImageInfo(0);
  if (resource->i_info == NULL)
  { EXM_FAIL(ehandler, "CloneImageInfo"); }

  result = enif_make_resource(env, (void *) resource);
  enif_release_resource(resource);
  return(enif_make_tuple2(env, enif_make_atom(env, "ok"), result));

ehandler:
  if (resource != NULL)
  {
    if (resource->i_info != NULL)
    { DestroyImageInfo(resource->i_info); }
    enif_release_resource(resource);
  }
  return(enif_make_tuple2(env, enif_make_atom(env, "error"), exmagick_make_utf8str(env, errmsg)));
}
开发者ID:Xerpa,项目名称:exmagick,代码行数:32,代码来源:exmagick.c

示例3: Info_format_eq

/*
    Method:     Info#format=
    Purpose:    Set the image encoding format
*/
VALUE
Info_format_eq(VALUE self, VALUE magick)
{
    Info *info;
    const MagickInfo *m;
    char *mgk;
    ExceptionInfo exception;

    Data_Get_Struct(self, Info, info);

    GetExceptionInfo(&exception);

    mgk = StringValuePtr(magick);
    m = GetMagickInfo(mgk, &exception);
    CHECK_EXCEPTION()
    (void) DestroyExceptionInfo(&exception);

    if (!m)
    {
        rb_raise(rb_eArgError, "unknown format: %s", mgk);
    }

    strncpy(info->magick, m->name, MaxTextExtent-1);
    return self;
}
开发者ID:AzkaarAli,项目名称:leihs,代码行数:29,代码来源:rminfo.c

示例4: gm_auto_orient_image

/* auto orient image */
ngx_int_t 
gm_auto_orient_image(ngx_http_request_t *r, void *option, Image **image)
{
    ExceptionInfo                      exception;

    Image                             *orient_image = NULL;

    dd("starting auto orient");

    GetExceptionInfo(&exception);
    orient_image=AutoOrientImage(*image,(*image)->orientation, &exception);

    if (orient_image == (Image *) NULL) {
        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                "gm filter: auto orient image failed, "
                "severity: \"%O\" "
                "reason: \"%s\", description: \"%s\"",
                exception.severity, exception.reason, exception.description);

        DestroyExceptionInfo(&exception);

        return NGX_ERROR;
    }

    DestroyImage(*image);
    *image = orient_image;
    DestroyExceptionInfo(&exception);

    return NGX_OK;
}
开发者ID:believe3301,项目名称:ngx-gm-filter,代码行数:31,代码来源:ngx_http_gm_filter_auto_orient.c

示例5: appendImageBytesToRaw

void    appendImageBytesToRaw(int fd, char * file) {
    Image *img = get_image_from_path(file);

    unsigned char   *pixel_map = NULL;
    size_t pixel_map_size = img->columns * img->rows * sizeof(*pixel_map);
    pixel_map = malloc(pixel_map_size);
    unsigned int    x = 0;
    unsigned int    y = 0;
    int             width = (int)img->columns;
    int             height = (int)img->rows;
    PixelPacket     *px;
    ExceptionInfo	exception;

    GetExceptionInfo(&exception);

    px = GetImagePixels(img, 0, 0, img->columns, img->rows);

    while (y < height) {
        x = 0;
        while (x < width) {
            pixel_map[(width * y) + x] = (char)px[(width * y) + x].green;
            x++;
        }
        y++;
    }
    write(fd, pixel_map, pixel_map_size);
    free(pixel_map);
    DestroyImage(img);

}
开发者ID:chongbingbao,项目名称:TissueReconstruction,代码行数:30,代码来源:raw_files.c

示例6: NewMagickWand

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   N e w M a g i c k W a n d                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  NewMagickWand() returns a wand required for all other methods in the API.
%
%  The format of the NewMagickWand method is:
%
%      MagickWand *NewMagickWand(void)
%
*/
WandExport MagickWand *NewMagickWand(void)
{
  const char
    *quantum;

  MagickWand
    *wand;

  unsigned long
    depth;

  depth=QuantumDepth;
  quantum=GetMagickQuantumDepth(&depth);
  if (depth != QuantumDepth)
    ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
  wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand));
  if (wand == (MagickWand *) NULL)
    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
      strerror(errno));
  (void) ResetMagickMemory(wand,0,sizeof(*wand));
  wand->id=AcquireWandId();
  (void) FormatMagickString(wand->name,MaxTextExtent,"%s-%lu",MagickWandId,
    wand->id);
  GetExceptionInfo(&wand->exception);
  wand->image_info=CloneImageInfo((ImageInfo *) NULL);
  wand->quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
  wand->images=NewImageList();
  wand->debug=IsEventLogging();
  if (wand->debug != MagickFalse)
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  wand->signature=MagickSignature;
  return(wand);
}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:51,代码来源:magick-wand.c

示例7: main

int main ( int argc, char **argv )
{
  Image *canvas = (Image *)NULL;
  char outfile[MaxTextExtent];
  int rows, columns = 0;
  char size[MaxTextExtent];
  ImageInfo *image_info;
  ExceptionInfo exception;

  if ( argc != 2 )
    {
      (void) printf ( "Usage: %s filename\n", argv[0] );
      exit( 1 );
    }

  outfile[MaxTextExtent-1]='\0';
  (void) strncpy( outfile, argv[1], MaxTextExtent-1 );

  if (LocaleNCompare("drawtest",argv[0],7) == 0)
    InitializeMagick((char *) NULL);
  else
    InitializeMagick(*argv);

  /*
   * Create canvas image
   */
  columns=596;
  rows=842;
  image_info=CloneImageInfo((ImageInfo*)NULL);
  GetExceptionInfo( &exception );
  FormatString(size, "%dx%d", columns, rows);
  (void) CloneString(&image_info->size, size);
  (void) strcpy( image_info->filename, "xc:white");
  canvas = ReadImage ( image_info, &exception );
  if (exception.severity != UndefinedException)
    CatchException(&exception);
  if ( canvas == (Image *)NULL )
    {
      (void) printf ( "Failed to read canvas image %s\n", image_info->filename );
      exit(1);
    }

  /*
   * Scribble on image
   */
  ScribbleImage( canvas );

  /*
   * Save image to file
   */
  canvas->filename[MaxTextExtent-1]='\0';
  (void) strncpy( canvas->filename, outfile, MaxTextExtent-1);
  (void) WriteImage ( image_info, canvas );

  DestroyExceptionInfo( &exception );
  DestroyImage( canvas );
  DestroyImageInfo( image_info );
  DestroyMagick();
  return 0;
}
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:60,代码来源:drawtest.c

示例8: throw

Image::Image( uint32 width, uint32 height,
              const char* map, 
              StorageType storage,
              const void* pixels ) throw (GSystem::Exception):
   m_image( NULL ) {

   // initialize exception
   ExceptionInfo exception;
   GetExceptionInfo( &exception );

   m_image = ConstituteImage( width, height, map, storage,
                              pixels, &exception );
   if ( m_image == NULL ) {
      MC2String exceptionString = "Reason: ";
      exceptionString += exception.reason;
      exceptionString += "Description: ";
      exceptionString += exception.description;

      DestroyExceptionInfo( &exception );

      throw GSystem::Exception( "[ImageMagick]" + exceptionString );
   }
   DestroyExceptionInfo( &exception );

   GetQuantizeInfo(&m_quantizeInfo);
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:26,代码来源:ImageMagick.cpp

示例9: ImageList_fx

/*
    Method:     ImageList#fx(expression[, channel...])
*/
VALUE
ImageList_fx(int argc, VALUE *argv, VALUE self)
{
    Image *images, *new_image;
    char *expression;
    ChannelType channels;
    ExceptionInfo exception;


    channels = extract_channels(&argc, argv);

    // There must be exactly 1 remaining argument.
    if (argc == 0)
    {
        rb_raise(rb_eArgError, "wrong number of arguments (0 for 1 or more)");
    }
    else if (argc > 1)
    {
        raise_ChannelType_error(argv[argc-1]);
    }

    expression = StringValuePtr(argv[0]);

    images = images_from_imagelist(self);
    GetExceptionInfo(&exception);
    new_image = FxImageChannel(images, channels, expression, &exception);
    rm_split(images);
    rm_check_exception(&exception, new_image, DestroyOnError);
    (void) DestroyExceptionInfo(&exception);

    rm_ensure_result(new_image);

    return rm_image_new(new_image);
}
开发者ID:Des,项目名称:your_app_name,代码行数:37,代码来源:rmilist.c

示例10: GetImageInfo

pair< unsigned char*, int >
Image::getBuffer() {
   size_t size = 0;
   ::ImageInfo info;
   GetImageInfo( &info );
   ExceptionInfo exception;
   GetExceptionInfo( &exception );

   unsigned char* blob = ImageToBlob( &info, m_image, &size,
                                      &exception );
   if ( blob == NULL ) {
      MC2String exceptionString = "Reason: ";
      exceptionString += exception.reason;
      exceptionString += "Description: ";
      exceptionString += exception.description;

      DestroyExceptionInfo( &exception );

      throw GSystem::Exception( "[ImageMagick]" + exceptionString );
   }

   DestroyExceptionInfo( &exception );

   return make_pair( blob, size );
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:25,代码来源:ImageMagick.cpp

示例11: ImageList_morph

/*
    Method:     ImageList#morph(number_images)
    Purpose:    requires a minimum of two images. The first image is
                transformed into the second by a number of intervening images
                as specified by "number_images".
    Returns:    a new Image with the images array set to the morph sequence.
                @scenes = 0
*/
VALUE
ImageList_morph(VALUE self, VALUE nimages)
{
    Image *images, *new_images;
    ExceptionInfo exception;
    long number_images;


    // Use a signed long so we can test for a negative argument.
    number_images = NUM2LONG(nimages);
    if (number_images <= 0)
    {
        rb_raise(rb_eArgError, "number of intervening images must be > 0");
    }

    GetExceptionInfo(&exception);
    images = images_from_imagelist(self);
    new_images = MorphImages(images, (unsigned long)number_images, &exception);
    rm_split(images);
    rm_check_exception(&exception, new_images, DestroyOnError);
    (void) DestroyExceptionInfo(&exception);

    rm_ensure_result(new_images);

    return rm_imagelist_from_images(new_images);
}
开发者ID:Des,项目名称:your_app_name,代码行数:34,代码来源:rmilist.c

示例12: set_color_option

/*
    Static:     set_color_option
    Purpose:    Set a color name as the value of the specified option
    Note:       Call QueryColorDatabase to validate color name
*/
static VALUE set_color_option(VALUE self, const char *option, VALUE color)
{
    Info *info;
    char *name;
    PixelPacket pp;
    ExceptionInfo exception;
    MagickBooleanType okay;

    Data_Get_Struct(self, Info, info);

    if (NIL_P(color))
    {
        (void) RemoveImageOption(info, option);
    }
    else
    {
        GetExceptionInfo(&exception);
        name = StringValuePtr(color);
        okay = QueryColorDatabase(name, &pp, &exception);
        (void) DestroyExceptionInfo(&exception);
        if (!okay)
        {
            rb_raise(rb_eArgError, "invalid color name `%s'", name);
        }

        (void) RemoveImageOption(info, option);
        (void) SetImageOption(info, option, name);
    }

    return self;
}
开发者ID:AzkaarAli,项目名称:leihs,代码行数:36,代码来源:rminfo.c

示例13: GetExceptionInfo

Image		*get_image_from_path(char *path)
{
    ImageInfo	*image_info;
    Image		*img = NULL;
    ExceptionInfo	exception;
    
    GetExceptionInfo(&exception);
    if ((image_info = CloneImageInfo((ImageInfo *)NULL)) == NULL) {
        CatchException(&exception);
        DestroyImageInfo(image_info);
        DestroyImage(img);
        return (NULL);
    }
    
    strcpy(image_info->filename, path);
    
    if ((img = ReadImage(image_info, &exception)) == NULL)
    {
        CatchException(&exception);
        DestroyImageInfo(image_info);
        DestroyImage(img);
        return (NULL);
    }
    DestroyImageInfo(image_info);
    return (img);
}
开发者ID:adamlin,项目名称:TissueReconstruction,代码行数:26,代码来源:max_contrast.c

示例14: malloc

Image       *get_threshold_image(Image *img, c_threshold *c)
{
    Image       *threshold_img;
    int         size_x, size_y;
    int         i = 0;
    int         j = 0;
    char        *string_img = malloc(img->rows * img->columns * sizeof(*string_img));
    char        *temp_string_img;
    PixelPacket	*px;
    ExceptionInfo	exception;
    
    GetExceptionInfo(&exception);

    px = GetImagePixels(img, 0, 0, img->columns, img->rows);
    size_x = (int)img->columns;
    size_y = (int)img->rows;
    
    while (i < size_y) {
        j=0;
        while (j < size_x) {
            string_img[(size_x * i) + j] = (char)px[(size_x * i) + j].green;
            j++;
        }
        i++;
    }
    temp_string_img = otsu_th(size_x, size_y, string_img, c);
    
    threshold_img = ConstituteImage(size_x, size_y, "I", CharPixel, temp_string_img, &exception);
    free(temp_string_img);
    free(string_img);

    DestroyImage(img);
    SyncImagePixels(threshold_img);
    return (threshold_img);
}
开发者ID:adamlin,项目名称:TissueReconstruction,代码行数:35,代码来源:max_contrast.c

示例15: 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 == MagickSignature);
  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",
      strerror(errno));
  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
  clone_wand->id=AcquireWandId();
  (void) FormatMagickString(clone_wand->name,MaxTextExtent,"MagickWand-%lu",
    clone_wand->id);
  GetExceptionInfo(&clone_wand->exception);
  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=MagickSignature;
  return(clone_wand);
}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:51,代码来源:magick-wand.c


注:本文中的GetExceptionInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。