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


Golang C.DestroyExceptionInfo函数代码示例

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


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

示例1: FloatMatrix

// FloatMatrix returns an Image in the GRAY colorspace as FloatMatrix,
// where each pixel represents an element of the matrix. Each element
// is normalized to the [0,1] range.
func (im *Image) FloatMatrix() (FloatMatrix, error) {
	if im.Colorspace() != GRAY {
		return nil, fmt.Errorf("FloatMatrix() is available only for GRAY images, this one is in %s", im.Colorspace())
	}
	width := im.Width()
	height := im.Height()
	ptrs := make([]*C.double, width)
	for ii := range ptrs {
		ptrs[ii] = allocDoublePtr(height)
	}
	defer func() {
		for _, p := range ptrs {
			freeDoublePtr(p)
		}
	}()
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	C.image_matrix(im.image, (**C.double)(unsafe.Pointer(&ptrs[0])), &ex)
	if ex.severity != C.UndefinedException {
		return nil, exError(&ex, "generating float matrix")
	}
	m := make([][]float64, width)
	for ii := range m {
		m[ii] = doublePtrToFloat64Slice(ptrs[ii], height)
	}
	return FloatMatrix(m), nil
}
开发者ID:rainycape,项目名称:magick,代码行数:31,代码来源:matrix.go

示例2: main

func main() {
	// Some GraphicsMagick boilerplate
	C.InitializeMagick(nil)
	defer C.DestroyMagick()
	C.GetExceptionInfo(&exceptionInfo)
	imageInfo = C.CloneImageInfo(nil)
	defer C.DestroyExceptionInfo(&exceptionInfo)
	defer C.DestroyImageInfo(imageInfo)

	// main OMIT

	Show("./cgo/armed_gopher.jpg")

	img, err := Read("./cgo/armed_gopher.jpg")
	if err != nil {
		fmt.Println(err)
		return
	}

	if img, err = Resize(img, 200, 800); err != nil {
		fmt.Println("resize error:", err)
		return
	}

	if err = Save(img, "./cgo/resized_gopher.jpg"); err != nil {
		fmt.Println("save error:", err)
		return
	}

	Show("./cgo/resized_gopher.jpg")
}
开发者ID:jbardin,项目名称:go_talks,代码行数:31,代码来源:resize.go

示例3: fn

func (im *Image) fn(what string, f C.ImageFunc) (*Image, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	res := C.bridge_image_func(f, im.image, &ex)
	return checkImage(res, nil, &ex, what)
}
开发者ID:roylou,项目名称:magick,代码行数:7,代码来源:bridge.go

示例4: Roll

func (im *Image) Roll(xoffset, yoffset int) (*Image, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	rolled := C.RollImage(im.image, magickLong(xoffset), magickLong(yoffset), &ex)
	return checkImage(rolled, nil, &ex, "rolling")
}
开发者ID:kilnyy,项目名称:magick,代码行数:7,代码来源:transform.go

示例5: Composite

// Composite modifies the image, drawing the draw Image argument at offset
// (x, y) using the c Composite operation.
func (im *Image) Composite(c Composite, draw *Image, x int, y int) error {
	op, err := im.compositeOperator(c)
	if err != nil {
		return err
	}
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	var data C.CompositeData
	data.composite = C.int(op)
	data.draw = draw.image
	data.x = C.int(x)
	data.y = C.int(y)
	res, err := im.applyDataFunc("compositing", C.ImageDataFunc(C.compositeImage), &data)
	// res.image will be != than im.image when im is a non
	// coalesced animation
	if res.image != im.image {
		unrefImages(im.image)
		initializeRefCounts(res.image)
		refImages(res.image)
		im.image = res.image
		dontFree(res)
	}
	return err
}
开发者ID:Kimbsen,项目名称:magick,代码行数:27,代码来源:composite.go

示例6: IsPalette

func (im *Image) IsPalette() (bool, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	b := C.IsPaletteImage(im.image, &ex)
	if ex.severity != C.UndefinedException {
		return false, exError(&ex, "getting isPalette")
	}
	return int(b) != 0, nil
}
开发者ID:Kimbsen,项目名称:magick,代码行数:10,代码来源:color.go

示例7: NColors

func (im *Image) NColors() (int, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	val := C.GetNumberColors(im.image, nil, &ex)
	if ex.severity != C.UndefinedException {
		return 0, exError(&ex, "getting colors")
	}
	return int(val), nil
}
开发者ID:Kimbsen,项目名称:magick,代码行数:10,代码来源:color.go

示例8: Negate

