1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef _FX_CODEC_PROVIDER_H_ 8 #define _FX_CODEC_PROVIDER_H_ 9 class IFX_JpegProvider 10 { 11 public: 12 13 virtual void Release() = 0; 14 15 virtual void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) = 0; 16 17 18 virtual void DestroyDecoder(void* pDecoder) = 0; 19 20 virtual void DownScale(void* pDecoder, int dest_width, int dest_height) = 0; 21 22 virtual FX_BOOL Rewind(void* pDecoder) = 0; 23 24 virtual FX_LPBYTE GetNextLine(void* pDecoder) = 0; 25 26 virtual FX_DWORD GetSrcOffset(void* pDecoder) = 0; 27 28 29 virtual FX_BOOL LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, 30 int& num_components, int& bits_per_components, FX_BOOL& color_transform, 31 FX_LPBYTE* icc_buf_ptr = NULL, FX_DWORD* icc_length = NULL) = 0; 32 33 virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality = 75, 34 FX_LPCBYTE icc_buf = NULL, FX_DWORD icc_length = 0) = 0; 35 36 virtual void* Start() = 0; 37 38 virtual void Finish(void* pContext) = 0; 39 40 virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size) = 0; 41 42 virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps) = 0; 43 44 45 virtual int StartScanline(void* pContext, int down_scale) = 0; 46 47 48 virtual FX_BOOL ReadScanline(void* pContext, FX_LPBYTE dest_buf) = 0; 49 50 51 virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr = NULL) = 0; 52 }; 53 #endif 54