1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2014 Google Inc. 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci * found in the LICENSE file. 6cb93a386Sopenharmony_ci */ 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL 9cb93a386Sopenharmony_ci// DO NOT USE -- FOR INTERNAL TESTING ONLY 10cb93a386Sopenharmony_ci 11cb93a386Sopenharmony_ci#ifndef sk_surface_DEFINED 12cb93a386Sopenharmony_ci#define sk_surface_DEFINED 13cb93a386Sopenharmony_ci 14cb93a386Sopenharmony_ci#include "include/c/sk_types.h" 15cb93a386Sopenharmony_ci 16cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_BEGIN_GUARD 17cb93a386Sopenharmony_ci 18cb93a386Sopenharmony_ci/** 19cb93a386Sopenharmony_ci Return a new surface, with the memory for the pixels automatically 20cb93a386Sopenharmony_ci allocated. If the requested surface cannot be created, or the 21cb93a386Sopenharmony_ci request is not a supported configuration, NULL will be returned. 22cb93a386Sopenharmony_ci 23cb93a386Sopenharmony_ci @param sk_imageinfo_t* Specify the width, height, color type, and 24cb93a386Sopenharmony_ci alpha type for the surface. 25cb93a386Sopenharmony_ci 26cb93a386Sopenharmony_ci @param sk_surfaceprops_t* If not NULL, specify additional non-default 27cb93a386Sopenharmony_ci properties of the surface. 28cb93a386Sopenharmony_ci*/ 29cb93a386Sopenharmony_ciSK_API sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*, const sk_surfaceprops_t*); 30cb93a386Sopenharmony_ci 31cb93a386Sopenharmony_ci/** 32cb93a386Sopenharmony_ci Create a new surface which will draw into the specified pixels 33cb93a386Sopenharmony_ci with the specified rowbytes. If the requested surface cannot be 34cb93a386Sopenharmony_ci created, or the request is not a supported configuration, NULL 35cb93a386Sopenharmony_ci will be returned. 36cb93a386Sopenharmony_ci 37cb93a386Sopenharmony_ci @param sk_imageinfo_t* Specify the width, height, color type, and 38cb93a386Sopenharmony_ci alpha type for the surface. 39cb93a386Sopenharmony_ci @param void* pixels Specify the location in memory where the 40cb93a386Sopenharmony_ci destination pixels are. This memory must 41cb93a386Sopenharmony_ci outlast this surface. 42cb93a386Sopenharmony_ci @param size_t rowBytes Specify the difference, in bytes, between 43cb93a386Sopenharmony_ci each adjacent row. Should be at least 44cb93a386Sopenharmony_ci (width * sizeof(one pixel)). 45cb93a386Sopenharmony_ci @param sk_surfaceprops_t* If not NULL, specify additional non-default 46cb93a386Sopenharmony_ci properties of the surface. 47cb93a386Sopenharmony_ci*/ 48cb93a386Sopenharmony_ciSK_API sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*, 49cb93a386Sopenharmony_ci void* pixels, size_t rowBytes, 50cb93a386Sopenharmony_ci const sk_surfaceprops_t* props); 51cb93a386Sopenharmony_ci 52cb93a386Sopenharmony_ci/** 53cb93a386Sopenharmony_ci Decrement the reference count. If the reference count is 1 before 54cb93a386Sopenharmony_ci the decrement, then release both the memory holding the 55cb93a386Sopenharmony_ci sk_surface_t and any pixel memory it may be managing. New 56cb93a386Sopenharmony_ci sk_surface_t are created with a reference count of 1. 57cb93a386Sopenharmony_ci*/ 58cb93a386Sopenharmony_ciSK_API void sk_surface_unref(sk_surface_t*); 59cb93a386Sopenharmony_ci 60cb93a386Sopenharmony_ci/** 61cb93a386Sopenharmony_ci * Return the canvas associated with this surface. Note: the canvas is owned by the surface, 62cb93a386Sopenharmony_ci * so the returned object is only valid while the owning surface is valid. 63cb93a386Sopenharmony_ci */ 64cb93a386Sopenharmony_ciSK_API sk_canvas_t* sk_surface_get_canvas(sk_surface_t*); 65cb93a386Sopenharmony_ci 66cb93a386Sopenharmony_ci/** 67cb93a386Sopenharmony_ci * Call sk_image_unref() when the returned image is no longer used. 68cb93a386Sopenharmony_ci */ 69cb93a386Sopenharmony_ciSK_API sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*); 70cb93a386Sopenharmony_ci 71cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_END_GUARD 72cb93a386Sopenharmony_ci 73cb93a386Sopenharmony_ci#endif 74