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 <jxl/encode.h>
19#include <jxl/memory_manager.h>
20
21#include <memory>
22
23#if !(defined(__cplusplus) || defined(c_plusplus))
24#error "This a C++ only header. Use jxl/encode.h from C sources."
25#endif
26
30 void operator()(JxlEncoder* encoder) { JxlEncoderDestroy(encoder); }
31};
32
38typedef std::unique_ptr<JxlEncoder, JxlEncoderDestroyStruct> JxlEncoderPtr;
39
51static inline JxlEncoderPtr JxlEncoderMake(
52 const JxlMemoryManager* memory_manager) {
53 return JxlEncoderPtr(JxlEncoderCreate(memory_manager));
54}
55
56#endif // JXL_ENCODE_CXX_H_
57
Encoding API for JPEG XL.
std::unique_ptr< JxlEncoder, JxlEncoderDestroyStruct > JxlEncoderPtr
Definition encode_cxx.h:38
struct JxlEncoderStruct JxlEncoder
Definition encode.h:47
JXL_EXPORT JxlEncoder * JxlEncoderCreate(const JxlMemoryManager *memory_manager)
JXL_EXPORT void JxlEncoderDestroy(JxlEncoder *enc)
Abstraction functions used by JPEG XL to allocate memory.
Struct to call JxlEncoderDestroy from the JxlEncoderPtr unique_ptr.
Definition encode_cxx.h:28
void operator()(JxlEncoder *encoder)
Calls JxlEncoderDestroy() on the passed encoder.
Definition encode_cxx.h:30
Definition memory_manager.h:51