Krita Source Code Documentation
Loading...
Searching...
No Matches
jp2_converter.cc File Reference
#include "jp2_converter.h"
#include <openjpeg.h>
#include <QApplication>
#include <QMessageBox>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpaceTraits.h>
#include <KoColorSpaceConstants.h>
#include <KisImportExportManager.h>
#include <KoColorSpace.h>
#include <KoColorModelStandardIds.h>
#include <KisDocument.h>
#include <kis_image.h>
#include <kis_group_layer.h>
#include <kis_paint_layer.h>
#include <kis_paint_device.h>
#include <kis_transaction.h>
#include "kis_iterator_ng.h"
#include <QThread>
#include <plugins/impex/xcf/3rdparty/xcftools/xcftools.h>
#include <iostream>
#include <sstream>
#include <cstring>
#include <list>
#include <utility>

Go to the source code of this file.

Macros

#define J2K_CFMT   0
 
#define J2K_CODESTREAM_MAGIC   "\xff\x4f\xff\x51"
 
#define JP2_CFMT   1
 
#define JP2_MAGIC   "\x0d\x0a\x87\x0a"
 
#define JP2_RFC3745_MAGIC   "\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a"
 

Functions

static void error_callback (const char *msg, void *client_data)
 
static int getFileFormat (const char *filename)
 
static void info_callback (const char *msg, void *client_data)
 
static void warning_callback (const char *msg, void *client_data)
 

Macro Definition Documentation

◆ J2K_CFMT

#define J2K_CFMT   0

Definition at line 38 of file jp2_converter.cc.

◆ J2K_CODESTREAM_MAGIC

#define J2K_CODESTREAM_MAGIC   "\xff\x4f\xff\x51"

Definition at line 100 of file jp2_converter.cc.

◆ JP2_CFMT

#define JP2_CFMT   1

Definition at line 39 of file jp2_converter.cc.

◆ JP2_MAGIC

#define JP2_MAGIC   "\x0d\x0a\x87\x0a"

Definition at line 99 of file jp2_converter.cc.

◆ JP2_RFC3745_MAGIC

#define JP2_RFC3745_MAGIC   "\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a"

Definition at line 98 of file jp2_converter.cc.

Function Documentation

◆ error_callback()

static void error_callback ( const char * msg,
void * client_data )
static

sample error callback expecting a FILE* client object

Definition at line 52 of file jp2_converter.cc.

52 {
53 JP2Converter *converter = (JP2Converter*) client_data;
54 converter->addErrorString(msg);
55}
void addErrorString(const std::string &str)

References JP2Converter::addErrorString().

◆ getFileFormat()

static int getFileFormat ( const char * filename)
static

Definition at line 73 of file jp2_converter.cc.

73 {
74 static const std::list<std::pair<const char*, int>> formats= {
75 {"j2k", J2K_CFMT},
76 {"jp2", JP2_CFMT},
77 {"j2c", J2K_CFMT},
78 {"jpc", J2K_CFMT},
79 {"jpx", J2K_CFMT},
80 {"jpf", J2K_CFMT}
81 };
82 const char *ext = strrchr(filename, '.');
83 if (ext == NULL) {
84 return -1;
85 }
86 ext++;
87 if (*ext) {
88 for (const auto &format : formats) {
89 if (strcasecmp(ext, format.first) == 0) {
90 return format.second;
91 }
92 }
93 }
94
95 return -1;
96}
#define J2K_CFMT
#define JP2_CFMT
#define strcasecmp
Definition xcftools.h:73

References J2K_CFMT, JP2_CFMT, and strcasecmp.

◆ info_callback()

static void info_callback ( const char * msg,
void * client_data )
static

sample debug callback expecting no client object

Definition at line 68 of file jp2_converter.cc.

68 {
69 JP2Converter *converter = (JP2Converter*) client_data;
70 converter->addInfoString(msg);
71}
void addInfoString(const std::string &str)

References JP2Converter::addInfoString().

◆ warning_callback()

static void warning_callback ( const char * msg,
void * client_data )
static

sample warning callback expecting a FILE* client object

Definition at line 60 of file jp2_converter.cc.

60 {
61 JP2Converter *converter = (JP2Converter*) client_data;
62 converter->addWarningString(msg);
63}
void addWarningString(const std::string &str)

References JP2Converter::addWarningString().