public override ImageData Read(Stream stream, ImageMetaData info) { using (var reader = new WebPDecoder (stream, (WebPMetaData)info)) { reader.Decode(); return ImageData.Create (info, reader.Format, null, reader.Output); } }
int last_y; // coordinate of the line that was last output #endregion Fields #region Methods public int EmitSampledRGB(WebPDecoder dec) { var input = dec.Cache; var output = dec.Output; int dst_stride = dec.Stride; int dst = mb_y * dst_stride; for (int j = 0; j < mb_h; ++j) { YuvToBgraRow (input, y, u, v, output, dst, mb_w); y += y_stride; if (0 != (j & 1)) { u += uv_stride; v += uv_stride; } dst += dst_stride; } return mb_h; }
void EmitAlphaRGB(WebPDecoder dec, int expected_num_lines_out) { int base_rgba = mb_y * dec.Stride; int dst = base_rgba + 3; DispatchAlpha (alpha_plane, a, width, mb_w, mb_h, dec.Output, dst, dec.Stride); }
public bool Put(WebPDecoder dec) { if (mb_w <= 0 || mb_h <= 0) return false; int num_lines_out = EmitSampledRGB (dec); if (alpha_plane != null) EmitAlphaRGB (dec, num_lines_out); last_y += num_lines_out; return true; }
public void Init(WebPDecoder dec) { mb_y = 0; y = dec.cache_y_; u = dec.cache_u_; v = dec.cache_v_; y_stride = dec.cache_y_stride_; uv_stride = dec.cache_uv_stride_; alpha_plane = dec.AlphaPlane; a = 0; last_y = 0; }