Ejemplo n.º 1
0
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)
}
Ejemplo n.º 2
0
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))
}