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


Golang C.ulong函数代码示例

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


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

示例1: AdaptiveResize

// Adaptively changes the size of the canvas, returns true on success.
func (cv Canvas) AdaptiveResize(width uint, height uint) bool {
	status := C.MagickAdaptiveResizeImage(cv.wand, C.ulong(width), C.ulong(height))
	if status == C.MagickFalse {
		return false
	}
	return true
}
开发者ID:vuleetu,项目名称:canvas,代码行数:8,代码来源:canvas.go

示例2: ResizeBlur

// ResizeBlur returns a new image resized to the given dimensions using the provided
// filter and blur factor (where > 1 is blurry, < 1 is sharp). If width or height is
// < 0, it's calculated proportionally to the other dimension. If both of them are < 0,
// an error is returned.
func (im *Image) ResizeBlur(width, height int, filter Filter, blur float64) (*Image, error) {
	var data C.ResizeData
	if width < 0 {
		if height < 0 {
			return nil, fmt.Errorf("invalid resize %dx%d", width, height)
		}
		h := float64(im.Height())
		var ratio float64
		if h != 0 {
			ratio = float64(im.Width()) / h
		}
		width = int(float64(height) * ratio)
	}
	if height < 0 {
		if width < 0 {
			return nil, fmt.Errorf("invalid resize %dx%d", width, height)
		}
		var ratio float64
		w := float64(im.Width())
		if w != 0 {
			ratio = float64(im.Height()) / w
		}
		height = int(float64(width) * ratio)
	}
	data.columns = C.ulong(width)
	data.rows = C.ulong(height)
	data.filter = C.FilterTypes(filter)
	data.blur = C.double(blur)
	return im.applyDataFunc("resizing", C.ImageDataFunc(C.resizeImage), &data)
}
开发者ID:Kimbsen,项目名称:magick,代码行数:34,代码来源:resize.go

示例3: Extract

// Extract runs the extractor and returns a slice of Entities found in the
// given tokens.
func (ext *Extractor) Extract(tokens []string) ([]Entity, error) {
	ctokens := C.ner_arr_make(C.int(len(tokens)) + 1) // NULL termination
	defer C.ner_arr_free(ctokens, C.int(len(tokens))+1)
	for i, t := range tokens {
		cs := C.CString(t) // released by ner_arr_free
		C.ner_arr_set(ctokens, cs, C.int(i))
	}

	dets := C.mitie_extract_entities(ext.ner, ctokens)
	defer C.mitie_free(unsafe.Pointer(dets))
	if dets == nil {
		return nil, ErrMemory
	}

	n := int(C.mitie_ner_get_num_detections(dets))
	entities := make([]Entity, n, n)

	for i := 0; i < n; i++ {
		pos := int(C.mitie_ner_get_detection_position(dets, C.ulong(i)))
		len := int(C.mitie_ner_get_detection_length(dets, C.ulong(i)))

		entities[i] = Entity{
			Tag:   int(C.mitie_ner_get_detection_tag(dets, C.ulong(i))),
			Score: float64(C.mitie_ner_get_detection_score(dets, C.ulong(i))),
			Name:  strings.Join(tokens[pos:pos+len], " "),
			Range: Range{pos, pos + len},
		}
	}
	return entities, nil
}
开发者ID:sbl,项目名称:ner,代码行数:32,代码来源:ner.go

示例4: Crop

// Extracts a region from the canvas.
func (cv Canvas) Crop(x int, y int, width uint, height uint) bool {
	status := C.MagickCropImage(cv.wand, C.ulong(width), C.ulong(height), C.long(x), C.long(y))
	if status == C.MagickFalse {
		return false
	}
	return true
}
开发者ID:vuleetu,项目名称:canvas,代码行数:8,代码来源:canvas.go

示例5: Blank

// Creates an empty canvas of the given dimensions.
func (cv Canvas) Blank(width uint, height uint) bool {
	status := C.MagickNewImage(cv.wand, C.ulong(width), C.ulong(height), cv.bg)
	if status == C.MagickFalse {
		return false
	}
	return true
}
开发者ID:vuleetu,项目名称:canvas,代码行数:8,代码来源:canvas.go

示例6: ResizeWithFilter

// Changes the size of the canvas using specified filter and blur, returns true on success.
func (self *Canvas) ResizeWithFilter(width uint, height uint, filter uint, blur float32) error {
	if width == 0 && height == 0 {
		return fmt.Errorf("Please specify at least one of dimensions")
	}

	if width == 0 || height == 0 {
		origHeight := uint(C.MagickGetImageHeight(self.wand))
		origWidth := uint(C.MagickGetImageWidth(self.wand))

		if width == 0 {
			ratio := float32(origHeight) / float32(height)
			width = uint(float32(origWidth) / ratio)
		}
		if height == 0 {
			ratio := float32(origWidth) / float32(width)
			height = uint(float32(origHeight) / ratio)
		}
	}

	success := C.MagickResizeImage(self.wand, C.ulong(width), C.ulong(height), C.FilterTypes(filter), C.double(blur))

	if success == C.MagickFalse {
		return fmt.Errorf("Could not resize: %s", self.Error())
	}

	return nil
}
开发者ID:yvasiyarov,项目名称:canvas,代码行数:28,代码来源:canvas.go

