1/* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8#ifndef SkImageEncoderPriv_DEFINED 9#define SkImageEncoderPriv_DEFINED 10 11#include "SkImageEncoder.h" 12 13struct SkEncodeOptions { 14 SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kIgnore; 15}; 16 17#ifdef SK_HAS_JPEG_LIBRARY 18 bool SkEncodeImageAsJPEG(SkWStream*, const SkPixmap&, const SkEncodeOptions&); 19 bool SkEncodeImageAsJPEG(SkWStream*, const SkPixmap&, int quality); 20#else 21 #define SkEncodeImageAsJPEG(...) false 22#endif 23 24#ifdef SK_HAS_PNG_LIBRARY 25 bool SkEncodeImageAsPNG(SkWStream*, const SkPixmap&, const SkEncodeOptions&); 26#else 27 #define SkEncodeImageAsPNG(...) false 28#endif 29 30#ifdef SK_HAS_WEBP_LIBRARY 31 bool SkEncodeImageAsWEBP(SkWStream*, const SkPixmap&, const SkEncodeOptions&); 32 bool SkEncodeImageAsWEBP(SkWStream*, const SkPixmap&, int quality); 33#else 34 #define SkEncodeImageAsWEBP(...) false 35#endif 36 37#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 38 bool SkEncodeImageWithCG(SkWStream*, const SkPixmap&, SkEncodedImageFormat); 39#else 40 #define SkEncodeImageWithCG(...) false 41#endif 42 43#ifdef SK_BUILD_FOR_WIN 44 bool SkEncodeImageWithWIC(SkWStream*, const SkPixmap&, SkEncodedImageFormat, int quality); 45#else 46 #define SkEncodeImageWithWIC(...) false 47#endif 48 49#endif // SkImageEncoderPriv_DEFINED 50