1 // Copyright 2013 Google Inc. All Rights Reserved.
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 // -----------------------------------------------------------------------------
10 // Utilities for processing transparent channel.
12 // Author: Skal (pascal.massimino@gmail.com)
14 #ifndef WEBP_UTILS_ALPHA_PROCESSING_H_
15 #define WEBP_UTILS_ALPHA_PROCESSING_H_
17 #include "../webp/types.h"
23 // Pre-Multiply operation transforms x into x * A / 255 (where x=Y,R,G or B).
24 // Un-Multiply operation transforms x into x * 255 / A.
26 // Pre-Multiply or Un-Multiply (if 'inverse' is true) argb values in a row.
27 void WebPMultARGBRow(uint32_t* const ptr
, int width
, int inverse
);
29 // Same a WebPMultARGBRow(), but for several rows.
30 void WebPMultARGBRows(uint8_t* ptr
, int stride
, int width
, int num_rows
,
33 // Same for a row of single values, with side alpha values.
34 void WebPMultRow(uint8_t* const ptr
, const uint8_t* const alpha
,
35 int width
, int inverse
);
37 // Same a WebPMultRow(), but for several 'num_rows' rows.
38 void WebPMultRows(uint8_t* ptr
, int stride
,
39 const uint8_t* alpha
, int alpha_stride
,
40 int width
, int num_rows
, int inverse
);
46 #endif // WEBP_UTILS_ALPHA_PROCESSING_H_