encode_cxx.h
Go to the documentation of this file.
// Copyright (c) the JPEG XL Project Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#ifndef JXL_ENCODE_CXX_H_
#define JXL_ENCODE_CXX_H_
#include <memory>
#include "jxl/encode.h"
#if !(defined(__cplusplus) || defined(c_plusplus))
#error "This a C++ only header. Use jxl/encode.h from C sources."
#endif
struct JxlEncoderDestroyStruct {
void operator()(JxlEncoder* encoder) { JxlEncoderDestroy(encoder); }
};
typedef std::unique_ptr<JxlEncoder, JxlEncoderDestroyStruct> JxlEncoderPtr;
static inline JxlEncoderPtr JxlEncoderMake(
const JxlMemoryManager* memory_manager) {
return JxlEncoderPtr(JxlEncoderCreate(memory_manager));
}
#endif // JXL_ENCODE_CXX_H_
encode.h
Encoding API for JPEG XL.
JxlEncoder
struct JxlEncoderStruct JxlEncoder
Definition: encode.h:41
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