os/ossrv/genericopenlibs/liboil/src/composite_s.c
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
 * LIBOIL - Library of Optimized Inner Loops
sl@0
     3
 * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
sl@0
     4
 * All rights reserved.
sl@0
     5
 *
sl@0
     6
 * Redistribution and use in source and binary forms, with or without
sl@0
     7
 * modification, are permitted provided that the following conditions
sl@0
     8
 * are met:
sl@0
     9
 * 1. Redistributions of source code must retain the above copyright
sl@0
    10
 *    notice, this list of conditions and the following disclaimer.
sl@0
    11
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    12
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    13
 *    documentation and/or other materials provided with the distribution.
sl@0
    14
 * 
sl@0
    15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
sl@0
    16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
sl@0
    17
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    18
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
sl@0
    19
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
sl@0
    20
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sl@0
    21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    22
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
sl@0
    23
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
sl@0
    24
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
sl@0
    25
 * POSSIBILITY OF SUCH DAMAGE.
sl@0
    26
 */
sl@0
    27
//Portions Copyright (c)  2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
sl@0
    28
sl@0
    29
#ifdef HAVE_CONFIG_H
sl@0
    30
#include "config.h"
sl@0
    31
#endif
sl@0
    32
sl@0
    33
#include <liboil.h>
sl@0
    34
#include <liboilfunction.h>
sl@0
    35
#include <liboilrandom.h>
sl@0
    36
#include "liboil/liboilcolorspace.h"
sl@0
    37
#include <liboiltest.h>
sl@0
    38
#include <liboildebug.h>
sl@0
    39
sl@0
    40
#ifdef __SYMBIAN32__
sl@0
    41
#ifdef __ARMCC__
sl@0
    42
#pragma diag_remark 186
sl@0
    43
#endif//__ARMCC__
sl@0
    44
#endif//__SYMBIAN32__
sl@0
    45
sl@0
    46
#define COMPOSITE_OVER(d,s,m) ((d) + (s) - oil_muldiv_255((d),(m)))
sl@0
    47
#define COMPOSITE_ADD(d,s) oil_clamp_255((d) + (s))
sl@0
    48
#define COMPOSITE_IN(s,m) oil_muldiv_255((s),(m))
sl@0
    49
sl@0
    50
/**
sl@0
    51
 * SECTION:liboilfuncs-pixel
sl@0
    52
 * @title: Pixel Operations
sl@0
    53
 * @short_description: Operations on pixels
sl@0
    54
 *
sl@0
    55
 * Pixels are 4-element arrays of type uint8_t.  The elements, in
sl@0
    56
 * memory order, represent the alpha, red, green, and blue
sl@0
    57
 * components respectively.  The color components are premultiplied
sl@0
    58
 * with the alpha component.  Liboil functions represent pixels
sl@0
    59
 * as the type uint32_t.
sl@0
    60
 *
sl@0
    61
 * The compositing operators IN, OVER, and ADD are defined the same
sl@0
    62
 * as cairo.
sl@0
    63
 *
sl@0
    64
 */
sl@0
    65
static void
sl@0
    66
handle_param (OilParameter *p)
sl@0
    67
{
sl@0
    68
  int n;
sl@0
    69
sl@0
    70
  if (p->src_data) {
sl@0
    71
    if (p->type == OIL_TYPE_u32p) {
sl@0
    72
      uint32_t *ptr;
sl@0
    73
      ptr = (uint32_t *)oil_param_get_source_data (p);
sl@0
    74
      n = p->post_n;
sl@0
    75
      oil_random_argb (ptr, n);
sl@0
    76
    }
sl@0
    77
    if (p->type == OIL_TYPE_u8p) {
sl@0
    78
      uint8_t *ptr;
sl@0
    79
      ptr = (uint8_t *)oil_param_get_source_data (p);
sl@0
    80
      n = p->post_n;
sl@0
    81
      oil_random_alpha (ptr, n);
sl@0
    82
    }
sl@0
    83
  }
sl@0
    84
}
sl@0
    85
sl@0
    86
static void
sl@0
    87
composite_test (OilTest *test)
sl@0
    88
{
sl@0
    89
  handle_param(&test->params[OIL_ARG_SRC1]);
sl@0
    90
  handle_param(&test->params[OIL_ARG_SRC2]);
sl@0
    91
  handle_param(&test->params[OIL_ARG_INPLACE1]);
sl@0
    92
}
sl@0
    93
sl@0
    94
/**
sl@0
    95
 * oil_composite_in_argb:
sl@0
    96
 * @d_n: DEST
sl@0
    97
 * @s1_n: SRC
sl@0
    98
 * @s2_n: MASK
sl@0
    99
 * @n: number of elements
sl@0
   100
 *
sl@0
   101
 * Performs the compositing operation DEST = SRC IN MASK.
sl@0
   102
 */
sl@0
   103
OIL_DEFINE_CLASS_FULL (composite_in_argb,
sl@0
   104
    "uint32_t *d_n, uint32_t *s1_n, uint8_t *s2_n, int n",
sl@0
   105
    composite_test);
sl@0
   106
/**
sl@0
   107
 * oil_composite_in_argb_const_src:
sl@0
   108
 * @d_n: DEST
sl@0
   109
 * @s1_1: SRC
sl@0
   110
 * @s2_n: MASK
sl@0
   111
 * @n: number of elements
sl@0
   112
 *
sl@0
   113
 * Performs the compositing operation DEST = SRC IN MASK, for a constant
sl@0
   114
 * SRC.
sl@0
   115
 */
