LIBJXL

encode_cxx.h
Go to the documentation of this file.
1// Copyright (c) the JPEG XL Project Authors. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file.
5
11
12#ifndef JXL_ENCODE_CXX_H_
13#define JXL_ENCODE_CXX_H_
14
15#include <memory>
16
17#include "jxl/encode.h"
18
19#if !(defined(__cplusplus) || defined(c_plusplus))
20#error "This a C++ only header. Use jxl/encode.h from C sources."
21#endif
22
24 struct JxlEncoderDestroyStruct {
26 void operator()(JxlEncoder* encoder) { JxlEncoderDestroy(encoder); }
27};
28
34 typedef std::unique_ptr<JxlEncoder, JxlEncoderDestroyStruct> JxlEncoderPtr;
35
47 static inline JxlEncoderPtr JxlEncoderMake(
48 const JxlMemoryManager* memory_manager) {
49 return JxlEncoderPtr(JxlEncoderCreate(memory_manager));
50}
51
52#endif // JXL_ENCODE_CXX_H_
encode.h
Encoding API for JPEG XL.
JxlEncoder
struct JxlEncoderStruct JxlEncoder
Definition: encode.h:38
JxlEncoderCreate
JXL_EXPORT JxlEncoder * JxlEncoderCreate(const JxlMemoryManager *memory_manager)
JxlEncoderDestroy
JXL_EXPORT void JxlEncoderDestroy(JxlEncoder *enc)
JxlEncoderPtr
std::unique_ptr< JxlEncoder, JxlEncoderDestroyStruct > JxlEncoderPtr
Definition: encode_cxx.h:34
JxlEncoderDestroyStruct
Struct to call JxlEncoderDestroy from the JxlEncoderPtr unique_ptr.
Definition: encode_cxx.h:24
JxlEncoderDestroyStruct::operator()
void operator()(JxlEncoder *encoder)
Calls JxlEncoderDestroy() on the passed encoder.
Definition: encode_cxx.h:26
JxlMemoryManagerStruct
Definition: memory_manager.h:48