os/graphics/graphicscomposition/openwfcompositionengine/common/include/owfimage.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicscomposition/openwfcompositionengine/common/include/owfimage.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,604 @@
     1.4 +/* Copyright (c) 2009 The Khronos Group Inc.
     1.5 + * Portions copyright (c) 2009-2010  Nokia Corporation and/or its subsidiary(-ies)
     1.6 + *
     1.7 + * Permission is hereby granted, free of charge, to any person obtaining a
     1.8 + * copy of this software and/or associated documentation files (the
     1.9 + * "Materials"), to deal in the Materials without restriction, including
    1.10 + * without limitation the rights to use, copy, modify, merge, publish,
    1.11 + * distribute, sublicense, and/or sell copies of the Materials, and to
    1.12 + * permit persons to whom the Materials are furnished to do so, subject to
    1.13 + * the following conditions:
    1.14 + *
    1.15 + * The above copyright notice and this permission notice shall be included
    1.16 + * in all copies or substantial portions of the Materials.
    1.17 + *
    1.18 + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    1.19 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    1.20 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    1.21 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    1.22 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    1.23 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    1.24 + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    1.25 + */
    1.26 +
    1.27 +#ifndef OWFIMAGE_H_
    1.28 +#define OWFIMAGE_H_
    1.29 +
    1.30 +#include "owftypes.h"
    1.31 +
    1.32 +#ifdef __cplusplus
    1.33 +extern "C" {
    1.34 +#endif
    1.35 +
    1.36 +typedef void*   OWF_DISPCTX;
    1.37 +
    1.38 +
    1.39 +#undef USE_FLOAT_PIXEL
    1.40 +
    1.41 +/*
    1.42 + * This is and always should be the only place where USE_FLOAT_PIXEL is 
    1.43 + * defined so if #define USE_FLOAT_PIXEL is absent in owfimage.h then it
    1.44 + * can be assumed it is not defined elsewhere. 
    1.45 + */ 
    1.46 +//#define USE_FLOAT_PIXEL
    1.47 +
    1.48 +/* --
    1.49 +* internal pixel format
    1.50 +*/
    1.51 +#ifdef USE_FLOAT_PIXEL
    1.52 +#define OWF_IMAGE_INTERNAL_PIXEL_IS_FLOAT
    1.53 +
    1.54 +typedef OWFfloat            OWFsubpixel; /* subpixel representation */
    1.55 +
    1.56 +#define OWF_RED_MIN_VALUE   0.0f
    1.57 +#define OWF_RED_MAX_VALUE   1.0f
    1.58 +#define OWF_GREEN_MIN_VALUE 0.0f
    1.59 +#define OWF_GREEN_MAX_VALUE 1.0f
    1.60 +#define OWF_BLUE_MIN_VALUE  0.0f
    1.61 +#define OWF_BLUE_MAX_VALUE  1.0f
    1.62 +#define OWF_ALPHA_MIN_VALUE 0.0f
    1.63 +#define OWF_ALPHA_MAX_VALUE 1.0f
    1.64 +
    1.65 +#define OWF_FULLY_OPAQUE        OWF_ALPHA_MAX_VALUE
    1.66 +#define OWF_FULLY_TRANSPARENT   OWF_ALPHA_MIN_VALUE
    1.67 +
    1.68 +#define OWF_BYTE_MAX_VALUE  255.0f
    1.69 +#define OWF_BILINEAR_ROUNDING_VALUE 0.0f
    1.70 +#define OWF_BLEND_ROUNDING_VALUE 0.0f
    1.71 +#define OWF_PREMUL_ROUNDING_FACTOR  0.0f
    1.72 +#define OWF_SOURCE_CONVERSION_ROUNDING_VALUE 0.0f
    1.73 +
    1.74 +#else
    1.75 +#undef OWF_IMAGE_INTERNAL_PIXEL_IS_FLOAT
    1.76 +
    1.77 +typedef OWFuint8            OWFsubpixel; /* subpixel representation */
    1.78 +
    1.79 +#define OWF_RED_MIN_VALUE         0
    1.80 +#define OWF_RED_MAX_VALUE       255
    1.81 +#define OWF_GREEN_MIN_VALUE       0
    1.82 +#define OWF_GREEN_MAX_VALUE     255
    1.83 +#define OWF_BLUE_MIN_VALUE        0
    1.84 +#define OWF_BLUE_MAX_VALUE      255
    1.85 +#define OWF_ALPHA_MIN_VALUE       0
    1.86 +#define OWF_ALPHA_MAX_VALUE     255
    1.87 +#define OWF_FULLY_OPAQUE        OWF_ALPHA_MAX_VALUE
    1.88 +#define OWF_FULLY_TRANSPARENT   OWF_ALPHA_MIN_VALUE
    1.89 +
    1.90 +#define OWF_BYTE_MAX_VALUE      255
    1.91 +
    1.92 +#define OWF_BILINEAR_ROUNDING_VALUE 0.5f
    1.93 +#define OWF_SOURCE_CONVERSION_ROUNDING_VALUE 0.5f
    1.94 +#define OWF_BLEND_ROUNDING_VALUE (OWF_ALPHA_MAX_VALUE/2)
    1.95 +#define OWF_PREMUL_ROUNDING_FACTOR (OWF_ALPHA_MAX_VALUE/2)
    1.96 +
    1.97 +#endif
    1.98 +
    1.99 +/*
   1.100 + * Byte order of different color formats
   1.101 + * these are used when converting from/to
   1.102 + * internal format
   1.103 + */
   1.104 +
   1.105 +#define ARGB8888_ALPHA_MASK         0xFF000000
   1.106 +#define ARGB8888_RED_MASK           0x00FF0000
   1.107 +#define ARGB8888_GREEN_MASK         0x0000FF00
   1.108 +#define ARGB8888_BLUE_MASK          0x000000FF
   1.109 +#define ARGB8888_ALPHA_SHIFT        24
   1.110 +#define ARGB8888_RED_SHIFT          16
   1.111 +#define ARGB8888_GREEN_SHIFT        8
   1.112 +#define ARGB8888_BLUE_SHIFT         0
   1.113 +
   1.114 +#define RGB565_ALPHA_MASK   0xFFFF
   1.115 +#define RGB565_RED_MASK     0xF800
   1.116 +#define RGB565_GREEN_MASK   0x07E0
   1.117 +#define RGB565_BLUE_MASK    0x001F
   1.118 +
   1.119 +/* These are used when converting from RGB565 to ARGB8888. */
   1.120 +#define RGB565_ALPHA_SHIFT  16
   1.121 +#define RGB565_RED_SHIFT    11
   1.122 +#define RGB565_GREEN_SHIFT  5
   1.123 +
   1.124 +/* subpixels per pixel */
   1.125 +#define OWF_PIXEL_SIZE      4
   1.126 +
   1.127 +/* subpixel in bytes */
   1.128 +#define OWF_SUBPIXEL_SIZE   sizeof(OWFsubpixel)
   1.129 +#define OWF_BYTES_PER_PIXEL (OWF_PIXEL_SIZE * OWF_SUBPIXEL_SIZE)
   1.130 +
   1.131 +#pragma pack(push, 1)
   1.132 +typedef union {
   1.133 +    struct {
   1.134 +        OWFsubpixel         blue;
   1.135 +        OWFsubpixel         green;
   1.136 +        OWFsubpixel         red;
   1.137 +        OWFsubpixel         alpha;
   1.138 +    } color;
   1.139 +    OWFsubpixel             subpixel[OWF_PIXEL_SIZE];
   1.140 +    OWFuint8                pixelbytes[OWF_BYTES_PER_PIXEL];
   1.141 +} OWFpixel;
   1.142 +#pragma pack(pop)
   1.143 +
   1.144 +/* -- */
   1.145 +
   1.146 +/* filters used in OWF_Image_Stretch */
   1.147 +typedef enum {
   1.148 +    OWF_FILTER_POINT_SAMPLING,  /* nearest pixel */
   1.149 +    OWF_FILTER_BILINEAR        /* nearest 4 */
   1.150 +} OWF_FILTERING;
   1.151 +
   1.152 +typedef struct {
   1.153 +    OWFint                  width;
   1.154 +    OWFint                  height;
   1.155 +    OWFint                  stride; /* number of bytes per line */
   1.156 +    OWFint                  pixelSize; /* pixel size in bytes */
   1.157 +    OWF_IMAGE_FORMAT        format;
   1.158 +    OWFboolean              foreign;
   1.159 +    OWFint                  dataMax; /* data buffer max size */
   1.160 +    void*                   data;
   1.161 +} OWF_IMAGE;
   1.162 +
   1.163 +/* This typedef denotes an owned OWF_IMAGE, as opposed to a temporary association.
   1.164 + * Owned instances must be destroyed when the containing object is destroyed.
   1.165 + */
   1.166 +typedef OWF_IMAGE* OWF_IMAGE_INST;
   1.167 +
   1.168 +typedef enum {
   1.169 +    OWF_FLIP_NONE,
   1.170 +    OWF_FLIP_VERTICALLY     = 1,
   1.171 +    OWF_FLIP_HORIZONTALLY   = 2
   1.172 +} OWF_FLIP_DIRECTION;
   1.173 +
   1.174 +typedef enum {
   1.175 +    OWF_ROTATION_0          = 0,
   1.176 +    OWF_ROTATION_90         = 90,
   1.177 +    OWF_ROTATION_180        = 180,
   1.178 +    OWF_ROTATION_270        = 270
   1.179 +} OWF_ROTATION;
   1.180 +
   1.181 +typedef enum {
   1.182 +    OWF_TRANSPARENCY_NONE,
   1.183 +    OWF_TRANSPARENCY_GLOBAL_ALPHA   = (1 << 0),
   1.184 +    OWF_TRANSPARENCY_SOURCE_ALPHA   = (1 << 1),
   1.185 +    OWF_TRANSPARENCY_MASK           = (1 << 2),
   1.186 +    OWF_TRANSPARENCY_COLOR_KEY      = (1 << 3)
   1.187 +} OWF_TRANSPARENCY;
   1.188 +
   1.189 +typedef struct _OWF_BLEND_INFO {
   1.190 +    struct {
   1.191 +        OWF_IMAGE*          image;
   1.192 +        OWF_RECTANGLE*      rectangle;
   1.193 +    } destination;
   1.194 +
   1.195 +    struct {
   1.196 +        OWF_IMAGE*          image;
   1.197 +        OWF_RECTANGLE*      rectangle;
   1.198 +    } source;
   1.199 +
   1.200 +    OWF_IMAGE*              mask;
   1.201 +    OWFsubpixel             globalAlpha;
   1.202 +} OWF_BLEND_INFO;
   1.203 +
   1.204 +
   1.205 +/*!---------------------------------------------------------------------------
   1.206 + *  \brief Initialize image object
   1.207 + *
   1.208 + *  \param image            Image object to initialize
   1.209 + *----------------------------------------------------------------------------*/
   1.210 +OWF_API_CALL void
   1.211 +OWF_Image_Init(OWF_IMAGE* image);
   1.212 +
   1.213 +/*!---------------------------------------------------------------------------
   1.214 + *  \brief Creates new reference counted image object
   1.215 + *
   1.216 + *  \param width            Image width (in pixels)
   1.217 + *  \param height           Image height (in pixels)
   1.218 + *  \param format           Image format (\see OWF_IMAGE_FORMAT)
   1.219 + *  \param buffer           Pointer to image pixel data. If NULL, then a new
   1.220 + *                          buffer is allocated for storing image pixel data.
   1.221 + *                          Allocated buffer is owned by the image. If non-NULL,
   1.222 + *                          then the image will be a "foreign" one, that doesn't
   1.223 + *                          own the pixel data but merely uses it.
   1.224 + *  \param minimumStride    Minimum number of bytes per scanline (may be zero)
   1.225 + *
   1.226 + *
   1.227 + *  \return New image object or NULL if error occured.
   1.228 + *----------------------------------------------------------------------------*/
   1.229 +OWF_PUBLIC OWF_IMAGE*
   1.230 +OWF_Image_Create(OWFint width,
   1.231 +                 OWFint height,
   1.232 +                 const OWF_IMAGE_FORMAT* format,
   1.233 +                 void* buffer,
   1.234 +                 OWFint minimumStride);
   1.235 +
   1.236 +/*!---------------------------------------------------------------------------
   1.237 + *  \brief Destroy image object. Rather than actually destroying the image
   1.238 + *  immediately, this decrements image's reference count by one and once the
   1.239 + *  counter reaches zero, the actual deletion will occur.
   1.240 + *
   1.241 + *  \param image            Image to destroy
   1.242 + *----------------------------------------------------------------------------*/
   1.243 +OWF_PUBLIC void
   1.244 +OWF_Image_Destroy(OWF_IMAGE* image);
   1.245 +
   1.246 +/*!---------------------------------------------------------------------------
   1.247 + *  \brief Create a pixel-perfect copy (clone) of the image. The copy will be
   1.248 + *  totally independent from the original image, i.e. doesn't share pixel
   1.249 + *  buffers or anything.
   1.250 + *
   1.251 + *  \param image            Image to copy
   1.252 + *
   1.253 + *  \param Copy of the image or NULL if error occured.
   1.254 + *----------------------------------------------------------------------------*/
   1.255 +OWF_API_CALL OWF_IMAGE*
   1.256 +OWF_Image_Copy(const OWF_IMAGE* image);
   1.257 +
   1.258 +/*!---------------------------------------------------------------------------
   1.259 + *  \brief Set image size. This doesn't modify the pixel data in anyway,
   1.260 + *  merely just changes the image header. Mostly used for (recycling) foreign
   1.261 + *  images that point to external pixel buffers.
   1.262 + *
   1.263 + *  If the new pixel count (width * height) exceeds
   1.264 + *  current values, the pixel buffer will NOT be resized, but the call will FAIL.
   1.265 + *
   1.266 + *  \param image            Image to resize
   1.267 + *  \param width            New width of the image
   1.268 + *  \param height           New height of the image
   1.269 + *
   1.270 + *
   1.271 + *  \return Boolean value indicating success of the operation. In case of
   1.272 + *  failure, no modifications are done to original image.
   1.273 + *----------------------------------------------------------------------------*/
   1.274 +OWF_API_CALL OWFboolean
   1.275 +OWF_Image_SetSize(OWF_IMAGE* image,
   1.276 +                  OWFint width,
   1.277 +                  OWFint height);
   1.278 +
   1.279 +/*!---------------------------------------------------------------------------
   1.280 + *  \brief Set internal mode flags. This doesn't modify the pixel data in anyway,
   1.281 + *  merely just changes the image header. Mostly used for (recycling) foreign
   1.282 + *  images that point to external pixel buffers.
   1.283 + *
   1.284 + *
   1.285 + *  \param image            Image to resize
   1.286 + *  \param premultiply      Image data is premultiplied
   1.287 + *  \param linear           Image colour data is linear
   1.288 + *
   1.289 + *
   1.290 + *  \return Boolean value indicating success of the operation. In case of
   1.291 + *  failure, no modifications are done to original image.
   1.292 + *----------------------------------------------------------------------------*/
   1.293 +OWF_API_CALL void
   1.294 +OWF_Image_SetFlags(OWF_IMAGE* image,
   1.295 +                  OWFboolean premultiply,
   1.296 +                  OWFboolean linear);
   1.297 +
   1.298 +/*!---------------------------------------------------------------------------
   1.299 + *  \brief Set the pixel buffer to an alternate location.
   1.300 + *  All other parameters remain the same.
   1.301 + *
   1.302 + *  \param image            Image to resize
   1.303 + *  \param buffer           Image data source to start using
   1.304 + *
   1.305 + *----------------------------------------------------------------------------*/
   1.306 +OWF_API_CALL void
   1.307 +OWF_Image_SetPixelBuffer(OWF_IMAGE* image,      void* buffer);
   1.308 +
   1.309 +
   1.310 +/*!---------------------------------------------------------------------------
   1.311 + *  \brief Blit (1:1 copy) pixels from image to another w/ clipping.
   1.312 + *
   1.313 + *  \param dst              Destination image
   1.314 + *  \param dstRect          Destination rectangle
   1.315 + *  \param src              Source image
   1.316 + *  \param srcRect          Source rectangle
   1.317 + *
   1.318 + *  \return Boolean value indicating whether pixels were copied or not. If not,
   1.319 + *  it means that either of the rectangles is outside its respective image's
   1.320 + *  bounds.
   1.321 + *----------------------------------------------------------------------------*/
   1.322 +OWF_API_CALL OWFboolean
   1.323 +OWF_Image_Blit(OWF_IMAGE* dst,
   1.324 +               OWF_RECTANGLE const* dstRect,
   1.325 +               OWF_IMAGE const* src,
   1.326 +               OWF_RECTANGLE const* srcRect);
   1.327 +
   1.328 +/*!---------------------------------------------------------------------------
   1.329 + *  \brief Stretch-blit (scaled copy) pixels from image to another w/ clipping.
   1.330 + *
   1.331 + *  \param dst              Destination image
   1.332 + *  \param dstRect          Destination rectangle
   1.333 + *  \param src              Source image
   1.334 + *  \param srcRect          Source rectangle
   1.335 + *
   1.336 + *  \return Boolean value indicating whether pixels were copied or not. If not,
   1.337 + *  it means that either of the rectangles is outside its respective image's
   1.338 + *  bounds.
   1.339 + *----------------------------------------------------------------------------*/
   1.340 +OWF_API_CALL OWFboolean
   1.341 +OWF_Image_Stretch(OWF_IMAGE* dst,
   1.342 +                  OWF_RECTANGLE* dstRect,
   1.343 +                  OWF_IMAGE* src,
   1.344 +                  OWFfloat* srcRect,
   1.345 +                  OWF_FILTERING filter);
   1.346 +
   1.347 +/*!---------------------------------------------------------------------------
   1.348 + *  \brief Multiply pixels' alpha value into rgb-color components.
   1.349 + *  Multiplies only if image source image is non-premultiplied.
   1.350 + *  \param image            Image to convert to pre-multiplied domain.
   1.351 + *----------------------------------------------------------------------------*/
   1.352 +OWF_API_CALL void
   1.353 +OWF_Image_PremultiplyAlpha(OWF_IMAGE* image);
   1.354 +
   1.355 +/*!---------------------------------------------------------------------------
   1.356 + *  \brief Divide pixels' rgb-color components by its alpha value.
   1.357 + *
   1.358 + *  \param image            Image to convert to nonpre-multiplied domain.
   1.359 + *----------------------------------------------------------------------------*/
   1.360 +OWF_API_CALL void
   1.361 +OWF_Image_UnpremultiplyAlpha(OWF_IMAGE* image);
   1.362 +
   1.363 +/*!---------------------------------------------------------------------------
   1.364 + *  \brief Linearizes image pixel data
   1.365 + *
   1.366 + *  \param image            Image to convert to linear domain
   1.367 + *----------------------------------------------------------------------------*/
   1.368 +OWF_API_CALL void
   1.369 +OWF_Image_LinearizeData(OWF_IMAGE* image);
   1.370 +
   1.371 +/*!---------------------------------------------------------------------------
   1.372 + *  \brief Non-linearizes image pixel data
   1.373 + *
   1.374 + *  \param image            Image to convert to non-linear domain
   1.375 + *----------------------------------------------------------------------------*/
   1.376 +OWF_API_CALL void
   1.377 +OWF_Image_NonLinearizeData(OWF_IMAGE* image);
   1.378 +
   1.379 +/*!---------------------------------------------------------------------------
   1.380 + *  \brief Apply gamma correction to image pixel values
   1.381 + *
   1.382 + *  \param image            Image to operate on
   1.383 + *  \param gamma            Gamma value
   1.384 + *----------------------------------------------------------------------------*/
   1.385 +OWF_API_CALL void
   1.386 +OWF_Image_Gamma(OWF_IMAGE* image, OWFfloat gamma);
   1.387 +
   1.388 +/*!---------------------------------------------------------------------------
   1.389 + *  \brief Flip (mirror) image about one or both of its center axes.
   1.390 + *
   1.391 + *  \param image            Image to flip
   1.392 + *  \param dir              Flip direction. Valid values are
   1.393 + *                          OWF_FLIP_NONE, OWF_FLIP_HORIZONTALLY,
   1.394 + *                          OWF_FLIP_VERTICALLY or any bitwise-or combination
   1.395 + *                          of the former.
   1.396 + *----------------------------------------------------------------------------*/
   1.397 +OWF_API_CALL void
   1.398 +OWF_Image_Flip(OWF_IMAGE* image,
   1.399 +               OWF_FLIP_DIRECTION dir);
   1.400 +
   1.401 +/*!---------------------------------------------------------------------------
   1.402 + *  \brief Rotate image n*90 degrees about its center
   1.403 + *
   1.404 + *  \param dst              Result (rotated) image.
   1.405 + *  \param src              Source image.
   1.406 + *  \param rotation         Rotation angle (OWF_ROTATION_0, OWF_ROTATION_90,
   1.407 + *                          OWF_ROTATION_180, or OWF_ROTATION_270)
   1.408 + *----------------------------------------------------------------------------*/
   1.409 +OWF_API_CALL void
   1.410 +OWF_Image_Rotate(OWF_IMAGE* dst,
   1.411 +                 OWF_IMAGE* src,
   1.412 +                 OWF_ROTATION rotation);
   1.413 +
   1.414 +/*!---------------------------------------------------------------------------
   1.415 + *  \brief
   1.416 + *
   1.417 + *  \param
   1.418 + *
   1.419 + *  \return
   1.420 + *----------------------------------------------------------------------------*/
   1.421 +OWF_API_CALL void
   1.422 +OWF_Image_Blend(OWF_BLEND_INFO* blend,
   1.423 +                OWF_TRANSPARENCY transparency);
   1.424 +
   1.425 +/*!---------------------------------------------------------------------------
   1.426 + *  \brief
   1.427 + *
   1.428 + *  \param
   1.429 + *
   1.430 + *  \return
   1.431 + *----------------------------------------------------------------------------*/
   1.432 +OWF_API_CALL void
   1.433 +OWF_Image_Clear(OWF_IMAGE* image,
   1.434 +                OWFsubpixel red,
   1.435 +                OWFsubpixel green,
   1.436 +                OWFsubpixel blue,
   1.437 +                OWFsubpixel alpha);
   1.438 +
   1.439 +/*!---------------------------------------------------------------------------
   1.440 + *  \brief Convert image data from internal color format to destination format
   1.441 + *
   1.442 + *  \param dst
   1.443 + *  \param src
   1.444 + *
   1.445 + *  \return
   1.446 + *----------------------------------------------------------------------------*/
   1.447 +OWF_API_CALL OWFboolean
   1.448 +OWF_Image_DestinationFormatConversion(OWF_IMAGE* dst,
   1.449 +                                      OWF_IMAGE* src);
   1.450 +/*!---------------------------------------------------------------------------
   1.451 + *  \brief Test whether it will be possible to convert to destination format.
   1.452 + *  Note, no IMAGE object yet extists. This is effectively a "static" member method.
   1.453 + *  \param format proposed destination format
   1.454 + *
   1.455 + *  \return boolean true if image lib can convert image data from internal color format 
   1.456 + *----------------------------------------------------------------------------*/
   1.457 +OWF_API_CALL OWFboolean
   1.458 +OWF_Image_IsValidDestinationFormat(OWF_IMAGE_FORMAT* format);
   1.459 +
   1.460 +/*!---------------------------------------------------------------------------
   1.461 +*  \brief Convert image data from source format to internal format
   1.462 + *
   1.463 + *  \param src
   1.464 + *  \param dst
   1.465 + *
   1.466 + *  \return
   1.467 + *----------------------------------------------------------------------------*/
   1.468 +OWF_API_CALL OWFboolean
   1.469 +OWF_Image_SourceFormatConversion(OWF_IMAGE* dst,
   1.470 +                                 OWF_IMAGE* src);
   1.471 +
   1.472 +/*!---------------------------------------------------------------------------
   1.473 + *  \brief
   1.474 + *
   1.475 + *  \param
   1.476 + *
   1.477 + *  \return
   1.478 + *----------------------------------------------------------------------------*/
   1.479 +OWF_API_CALL void*
   1.480 +OWF_Image_AllocData(OWF_DISPCTX dc, OWFint width,
   1.481 +                    OWFint height,
   1.482 +                    OWF_PIXEL_FORMAT format);
   1.483 +
   1.484 +
   1.485 +/*!---------------------------------------------------------------------------
   1.486 + *  \brief
   1.487 + *
   1.488 + *  \param
   1.489 + *
   1.490 + *  \return
   1.491 + *----------------------------------------------------------------------------*/
   1.492 +OWF_API_CALL void
   1.493 +OWF_Image_FreeData(OWF_DISPCTX dc, void** buffer);
   1.494 +
   1.495 +/*!---------------------------------------------------------------------------
   1.496 + *  \brief
   1.497 + *
   1.498 + *  \param
   1.499 + *
   1.500 + *  \return
   1.501 + *----------------------------------------------------------------------------*/
   1.502 +OWF_API_CALL OWFint
   1.503 +OWF_Image_GetFormatPixelSize(OWF_PIXEL_FORMAT format);
   1.504 +
   1.505 +
   1.506 +/*!---------------------------------------------------------------------------
   1.507 + * \brief Return stride (aligned row size in bytes) calculated from image
   1.508 + * width and pixelSize. If pixelSize is negative image width must be divisible
   1.509 + * by pixelSize.
   1.510 + *
   1.511 + * \param width             Width of image
   1.512 + * \param pixelSize         Size of single pixel in bytes. Negative size
   1.513 + *                          means value is a divisor (i.e. 1/pixelSize)
   1.514 + * \param padding           Number of bits each row is padded to.
   1.515 +
   1.516 + * \return Row size in bytes.
   1.517 + *----------------------------------------------------------------------------*/
   1.518 +OWF_PUBLIC OWFint
   1.519 +OWF_Image_GetStride(OWFint width,
   1.520 +                    const OWF_IMAGE_FORMAT* format,OWFint minimumStride);
   1.521 +
   1.522 +/*!---------------------------------------------------------------------------
   1.523 + *  \brief
   1.524 + *
   1.525 + *  \param
   1.526 + *
   1.527 + *  \return
   1.528 + *----------------------------------------------------------------------------*/
   1.529 +OWF_API_CALL OWFint
   1.530 +OWF_Image_GetFormatPadding(OWF_PIXEL_FORMAT format);
   1.531 +
   1.532 +/*!---------------------------------------------------------------------------
   1.533 + *  \brief Swap image width & height values in image header. Doesn't modify
   1.534 + *  image pixel data.
   1.535 + *
   1.536 + *  \param image            Image to operate on.
   1.537 + *----------------------------------------------------------------------------*/
   1.538 +OWF_API_CALL void
   1.539 +OWF_Image_SwapWidthAndHeight(OWF_IMAGE* image);
   1.540 +
   1.541 +/*!---------------------------------------------------------------------------
   1.542 + *  \brief Convert mask from external format to internal 8bpp format.
   1.543 + *
   1.544 + *  \param output           Result (converted) mask image
   1.545 + *  \param input            Input mask image to convert.
   1.546 + *
   1.547 + *  \return Boolean value indicating operation success. OWF_FALSE means that
   1.548 + *  input mask is either invalid or unsupported, or degenerate in some other
   1.549 + *  fascinating way.
   1.550 + *----------------------------------------------------------------------------*/
   1.551 +OWF_API_CALL OWFboolean
   1.552 +OWF_Image_ConvertMask(OWF_IMAGE* output,
   1.553 +                      OWF_IMAGE* input);
   1.554 +
   1.555 +/*!---------------------------------------------------------------------------
   1.556 + *  \brief Return pointer to given pixel in image.
   1.557 + *
   1.558 + *  \param image            Image
   1.559 + *  \param x                X-coordinate of the pixel (0..width-1)
   1.560 + *  \param y                Y-coordinate of the pixel (0..height-1)
   1.561 + *
   1.562 + *  The x & y coordinates will be clamped to [0..width-1, 0..height-1]
   1.563 + *
   1.564 + *  \return Pointer to given pixel
   1.565 + *----------------------------------------------------------------------------*/
   1.566 +OWF_API_CALL OWFpixel*
   1.567 +OWF_Image_GetPixelPtr(OWF_IMAGE* image,
   1.568 +                      OWFint x,
   1.569 +                      OWFint y);
   1.570 +
   1.571 +/*!---------------------------------------------------------------------------
   1.572 + *  \brief Read single pixel from image
   1.573 + *
   1.574 + *  \param image Image
   1.575 + *  \param x Pixel x coordinate
   1.576 + *  \param y Pixel y coordinate
   1.577 + *  \param pixel Where to store the pixel color value
   1.578 + *
   1.579 + *  Coordinates are clamped to region (0..width-1, 0..height-1)
   1.580 + *----------------------------------------------------------------------------*/
   1.581 +OWF_API_CALL void
   1.582 +OWF_Image_GetPixel(OWF_IMAGE* image,
   1.583 +                   OWFint x,
   1.584 +                   OWFint y,
   1.585 +                   OWFpixel* pixel);
   1.586 +
   1.587 +/*!---------------------------------------------------------------------------
   1.588 + *  \brief Write a pixel into image
   1.589 + *
   1.590 + *  \param image Image
   1.591 + *  \param x Pixel x coordinate
   1.592 + *  \param y Pixel y coordinate
   1.593 + *  \param pixel Color of the pixel
   1.594 + *
   1.595 + *  Coordinates are clamped to region (0..width-1, 0..height-1)
   1.596 + *----------------------------------------------------------------------------*/
   1.597 +OWF_API_CALL void
   1.598 +OWF_Image_SetPixel(OWF_IMAGE* image,
   1.599 +                   OWFint x,
   1.600 +                   OWFint y,
   1.601 +                   OWFpixel const* pixel);
   1.602 +
   1.603 +#ifdef __cplusplus
   1.604 +}
   1.605 +#endif
   1.606 +
   1.607 +#endif