sl@0
   116
OIL_DEFINE_CLASS_FULL (composite_in_argb_const_src,
sl@0
   117
    "uint32_t *d_n, uint32_t *s1_1, uint8_t *s2_n, int n",
sl@0
   118
    composite_test);
sl@0
   119
/**
sl@0
   120
 * oil_composite_in_argb_const_mask:
sl@0
   121
 * @d_n: DEST
sl@0
   122
 * @s1_n: SRC
sl@0
   123
 * @s2_1: MASK
sl@0
   124
 * @n: number of elements
sl@0
   125
 *
sl@0
   126
 * Performs the compositing operation DEST = SRC IN MASK, for a constant
sl@0
   127
 * MASK.
sl@0
   128
 */
sl@0
   129
OIL_DEFINE_CLASS_FULL (composite_in_argb_const_mask,
sl@0
   130
    "uint32_t *d_n, uint32_t *s1_n, uint8_t *s2_1, int n",
sl@0
   131
    composite_test);
sl@0
   132
/**
sl@0
   133
 * oil_composite_over_argb:
sl@0
   134
 * @i_n: DEST
sl@0
   135
 * @s1_n: SRC
sl@0
   136
 * @n: number of elements
sl@0
   137
 *
sl@0
   138
 * Performs the compositing operation DEST = SRC OVER DEST.
sl@0
   139
 */
sl@0
   140
OIL_DEFINE_CLASS_FULL (composite_over_argb,
sl@0
   141
    "uint32_t *i_n, uint32_t *s1_n, int n",
sl@0
   142
    composite_test);
sl@0
   143
/**
sl@0
   144
 * oil_composite_over_argb_const_src:
sl@0
   145
 * @i_n: DEST
sl@0
   146
 * @s1_1: SRC
sl@0
   147
 * @n: number of elements
sl@0
   148
 *
sl@0
   149
 * Performs the compositing operation DEST = SRC OVER DEST, for a
sl@0
   150
 * constant SRC.
sl@0
   151
 */
sl@0
   152
OIL_DEFINE_CLASS_FULL (composite_over_argb_const_src,
sl@0
   153
    "uint32_t *i_n, uint32_t *s1_1, int n",
sl@0
   154
    composite_test);
sl@0
   155
/**
sl@0
   156
 * oil_composite_add_argb:
sl@0
   157
 * @i_n: DEST
sl@0
   158
 * @s1_n: SRC
sl@0
   159
 * @n: number of elements
sl@0
   160
 *
sl@0
   161
 * Performs the compositing operation DEST = SRC ADD DEST.
sl@0
   162
 */
sl@0
   163
OIL_DEFINE_CLASS_FULL (composite_add_argb,
sl@0
   164
    "uint32_t *i_n, uint32_t *s1_n, int n",
sl@0
   165
    composite_test);
sl@0
   166
/**
sl@0
   167
 * oil_composite_add_argb_const_src:
sl@0
   168
 * @i_n: DEST
sl@0
   169
 * @s1_1: SRC
sl@0
   170
 * @n: number of elements
sl@0
   171
 *
sl@0
   172
 * Performs the compositing operation DEST = SRC ADD DEST, for a
sl@0
   173
 * constant SRC.
sl@0
   174
 */
sl@0
   175
OIL_DEFINE_CLASS_FULL (composite_add_argb_const_src,
sl@0
   176
    "uint32_t *i_n, uint32_t *s1_1, int n",
sl@0
   177
    composite_test);
sl@0
   178
/**
sl@0
   179
 * oil_composite_in_over_argb:
sl@0
   180
 * @i_n: DEST
sl@0
   181
 * @s1_n: SRC
sl@0
   182
 * @s2_n: MASK
sl@0
   183
 * @n: number of elements
sl@0
   184
 *
sl@0
   185
 * Performs the compositing operation DEST = (SRC IN MASK) OVER DEST.
sl@0
   186
 */
sl@0
   187
OIL_DEFINE_CLASS_FULL (composite_in_over_argb,
sl@0
   188
    "uint32_t *i_n, uint32_t *s1_n, uint8_t *s2_n, int n",
sl@0
   189
    composite_test);
sl@0
   190
/**
sl@0
   191
 * oil_composite_in_over_argb_const_src:
sl@0
   192
 * @i_n: DEST
sl@0
   193
 * @s1_1: SRC
sl@0
   194
 * @s2_n: MASK
sl@0
   195
 * @n: number of elements
sl@0
   196
 *
sl@0
   197
 * Performs the compositing operation DEST = (SRC IN MASK) OVER DEST,
sl@0
   198
 * for a constant SRC.
sl@0
   199
 */
sl@0
   200
OIL_DEFINE_CLASS_FULL (composite_in_over_argb_const_src,
sl@0
   201
    "uint32_t *i_n, uint32_t *s1_1, uint8_t *s2_n, int n",
sl@0
   202
    composite_test);
sl@0
   203
