LIBJXL: jxl/encode_cxx.h Source File

LIBJXL

Loading...
Searching...
No Matches
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
14
15#ifndef JXL_ENCODE_CXX_H_
16#define JXL_ENCODE_CXX_H_
17
18#include <memory>
19
20#include "jxl/encode.h"
21
22#if !(defined(__cplusplus) || defined(c_plusplus))
23#error "This a C++ only header. Use jxl/encode.h from C sources."
24#endif
25
27 struct JxlEncoderDestroyStruct {
29 void operator()(JxlEncoder* encoder) { JxlEncoderDestroy(encoder); }
30};
31
37 typedef std::unique_ptr<JxlEncoder, JxlEncoderDestroyStruct> JxlEncoderPtr;
38
50static inline JxlEncoderPtr JxlEncoderMake(
51 const JxlMemoryManager* memory_manager) {
52 return JxlEncoderPtr(JxlEncoderCreate(memory_manager));
53}
54
55#endif // JXL_ENCODE_CXX_H_
56
encode.h
Encoding API for JPEG XL.
JxlEncoder
struct JxlEncoderStruct JxlEncoder
Definition encode.h:42
JxlEncoderCreate
JXL_EXPORT JxlEncoder * JxlEncoderCreate(const JxlMemoryManager *memory_manager)
JxlEncoderPtr
std::unique_ptr< JxlEncoder, JxlEncoderDestroyStruct > JxlEncoderPtr
Definition encode_cxx.h:37
JxlEncoderDestroy
JXL_EXPORT void JxlEncoderDestroy(JxlEncoder *enc)
JxlEncoderDestroyStruct
Struct to call JxlEncoderDestroy from the JxlEncoderPtr unique_ptr.
Definition encode_cxx.h:27
JxlEncoderDestroyStruct::operator()
void operator()(JxlEncoder *encoder)
Calls JxlEncoderDestroy() on the passed encoder.
Definition encode_cxx.h:29
JxlMemoryManagerStruct
Definition memory_manager.h:51