WebPAlpha constructor

WebPAlpha(
  1. InputBuffer input,
  2. int width,
  3. int height
)

Implementation

WebPAlpha(this.input, this.width, this.height) {
  final b = input.readByte();
  method = b & 0x03;
  filter = (b >> 2) & 0x03;
  preProcessing = (b >> 4) & 0x03;
  rsrv = (b >> 6) & 0x03;

  if (isValid) {
    if (method == ALPHA_NO_COMPRESSION) {
      final alphaDecodedSize = width * height;
      if (input.length < alphaDecodedSize) {
        rsrv = 1;
      }
    } else if (method == ALPHA_LOSSLESS_COMPRESSION) {
      if (!_decodeAlphaHeader()) {
        rsrv = 1;
      }
    } else {
      rsrv = 1;
    }
  }
}