示例7: Resize

// Changes the size of the canvas, returns true on success.
func (cv Canvas) Resize(width uint, height uint) bool {
	status := C.MagickResizeImage(cv.wand, C.ulong(width), C.ulong(height), C.GaussianFilter, C.double(1.0))
	if status == C.MagickFalse {
		return false
	}
	return true
}
开发者ID:vuleetu,项目名称:canvas,代码行数:8,代码来源:canvas.go

示例8: ResizeBlur

// ResizeBlur returns a new image resized to the given dimensions using the provided
// filter and blur factor (where > 1 is blurry, < 1 is sharp).
func (im *Image) ResizeBlur(width, height int, filter Filter, blur float64) (*Image, error) {
	var data C.ResizeData
	data.columns = C.ulong(width)
	data.rows = C.ulong(height)
	data.filter = C.FilterTypes(filter)
	data.blur = C.double(blur)
	return im.applyDataFunc("resizing", C.ImageDataFunc(C.resizeImage), &data)
}
开发者ID:kitak,项目名称:magick,代码行数:10,代码来源:resize.go

示例9: Call

func Call(p, a1, a2, a3 uintptr) uintptr {
	ret := C.dlcall(
		C.ulong(p),
		C.ulong(a1),
		C.ulong(a2),
		C.ulong(a3))
	return uintptr(ret)
}
开发者ID:mattn,项目名称:go-dl,代码行数:8,代码来源:dl_unix.go

示例10: AdaptiveResize

// Adaptively changes the size of the canvas, returns true on success.
func (self Canvas) AdaptiveResize(width uint, height uint) error {
	success := C.MagickAdaptiveResizeImage(self.wand, C.ulong(width), C.ulong(height))

	if success == C.MagickFalse {
		return fmt.Errorf("Could not resize: %s", self.Error())
	}

	return nil
}
开发者ID:jmrobles,项目名称:canvas,代码行数:10,代码来源:canvas.go

示例11: Blank

// Creates an empty canvas of the given dimensions.
func (self Canvas) Blank(width uint, height uint) error {
	success := C.MagickNewImage(self.wand, C.ulong(width), C.ulong(height), self.bg)

	if success == C.MagickFalse {
		return fmt.Errorf("Could not create image: %s", self.Error())
	}

	return nil
}
开发者ID:jmrobles,项目名称:canvas,代码行数:10,代码来源:canvas.go

示例12: Crop

// Extracts a region from the canvas.
func (self Canvas) Crop(x int, y int, width uint, height uint) error {
	success := C.MagickCropImage(self.wand, C.ulong(width), C.ulong(height), C.long(x), C.long(y))

	if success == C.MagickFalse {
		return fmt.Errorf("Could not crop: %s", self.Error())
	}

	return nil
}
开发者ID:jmrobles,项目名称:canvas,代码行数:10,代码来源:canvas.go

示例13: fastHMAC

func fastHMAC(msg, key []byte) []byte {
	toret := make([]byte, 512/8)
	thing := C.ulong(512 / 8)
	C.hmac_memory(sha512idx,
		unsafe_bytes(key), C.ulong(len(key)),
		unsafe_bytes(msg), C.ulong(len(msg)),
		unsafe_bytes(toret), (&thing))
	return toret
}
开发者ID:kaustavha,项目名称:kirisurf,代码行数:9,代码来源:tomcrypt_linux_386.go

示例14: Resize

// Changes the size of the canvas, returns true on success.
func (self Canvas) Resize(width uint, height uint) error {
	success := C.MagickResizeImage(self.wand, C.ulong(width), C.ulong(height), C.GaussianFilter, C.double(1.0))

	if success == C.MagickFalse {
		return fmt.Errorf("Could not resize: %s", self.Error())
	}

	return nil
}
开发者ID:jmrobles,项目名称:canvas,代码行数:10,代码来源:canvas.go

示例15: SetBit

// SetBit sets z to x, with x's i'th bit set to b (0 or 1).
// That is, if b is 1 SetBit sets z = x | (1 << i);
// if b is 0 SetBit sets z = x &^ (1 << i). If b is not 0 or 1,
// SetBit will panic.
func (z *Int) SetBit(x *Int, i int, b uint) *Int {
	if z != x {
		z.Set(x)
	}
	if b == 0 {
		C._mpz_clrbit(&z.i[0], C.ulong(i))
	} else {
		C._mpz_setbit(&z.i[0], C.ulong(i))
	}
	return z
}
开发者ID:locusf,项目名称:gmp,代码行数:15,代码来源:int.go


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