示例#1
0
文件: id.go 项目: jimmyfrasche/cairo
func patternSetSubtypeID(p *C.cairo_pattern_t, s subtypeID) {
	if fontType(C.cairo_pattern_get_type(p)) != PatternTypeRasterSource {
		panic("pattern is not a raster pattern")
	}
	if C.cairo_pattern_get_user_data(p, stkey) != nil {
		panic("pattern already has subtype set")
	}
	C.cairo_pattern_set_user_data(p, stkey, s.c(), free)
}
示例#2
0
文件: id.go 项目: jimmyfrasche/cairo
func patternGetSubtypeID(p *C.cairo_pattern_t) subtypeID {
	if fontType(C.cairo_pattern_get_type(p)) != PatternTypeRasterSource {
		panic("pattern is not a raster pattern")
	}
	ptr := C.cairo_pattern_get_user_data(p, stkey)
	if ptr == nil {
		panic("no subtype set: pattern not registered")
	}
	return subtypeID(ctoint(ptr))
}