// Negate inverts the colors in the image
func (im *MagickImage) Negate() (err error) {
	exception := C.AcquireExceptionInfo()
	defer C.DestroyExceptionInfo(exception)
	new_image := C.Negate(im.Image, exception)
	if failed := C.CheckException(exception); failed == C.MagickTrue {
		return ErrorFromExceptionInfo(exception)
	}
	im.ReplaceImage(new_image)
	return nil
}
开发者ID:mat,项目名称:magick,代码行数:11,代码来源:magick.go

示例9: ChannelDepth

// ChannelDepth returns the depth of the given channel.
func (im *Image) ChannelDepth(ch Channel) (uint, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	ret := C.GetImageChannelDepth(im.image, C.ChannelType(ch), &ex)
	if ex.severity != C.UndefinedException {
		return 0, exError(&ex, "getting channel info")
	}
	return uint(ret), nil
}
开发者ID:nicolasroy,项目名称:magick,代码行数:11,代码来源:channel.go

示例10: statistics

func (im *Image) statistics() (*Statistics, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	var stats C.ImageStatistics
	C.GetImageStatistics(im.image, &stats, &ex)
	if ex.severity != C.UndefinedException {
		return nil, exError(&ex, "getting statistics")
	}
	return newStatistics(&stats), nil
}
开发者ID:Kimbsen,项目名称:magick,代码行数:11,代码来源:statistics_gm.go

示例11: ParseGeometryToRectangleInfo

// ParseGeometryToRectangleInfo converts from a geometry string (WxH+X+Y) into a Magick
// RectangleInfo that contains the individual properties
func (im *MagickImage) ParseGeometryToRectangleInfo(geometry string) (info C.RectangleInfo, err error) {
	c_geometry := C.CString(geometry)
	defer C.free(unsafe.Pointer(c_geometry))
	exception := C.AcquireExceptionInfo()
	defer C.DestroyExceptionInfo(exception)
	C.ParseRegionGeometry(im.Image, c_geometry, &info, exception)
	if failed := C.CheckException(exception); failed == C.MagickTrue {
		err = ErrorFromExceptionInfo(exception)
	}
	return
}
开发者ID:mat,项目名称:magick,代码行数:13,代码来源:magick.go

示例12: IntegralRotateImage

// IntegralRotateImage rotates the image an integral of 90 degrees
func (im *MagickImage) IntegralRotateImage(rotations int) (err error) {
	exception := C.AcquireExceptionInfo()
	defer C.DestroyExceptionInfo(exception)

	new_image := C.IntegralRotateImage(im.Image, C.size_t(rotations), exception)
	if failed := C.CheckException(exception); failed == C.MagickTrue {
		return ErrorFromExceptionInfo(exception)
	}
	im.ReplaceImage(new_image)
	return nil
}
开发者ID:mat,项目名称:magick,代码行数:12,代码来源:magick.go

示例13: applyFunc

func (im *Image) applyFunc(what string, f C.ImageFunc) (*Image, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	res := C.apply_image_func(f, im.root(), unsafe.Pointer(im.parent), btoi(im.coalesced), &ex)
	if res == nil {
		return nil, exError(&ex, what)
	}
	ret := newImage(res, nil)
	ret.coalesced = true
	return ret, nil
}
开发者ID:kitak,项目名称:magick,代码行数:12,代码来源:bridge.go

示例14: FillBackgroundColor

// FillBackgroundColor fills transparent areas of an image with a solid color and stores the filled image in place.
// color can be any color format that image magick understands, see: http://www.imagemagick.org/ImageMagick-7.0.0/script/color.php#models
func (im *MagickImage) FillBackgroundColor(color string) (err error) {
	exception := C.AcquireExceptionInfo()
	defer C.DestroyExceptionInfo(exception)
	c_color := C.CString(color)
	defer C.free(unsafe.Pointer(c_color))
	new_image := C.FillBackgroundColor(im.Image, c_color, exception)
	if failed := C.CheckException(exception); failed == C.MagickTrue {
		return ErrorFromExceptionInfo(exception)
	}
	im.ReplaceImage(new_image)
	return nil
}
开发者ID:mat,项目名称:magick,代码行数:14,代码来源:magick.go

示例15: Clone

// Clone returns a copy of the image. If the image
// has multiple frames, it copies all of them. To
// Clone just one frame use im.Frame(i).Clone().
func (im *Image) Clone() (*Image, error) {
	var ex C.ExceptionInfo
	C.GetExceptionInfo(&ex)
	defer C.DestroyExceptionInfo(&ex)
	var image *C.Image
	if im.parent == nil {
		image = C.CloneImageList(im.image, &ex)
	} else {
		image = C.CloneImage(im.image, magickSize(0), magickSize(0), 1, &ex)
	}
	return checkImage(image, nil, &ex, "cloning")
}
开发者ID:kitak,项目名称:magick,代码行数:15,代码来源:image.go


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