/**
sl@0
   204
 * oil_composite_in_over_argb_const_mask:
sl@0
   205
 * @i_n: DEST
sl@0
   206
 * @s1_n: SRC
sl@0
   207
 * @s2_1: MASK
sl@0
   208
 * @n: number of elements
sl@0
   209
 *
sl@0
   210
 * Performs the compositing operation DEST = (SRC IN MASK) OVER DEST,
sl@0
   211
 * for a constant MASK.
sl@0
   212
 */
sl@0
   213
OIL_DEFINE_CLASS_FULL (composite_in_over_argb_const_mask,
sl@0
   214
    "uint32_t *i_n, uint32_t *s1_n, uint8_t *s2_1, int n",
sl@0
   215
    composite_test);
sl@0
   216
/**
sl@0
   217
 * oil_composite_over_u8:
sl@0
   218
 * @i_n: DEST
sl@0
   219
 * @s1_n: SRC
sl@0
   220
 * @n: number of elements
sl@0
   221
 *
sl@0
   222
 * Performs the compositing operation DEST = SRC OVER DEST.
sl@0
   223
 */
sl@0
   224
OIL_DEFINE_CLASS_FULL (composite_over_u8,
sl@0
   225
    "uint8_t *i_n, uint8_t *s1_n, int n",
sl@0
   226
    composite_test);
sl@0
   227
/**
sl@0
   228
 * oil_composite_add_u8:
sl@0
   229
 * @i_n: DEST
sl@0
   230
 * @s1_n: SRC
sl@0
   231
 * @n: number of elements
sl@0
   232
 *
sl@0
   233
 * Performs the compositing operation DEST = SRC ADD DEST.
sl@0
   234
 */
sl@0
   235
OIL_DEFINE_CLASS_FULL (composite_add_u8,
sl@0
   236
    "uint8_t *i_n, uint8_t *s1_n, int n",
sl@0
   237
    composite_test);
sl@0
   238
/**
sl@0
   239
 * oil_composite_add_u8_const_src:
sl@0
   240
 * @i_n: DEST
sl@0
   241
 * @s1_1: SRC
sl@0
   242
 * @n: number of elements
sl@0
   243
 *
sl@0
   244
 * Performs the compositing operation DEST = SRC ADD DEST.
sl@0
   245
 */
sl@0
   246
OIL_DEFINE_CLASS_FULL (composite_add_u8_const_src,
sl@0
   247
    "uint8_t *i_n, uint8_t *s1_1, int n",
sl@0
   248
    composite_test);
sl@0
   249
sl@0
   250
static void
sl@0
   251
composite_in_argb_ref (uint32_t *dest, const uint32_t *src, const uint8_t *mask, int n)
sl@0
   252
{
sl@0
   253
  int i;
sl@0
   254
sl@0
   255
  for(i=0;i<n;i++){
sl@0
   256
    dest[i] = oil_argb(
sl@0
   257
        COMPOSITE_IN(oil_argb_A(src[i]), mask[i]),
sl@0
   258
        COMPOSITE_IN(oil_argb_R(src[i]), mask[i]),
sl@0
   259
        COMPOSITE_IN(oil_argb_G(src[i]), mask[i]),
sl@0
   260
        COMPOSITE_IN(oil_argb_B(src[i]), mask[i]));
sl@0
   261
  }
sl@0
   262
}
sl@0
   263
OIL_DEFINE_IMPL_REF (composite_in_argb_ref, composite_in_argb);
sl@0
   264
sl@0
   265
static void
sl@0
   266
composite_in_argb_const_src_ref (uint32_t *dest, const uint32_t *src, const uint8_t *mask, int n)
sl@0
   267
{
sl@0
   268
  int i;
sl@0
   269
sl@0
   270
  for(i=0;i<n;i++){
sl@0
   271
    dest[i] = oil_argb(
sl@0
   272
        COMPOSITE_IN(oil_argb_A(src[0]), mask[i]),
sl@0
   273
        COMPOSITE_IN(oil_argb_R(src[0]), mask[i]),
sl@0
   274
        COMPOSITE_IN(oil_argb_G(src[0]), mask[i]),
sl@0
   275
        COMPOSITE_IN(oil_argb_B(src[0]), mask[i]));
sl@0
   276
  }
sl@0
   277
}
sl@0
   278
OIL_DEFINE_IMPL_REF (composite_in_argb_const_src_ref, composite_in_argb_const_src);
sl@0
   279
sl@0
   280
static void
sl@0
   281
composite_in_argb_const_mask_ref (uint32_t *dest, const uint32_t *src, const uint8_t *mask, int n)
sl@0
   282
{
sl@0
   283
  int i;
sl@0
   284
sl@0
   285
  for(i=0;i<n;i++){
sl@0
   286
    dest[i] = oil_argb(
sl@0
   287
        COMPOSITE_IN(oil_argb_A(src[i]), mask[0]),
sl@0
   288
        COMPOSITE_IN(oil_argb_R(src[i]), mask[0]),
sl@0
   289
        COMPOSITE_IN(oil_argb_G(src[i]), mask[0]),
sl@0
   290
        COMPOSITE_IN(oil_argb_B(src[i]), mask[0]));
sl@0
   291
  }
sl@0
   292
}
sl@0
   293
OIL_DEFINE_IMPL_REF (composite_in_argb_const_mask_ref, composite_in_argb_const_mask);
sl@0
   294
sl@0
   295
static void
sl@0
   296
