// See cairo_image_surface_create().
//
// C API documentation: http://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-image-surface-create
502643
func ImageSurfaceCreate(format Format, width, height int) *ImageSurface {
	ret := &ImageSurface{wrapSurface(C.cairo_image_surface_create(C.cairo_format_t(format), C.int(width), C.int(height)))}
	if err := ret.status(); err != nil {
		panic(err)
	}
	return ret
}
915089
func (c *FakeImages) Create(imageResource *image.Image) (result *image.Image, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(imagesResource, imageResource), &image.Image{})
	if obj == nil {
		return nil, err
	}
	return obj.(*image.Image), err
}
1130512
func (surface *ImageSurface) GetFormat() Format {
	ret := Format(C.cairo_image_surface_get_format(surface.Ptr))
	if err := surface.status(); err != nil {
		panic(err)
	}
	return ret
}
1141242
func (d *domainClient) CreateStyleSheet(ctx context.Context, args *CreateStyleSheetArgs) (reply *CreateStyleSheetReply, err error) {
	reply = new(CreateStyleSheetReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "CSS.createStyleSheet", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "CSS.createStyleSheet", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "CSS", Op: "CreateStyleSheet", Err: err}
	}
	return
}
1177931
func PatternCreateForSurface(surface *Surface) *Pattern {
	ret := wrapPattern(C.cairo_pattern_create_for_surface(surface.Ptr))
	if err := ret.status(); err != nil {
		panic(err)
	}
	return ret
}
689153
func (c *imageStreams) Create(imageStream *image.ImageStream) (result *image.ImageStream, err error) {
	result = &image.ImageStream{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("imagestreams").
		Body(imageStream).
		Do().
		Into(result)
	return
}
158769
func (c *FakeTemplateInstances) Create(templateInstance *template.TemplateInstance) (result *template.TemplateInstance, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(templateinstancesResource, c.ns, templateInstance), &template.TemplateInstance{})

	if obj == nil {
		return nil, err
	}
	return obj.(*template.TemplateInstance), err
}
181670
func (surface *Surface) WriteToPNG(w io.Writer) error {
	data := writeClosure{w: w}
	key := goPointers.put(data)
	status := C.cairo_surface_write_to_png_stream((*C.cairo_surface_t)(surface.Ptr),
		(C.cairo_write_func_t)(unsafe.Pointer(C.gocairo_write_func)),
		unsafe.Pointer(&key))
	goPointers.clear(key)
	// TODO: which should we prefer between writeClosure.err and status?
	// Perhaps test against CAIRO_STATUS_WRITE_ERROR?  Needs a test case.
	return Status(status).toError()
}
276284
func (imd *IMDraw) MakePicture(p pixel.Picture) pixel.TargetPicture {
	return imd.batch.MakePicture(p)
}
390140
func CreateRGBSurfaceWithFormatFrom(pixels unsafe.Pointer, width, height, depth, pitch int32, format uint32) (*Surface, error) {
	surface := (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurfaceWithFormatFrom(
		pixels,
		C.int(width),
		C.int(height),
		C.int(depth),
		C.int(pitch),
		C.Uint32(format))))
	if surface == nil {
		return nil, GetError()
	}
	return surface, nil
}
182084
func NewSurface(bound *Bound, width, height int) *Surface {
	s := &Surface{
		bound:  bound.Clone(),
		Width:  width,
		Height: height,
	}

	s.Grid = make([][]float64, width)
	points := make([]float64, width*height)

	for i := range s.Grid {
		s.Grid[i], points = points[:height], points[height:]
	}

	return s
}
568111
func (surface *Surface) CopyPage() {
	C.cairo_surface_copy_page(surface.Ptr)
	if err := surface.status(); err != nil {
		panic(err)
	}
}
445492
func RegionCreate() *Region {
	ret := wrapRegion(C.cairo_region_create())
	if err := ret.status(); err != nil {
		panic(err)
	}
	return ret
}
56432
func UserFontFaceCreate() *FontFace {
	ret := wrapFontFace(C.cairo_user_font_face_create())
	if err := ret.status(); err != nil {
		panic(err)
	}
	return ret
}
795219
func NewDrawable(p image.Image) draw.Image {
	r := p.Bounds()
	if _, ok := p.(*image.Uniform); ok {
		r = image.Rect(0, 0, 1, 1)
	}
	return NewDrawableSize(p, r)
}
469091
func (client *Client) CreateImage(args *CreateImageArgs) (imageId string, err error) {
	response := &CreateImageResponse{}
	err = client.Invoke("CreateImage", args, &response)
	if err != nil {
		return "", err
	}
	return response.ImageId, nil
}
130597
func (d *Driver) createImage(task *drivers.TaskConfig, driverConfig *TaskConfig, client *docker.Client) (string, error) {
	image := driverConfig.Image
	repo, tag := parseDockerImage(image)

	callerID := fmt.Sprintf("%s-%s", task.ID, task.Name)

	// We're going to check whether the image is already downloaded. If the tag
	// is "latest", or ForcePull is set, we have to check for a new version every time so we don't
	// bother to check and cache the id here. We'll download first, then cache.
	if driverConfig.ForcePull {
		d.logger.Debug("force pulling image instead of inspecting local", "image_ref", dockerImageRef(repo, tag))
	} else if tag != "latest" {
		if dockerImage, _ := client.InspectImage(image); dockerImage != nil {
			// Image exists so just increment its reference count
			d.coordinator.IncrementImageReference(dockerImage.ID, image, callerID)
			return dockerImage.ID, nil
		}
	}

	// Load the image if specified
	if driverConfig.LoadImage != "" {
		return d.loadImage(task, driverConfig, client)
	}

	// Download the image
	return d.pullImage(task, driverConfig, client, repo, tag)
}