mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
extras: add WebPUnmultiplyARGB() convenience function
This is useful for converting associated to unassociated. Change-Id: I0e6d16ec63cb5514a0f945c14a54e0d01e1fab0a
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
|
||||
#include "extras/extras.h"
|
||||
#include "webp/format_constants.h"
|
||||
#include "src/dsp/dsp.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@ -144,3 +145,18 @@ int WebPImportColorMappedARGB(const uint8_t* indexed, int indexed_stride,
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int WebPUnmultiplyARGB(WebPPicture* pic) {
|
||||
int y;
|
||||
uint32_t* dst;
|
||||
if (pic == NULL || pic->use_argb != 1 || pic->argb == NULL) return 0;
|
||||
WebPInitAlphaProcessing();
|
||||
dst = pic->argb;
|
||||
for (y = 0; y < pic->height; ++y) {
|
||||
WebPMultARGBRow(dst, pic->width, /*inverse=*/1);
|
||||
dst += pic->argb_stride;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user