composite_over_argb_ref (uint32_t *dest, const uint32_t *src, int n)
sl@0
   297
{
sl@0
   298
  int i;
sl@0
   299
  uint8_t a;
sl@0
   300
sl@0
   301
  for(i=0;i<n;i++){
sl@0
   302
    a = oil_argb_A(src[i]);
sl@0
   303
    dest[i] = oil_argb(
sl@0
   304
        COMPOSITE_OVER(oil_argb_A(dest[i]),oil_argb_A(src[i]),a),
sl@0
   305
        COMPOSITE_OVER(oil_argb_R(dest[i]),oil_argb_R(src[i]),a),
sl@0
   306
        COMPOSITE_OVER(oil_argb_G(dest[i]),oil_argb_G(src[i]),a),
sl@0
   307
        COMPOSITE_OVER(oil_argb_B(dest[i]),oil_argb_B(src[i]),a));
sl@0
   308
  }
sl@0
   309
sl@0
   310
}
sl@0
   311
OIL_DEFINE_IMPL_REF (composite_over_argb_ref, composite_over_argb);
sl@0
   312
sl@0
   313
static void
sl@0
   314
composite_over_argb_const_src_ref (uint32_t *dest, const uint32_t *src, int n)
sl@0
   315
{
sl@0
   316
  int i;
sl@0
   317
  uint8_t a;
sl@0
   318
sl@0
   319
  a = oil_argb_A(src[0]);
sl@0
   320
  for(i=0;i<n;i++){
sl@0
   321
    dest[i] = oil_argb(
sl@0
   322
        COMPOSITE_OVER(oil_argb_A(dest[i]),oil_argb_A(src[0]),a),
sl@0
   323
        COMPOSITE_OVER(oil_argb_R(dest[i]),oil_argb_R(src[0]),a),
sl@0
   324
        COMPOSITE_OVER(oil_argb_G(dest[i]),oil_argb_G(src[0]),a),
sl@0
   325
        COMPOSITE_OVER(oil_argb_B(dest[i]),oil_argb_B(src[0]),a));
sl@0
   326
  }
sl@0
   327
sl@0
   328
}
sl@0
   329
OIL_DEFINE_IMPL_REF (composite_over_argb_const_src_ref, composite_over_argb_const_src);
sl@0
   330
sl@0
   331
static void
sl@0
   332
composite_add_argb_ref (uint32_t *dest, const uint32_t *src, int n)
sl@0
   333
{
sl@0
   334
  int i;
sl@0
   335
sl@0
   336
  for(i=0;i<n;i++){
sl@0
   337
    dest[i] = oil_argb(
sl@0
   338
        COMPOSITE_ADD(oil_argb_A(dest[i]),oil_argb_A(src[i])),
sl@0
   339
        COMPOSITE_ADD(oil_argb_R(dest[i]),oil_argb_R(src[i])),
sl@0
   340
        COMPOSITE_ADD(oil_argb_G(dest[i]),oil_argb_G(src[i])),
sl@0
   341
        COMPOSITE_ADD(oil_argb_B(dest[i]),oil_argb_B(src[i])));
sl@0
   342
  }
sl@0
   343
sl@0
   344
}
sl@0
   345
OIL_DEFINE_IMPL_REF (composite_add_argb_ref, composite_add_argb);
sl@0
   346
sl@0
   347
static void
sl@0
   348
composite_add_argb_const_src_ref (uint32_t *dest, const uint32_t *src, int n)
sl@0
   349
{
sl@0
   350
  int i;
sl@0
   351
sl@0
   352
  for(i=0;i<n;i++){
sl@0
   353
    dest[i] = oil_argb(
sl@0
   354
        COMPOSITE_ADD(oil_argb_A(dest[i]),oil_argb_A(src[0])),
sl@0
   355
        COMPOSITE_ADD(oil_argb_R(dest[i]),oil_argb_R(src[0])),
sl@0
   356
        COMPOSITE_ADD(oil_argb_G(dest[i]),oil_argb_G(src[0])),
sl@0
   357
        COMPOSITE_ADD(oil_argb_B(dest[i]),oil_argb_B(src[0])));
sl@0
   358
  }
sl@0
   359
sl@0
   360
}
sl@0
   361
OIL_DEFINE_IMPL_REF (composite_add_argb_const_src_ref, composite_add_argb_const_src);
sl@0
   362
sl@0
   363
static void
sl@0
   364
composite_in_over_argb_ref (uint32_t *dest, const uint32_t *src, const uint8_t *mask, int n)
sl@0
   365
{
sl@0
   366
  int i;
sl@0
   367
  uint8_t a;
sl@0
   368
  uint32_t color;
sl@0
   369
sl@0
   370
  for(i=0;i<n;i++){
sl@0
   371
    color = oil_argb(
sl@0
   372
        COMPOSITE_IN(oil_argb_A(src[i]), mask[i]),
sl@0
   373
        COMPOSITE_IN(oil_argb_R(src[i]), mask[i]),
sl@0
   374
        COMPOSITE_IN(oil_argb_G(src[i]), mask[i]),
sl@0
   375
        COMPOSITE_IN(oil_argb_B(src[i]), mask[i]));
sl@0
   376
    a = oil_argb_A(color);
sl@0
   377
    dest[i] = oil_argb(
sl@0
   378
        COMPOSITE_OVER(oil_argb_A(dest[i]),oil_argb_A(color),a),
sl@0
   379
        COMPOSITE_OVER(oil_argb_R(dest[i]),oil_argb_R(color),a),
sl@0
   380
        COMPOSITE_OVER(oil_argb_G(dest[i]),oil_argb_G(color),a),
sl@0
   381
        COMPOSITE_OVER(oil_argb_B(dest[i]),oil_argb_B(color),a));
sl@0
   382
  }
sl@0
   383
sl@0
   384
}
sl@0
   385
OIL_DEFINE_IMPL_REF (composite_in_over_argb_ref, composite_in_over_argb);
sl@0
   386
sl@0
   387
static void
sl@0
   388
composite_in_over_argb_const_src_ref (uint32_t *dest, const uint32_t *src, const uint8_t *mask, int n)
sl@0
   389
{
sl@0
   390
  int i;
sl@0
   391
  uint8_t a;
sl@0
   392
  uint32_t color;
sl@0
   393
sl@0
   394
  for(i=0;i<n;i++){
sl@0
   395
    color = oil_argb(
sl@0
   396
        COMPOSITE_IN(oil_argb_A(src[0]), mask[i]),
sl@0
   397
        COMPOSITE_IN(oil_argb_R(src[0]), mask[i]),
sl@0
   398
        COMPOSITE_IN(oil_argb_G(src[0]), mask[i]),
sl@0
   399
        COMPOSITE_IN(oil_argb_B(src[0]), mask[i]));
sl@0
   400
    a = oil_argb_A(color);
sl@0
   401
    dest[i] = oil_argb(
sl@0
   402
        COMPOSITE_OVER(oil_argb_A(dest[i]),oil_argb_A(color),a),
sl@0
   403
        COMPOSITE_OVER(oil_argb_R(dest[i]),oil_argb_R(color),a),
sl@0
   404
        COMPOSITE_OVER(oil_argb_G(dest[i]),oil_argb_G(color),a),
sl@0
   405
        COMPOSITE_OVER(oil_argb_B(dest[i]),oil_argb_B(color),a));
sl@0
   406
  }
sl@0
   407
sl@0
   408
}
sl@0
   409
OIL_DEFINE_IMPL_REF (composite_in_over_argb_const_src_ref, composite_in_over_argb_const_src);
sl@0
   410
sl@0
   411
static void
sl@0
   412
composite_in_over_argb_const_mask_ref (uint32_t *dest, const uint32_t *src, const uint8_t *mask, int n)
sl@0
   413
{
sl@0
   414
  int i;
sl@0
   415
  uint8_t a;
sl@0
   416
  uint32_t color;
sl@0
   417
sl@0
   418
  for(i=0;i<n;i++){
sl@0
   419
    color = oil_argb(
sl@0
   420
        COMPOSITE_IN(oil_argb_A(src[i]), mask[0]),
sl@0
   421
        COMPOSITE_IN(oil_argb_R(src[i]), mask[0]),
sl@0
   422
        COMPOSITE_IN(oil_argb_G(src[i]), mask[0]),
sl@0
   423
        COMPOSITE_IN(oil_argb_B(src[i]), mask[0]));
sl@0
   424
    a = oil_argb_A(color);
sl@0
   425
    dest[i] = oil_argb(
sl@0
   426
        COMPOSITE_OVER(oil_argb_A(dest[i]),oil_argb_A(color),a),
sl@0
   427
        COMPOSITE_OVER(oil_argb_R(dest[i]),oil_argb_R(color),a),
sl@0
   428
        COMPOSITE_OVER(oil_argb_G(dest[i]),oil_argb_G(color),a),
sl@0
   429
        COMPOSITE_OVER(oil_argb_B(dest[i]),oil_argb_B(color),a));
sl@0
   430
  }
sl@0
   431
sl@0
   432
}
sl@0
   433
OIL_DEFINE_IMPL_REF (composite_in_over_argb_const_mask_ref, composite_in_over_argb_const_mask);
sl@0
   434
sl@0
   435
static void
sl@0
   436
composite_add_u8_ref (uint8_t *dest, const uint8_t *src, int n)
sl@0
   437
{
sl@0
   438
  int i;
sl@0
   439
sl@0
   440
  for(i=0;i<n;i++){
sl@0
   441
    dest[i] = COMPOSITE_ADD(dest[i],src[i]);
sl@0
   442
  }
sl@0
   443
sl@0
   444
}
sl@0
   445
OIL_DEFINE_IMPL_REF (composite_add_u8_ref, composite_add_u8);
sl@0
   446
sl@0
   447
static void
sl@0
   448
composite_add_u8_const_src_ref (uint8_t *dest, const uint8_t *src1_1, int n)
sl@0
   449
{
sl@0
   450
  int i;
sl@0
   451
sl@0
   452
  for(i=0;i<n;i++){
sl@0
   453
    dest[i] = COMPOSITE_ADD(dest[i],src1_1[0]);
sl@0
   454
  }
sl@0
   455
sl@0
   456
}
sl@0
   457
OIL_DEFINE_IMPL_REF (composite_add_u8_const_src_ref, composite_add_u8_const_src);
sl@0
   458
sl@0
   459
static void
sl@0
   460
composite_over_u8_ref (uint8_t *dest, const uint8_t *src, int n)
sl@0
   461
{
sl@0
   462
  int i;
sl@0
   463
sl@0
   464
  for(i=0;i<n;i++){
sl@0
   465
    dest[i] = COMPOSITE_OVER(dest[i],src[i],src[i]);
sl@0
   466
  }
sl@0
   467
sl@0
   468
}
sl@0
   469
OIL_DEFINE_IMPL_REF (composite_over_u8_ref, composite_over_u8);
sl@0
   470
sl@0
   471
sl@0
   472
sl@0
   473
sl@0
   474
#ifdef	__SYMBIAN32__
sl@0
   475
 
sl@0
   476
OilFunctionClass* __oil_function_class_composite_in_argb() {
sl@0
   477
		return &_oil_function_class_composite_in_argb;
sl@0
   478
}
sl@0
   479
#endif
sl@0
   480
sl@0
   481
#ifdef	__SYMBIAN32__
sl@0
   482
 
sl@0
   483
OilFunctionClass* __oil_function_class_composite_in_argb_const_src() {
sl@0
   484
		return &_oil_function_class_composite_in_argb_const_src;
sl@0
   485
}
sl@0
   486
#endif
sl@0
   487
sl@0
   488
#ifdef	__SYMBIAN32__
sl@0
   489
 
sl@0
   490
OilFunctionClass* __oil_function_class_composite_in_argb_const_mask() {
sl@0
   491
		return &_oil_function_class_composite_in_argb_const_mask;
sl@0
   492
}
sl@0
   493
#endif
sl@0
   494
sl@0
   495
#ifdef	__SYMBIAN32__
sl@0
   496
 
sl@0
   497
OilFunctionClass* __oil_function_class_composite_over_argb() {
sl@0
   498
		return &_oil_function_class_composite_over_argb;
sl@0
   499
}
sl@0
   500
#endif
sl@0
   501
sl@0
   502
#ifdef	__SYMBIAN32__
sl@0
   503
 
sl@0
   504
OilFunctionClass* __oil_function_class_composite_over_argb_const_src() {
sl@0
   505
		return &_oil_function_class_composite_over_argb_const_src;
sl@0
   506
}
sl@0
   507
#endif
sl@0
   508
sl@0
   509
#ifdef	__SYMBIAN32__
sl@0
   510
 
sl@0
   511
OilFunctionClass* __oil_function_class_composite_add_argb() {
sl@0
   512
		return &_oil_function_class_composite_add_argb;
sl@0
   513
}
sl@0
   514
#endif
sl@0
   515
sl@0
   516
#ifdef	__SYMBIAN32__
sl@0
   517
 
sl@0
   518
OilFunctionClass* __oil_function_class_composite_add_argb_const_src() {
sl@0
   519
		return &_oil_function_class_composite_add_argb_const_src;
sl@0
   520
}
sl@0
   521
#endif
sl@0
   522
sl@0
   523
#ifdef	__SYMBIAN32__
sl@0
   524
 
sl@0
   525
OilFunctionClass* __oil_function_class_composite_in_over_argb() {
sl@0
   526
		return &_oil_function_class_composite_in_over_argb;
sl@0
   527
}
sl@0
   528
#endif
sl@0
   529
sl@0
   530
#ifdef	__SYMBIAN32__
sl@0
   531
 
sl@0
   532
OilFunctionClass* __oil_function_class_composite_in_over_argb_const_src() {
sl@0
   533
		return &_oil_function_class_composite_in_over_argb_const_src;
sl@0
   534
}
sl@0
   535
#endif
sl@0
   536
sl@0
   537
#ifdef	__SYMBIAN32__
sl@0
   538
 
sl@0
   539
OilFunctionClass* __oil_function_class_composite_in_over_argb_const_mask() {
sl@0
   540
		return &_oil_function_class_composite_in_over_argb_const_mask;
sl@0
   541
}
sl@0
   542
#endif
sl@0
   543
sl@0
   544
#ifdef	__SYMBIAN32__
sl@0
   545
 
sl@0
   546
OilFunctionClass* __oil_function_class_composite_over_u8() {
sl@0
   547
		return &_oil_function_class_composite_over_u8;
sl@0
   548
}
sl@0
   549
#endif
sl@0
   550
sl@0
   551
#ifdef	__SYMBIAN32__
sl@0
   552
 
sl@0
   553
OilFunctionClass* __oil_function_class_composite_add_u8() {
sl@0
   554
		return &_oil_function_class_composite_add_u8;
sl@0
   555
}
sl@0
   556
#endif
sl@0
   557
sl@0
   558
#ifdef	__SYMBIAN32__
sl@0
   559
 
sl@0
   560
OilFunctionClass* __oil_function_class_composite_add_u8_const_src() {
sl@0
   561
		return &_oil_function_class_composite_add_u8_const_src;
sl@0
   562
}
sl@0
   563
#endif
sl@0
   564
sl@0
   565
sl@0
   566
sl@0
   567
#ifdef	__SYMBIAN32__
sl@0
   568
 
sl@0
   569
OilFunctionImpl* __oil_function_impl_composite_in_argb_ref() {
sl@0
   570
		return &_oil_function_impl_composite_in_argb_ref;
sl@0
   571
}
sl@0
   572
#endif
sl@0
   573
sl@0
   574
#ifdef	__SYMBIAN32__
sl@0
   575
 
sl@0
   576
OilFunctionImpl* __oil_function_impl_composite_in_argb_const_src_ref() {
sl@0
   577
		return &_oil_function_impl_composite_in_argb_const_src_ref;
sl@0
   578
}
sl@0
   579
#endif
sl@0
   580
sl@0
   581
#ifdef	__SYMBIAN32__
sl@0
   582
 
sl@0
   583
OilFunctionImpl* __oil_function_impl_composite_in_argb_const_mask_ref() {
sl@0
   584
		return &_oil_function_impl_composite_in_argb_const_mask_ref;
sl@0
   585
}
sl@0
   586
#endif
sl@0
   587
sl@0
   588
#ifdef	__SYMBIAN32__
sl@0
   589
 
sl@0
   590
OilFunctionImpl* __oil_function_impl_composite_over_argb_ref() {
sl@0
   591
		return &_oil_function_impl_composite_over_argb_ref;
sl@0
   592
}
sl@0
   593
#endif
sl@0
   594
sl@0
   595
#ifdef	__SYMBIAN32__
sl@0
   596
 
sl@0
   597
OilFunctionImpl* __oil_function_impl_composite_over_argb_const_src_ref() {
sl@0
   598
		return &_oil_function_impl_composite_over_argb_const_src_ref;
sl@0
   599
}
sl@0
   600
#endif
sl@0
   601
sl@0
   602
#ifdef	__SYMBIAN32__
sl@0
   603
 
sl@0
   604
OilFunctionImpl* __oil_function_impl_composite_add_argb_ref() {
sl@0
   605
		return &_oil_function_impl_composite_add_argb_ref;
sl@0
   606
}
sl@0
   607
#endif
sl@0
   608
sl@0
   609
#ifdef	__SYMBIAN32__
sl@0
   610
 
sl@0
   611
OilFunctionImpl* __oil_function_impl_composite_add_argb_const_src_ref() {
sl@0
   612
		return &_oil_function_impl_composite_add_argb_const_src_ref;
sl@0
   613
}
sl@0
   614
#endif
sl@0
   615
sl@0
   616
#ifdef	__SYMBIAN32__
sl@0
   617
 
sl@0
   618
OilFunctionImpl* __oil_function_impl_composite_in_over_argb_ref() {
sl@0
   619
		return &_oil_function_impl_composite_in_over_argb_ref;
sl@0
   620
}
sl@0
   621
#endif
sl@0
   622
sl@0
   623
#ifdef	__SYMBIAN32__
sl@0
   624
 
sl@0
   625
OilFunctionImpl* __oil_function_impl_composite_in_over_argb_const_src_ref() {
sl@0
   626
		return &_oil_function_impl_composite_in_over_argb_const_src_ref;
sl@0
   627
}
sl@0
   628
#endif
sl@0
   629
sl@0
   630
#ifdef	__SYMBIAN32__
sl@0
   631
 
sl@0
   632
OilFunctionImpl* __oil_function_impl_composite_in_over_argb_const_mask_ref() {
sl@0
   633
		return &_oil_function_impl_composite_in_over_argb_const_mask_ref;
sl@0
   634
}
sl@0
   635
#endif
sl@0
   636
sl@0
   637
#ifdef	__SYMBIAN32__
sl@0
   638
 
sl@0
   639
OilFunctionImpl* __oil_function_impl_composite_add_u8_ref() {
sl@0
   640
		return &_oil_function_impl_composite_add_u8_ref;
sl@0
   641
}
sl@0
   642
#endif
sl@0
   643
sl@0
   644
#ifdef	__SYMBIAN32__
sl@0
   645
 
sl@0
   646
OilFunctionImpl* __oil_function_impl_composite_add_u8_const_src_ref() {
sl@0
   647
		return &_oil_function_impl_composite_add_u8_const_src_ref;
sl@0
   648
}
sl@0
   649
#endif
sl@0
   650
sl@0
   651
#ifdef	__SYMBIAN32__
sl@0
   652
 
sl@0
   653
OilFunctionImpl* __oil_function_impl_composite_over_u8_ref() {
sl@0
   654
		return &_oil_function_impl_composite_over_u8_ref;
sl@0
   655
}
sl@0
   656
#endif
sl@0
   657
sl@0
   658
sl@0
   659
sl@0
   660
#ifdef	__SYMBIAN32__
sl@0
   661
 
sl@0
   662
EXPORT_C void** _oil_function_class_ptr_composite_in_argb ()	{
sl@0
   663
	oil_function_class_ptr_composite_in_argb = __oil_function_class_composite_in_argb();
sl@0
   664
	return &oil_function_class_ptr_composite_in_argb->func;
sl@0
   665
	}
sl@0
   666
#endif
sl@0
   667
sl@0
   668
#ifdef	__SYMBIAN32__
sl@0
   669
 
sl@0
   670
EXPORT_C void** _oil_function_class_ptr_composite_in_argb_const_src ()	{
sl@0
   671
	oil_function_class_ptr_composite_in_argb_const_src = __oil_function_class_composite_in_argb_const_src();
sl@0
   672
	return &oil_function_class_ptr_composite_in_argb_const_src->func;
sl@0
   673
	}
sl@0
   674
#endif
sl@0
   675
sl@0
   676
#ifdef	__SYMBIAN32__
sl@0
   677
 
sl@0
   678
EXPORT_C void** _oil_function_class_ptr_composite_in_argb_const_mask ()	{
sl@0
   679
	oil_function_class_ptr_composite_in_argb_const_mask = __oil_function_class_composite_in_argb_const_mask();
sl@0
   680
	return &oil_function_class_ptr_composite_in_argb_const_mask->func;
sl@0
   681
	}
sl@0
   682
#endif
sl@0
   683
sl@0
   684
#ifdef	__SYMBIAN32__
sl@0
   685
 
sl@0
   686
EXPORT_C void** _oil_function_class_ptr_composite_over_argb ()	{
sl@0
   687
	oil_function_class_ptr_composite_over_argb = __oil_function_class_composite_over_argb();
sl@0
   688
	return &oil_function_class_ptr_composite_over_argb->func;
sl@0
   689
	}
sl@0
   690
#endif
sl@0
   691
sl@0
   692
#ifdef	__SYMBIAN32__
sl@0
   693
 
sl@0
   694
EXPORT_C void** _oil_function_class_ptr_composite_over_argb_const_src ()	{
sl@0
   695
	oil_function_class_ptr_composite_over_argb_const_src = __oil_function_class_composite_over_argb_const_src();
sl@0
   696
	return &oil_function_class_ptr_composite_over_argb_const_src->func;
sl@0
   697
	}
sl@0
   698
#endif
sl@0
   699
sl@0
   700
#ifdef	__SYMBIAN32__
sl@0
   701
 
sl@0
   702
EXPORT_C void** _oil_function_class_ptr_composite_add_argb ()	{
sl@0
   703
	oil_function_class_ptr_composite_add_argb = __oil_function_class_composite_add_argb();
sl@0
   704
	return &oil_function_class_ptr_composite_add_argb->func;
sl@0
   705
	}
sl@0
   706
#endif
sl@0
   707
sl@0
   708
#ifdef	__SYMBIAN32__
sl@0
   709
 
sl@0
   710
EXPORT_C void** _oil_function_class_ptr_composite_add_argb_const_src ()	{
sl@0
   711
	oil_function_class_ptr_composite_add_argb_const_src = __oil_function_class_composite_add_argb_const_src();
sl@0
   712
	return &oil_function_class_ptr_composite_add_argb_const_src->func;
sl@0
   713
	}
sl@0
   714
#endif
sl@0
   715
sl@0
   716
#ifdef	__SYMBIAN32__
sl@0
   717
 
sl@0
   718
EXPORT_C void** _oil_function_class_ptr_composite_in_over_argb ()	{
sl@0
   719
	oil_function_class_ptr_composite_in_over_argb = __oil_function_class_composite_in_over_argb();
sl@0
   720
	return &oil_function_class_ptr_composite_in_over_argb->func;
sl@0
   721
	}
sl@0
   722
#endif
sl@0
   723
sl@0
   724
#ifdef	__SYMBIAN32__
sl@0
   725
 
sl@0
   726
EXPORT_C void** _oil_function_class_ptr_composite_in_over_argb_const_src ()	{
sl@0
   727
	oil_function_class_ptr_composite_in_over_argb_const_src = __oil_function_class_composite_in_over_argb_const_src();
sl@0
   728
	return &oil_function_class_ptr_composite_in_over_argb_const_src->func;
sl@0
   729
	}
sl@0
   730
#endif
sl@0
   731
sl@0
   732
#ifdef	__SYMBIAN32__
sl@0
   733
 
sl@0
   734
EXPORT_C void** _oil_function_class_ptr_composite_in_over_argb_const_mask ()	{
sl@0
   735
	oil_function_class_ptr_composite_in_over_argb_const_mask = __oil_function_class_composite_in_over_argb_const_mask();
sl@0
   736
	return &oil_function_class_ptr_composite_in_over_argb_const_mask->func;
sl@0
   737
	}
sl@0
   738
#endif
sl@0
   739
sl@0
   740
#ifdef	__SYMBIAN32__
sl@0
   741
 
sl@0
   742
EXPORT_C void** _oil_function_class_ptr_composite_over_u8 ()	{
sl@0
   743
	oil_function_class_ptr_composite_over_u8 = __oil_function_class_composite_over_u8();
sl@0
   744
	return &oil_function_class_ptr_composite_over_u8->func;
sl@0
   745
	}
sl@0
   746
#endif
sl@0
   747
sl@0
   748
#ifdef	__SYMBIAN32__
sl@0
   749
 
sl@0
   750
EXPORT_C void** _oil_function_class_ptr_composite_add_u8 ()	{
sl@0
   751
	oil_function_class_ptr_composite_add_u8 = __oil_function_class_composite_add_u8();
sl@0
   752
	return &oil_function_class_ptr_composite_add_u8->func;
sl@0
   753
	}
sl@0
   754
#endif
sl@0
   755
sl@0
   756
#ifdef	__SYMBIAN32__
sl@0
   757
 
sl@0
   758
EXPORT_C void** _oil_function_class_ptr_composite_add_u8_const_src ()	{
sl@0
   759
	oil_function_class_ptr_composite_add_u8_const_src = __oil_function_class_composite_add_u8_const_src();
sl@0
   760
	return &oil_function_class_ptr_composite_add_u8_const_src->func;
sl@0
   761
	}
sl@0
   762
#endif
sl@0
   763