summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorHubert Figuière <hub@figuiere.net>2019-01-13 18:06:59 -0500
committerHubert Figuière <hub@figuiere.net>2019-01-13 18:06:59 -0500
commite104cbb1c2e361e844abe6b50095bc89a59d6ac5 (patch)
tree86f4559fb1b7e2da96a66e5ec71df83be9454f9d /demo
parent0d1046f5e64c2ec8e3ab2aa4161f51ea0849eb36 (diff)
api: Remove access to the C++ symbols
- Added API_EXPORT attribute - Added MakerNote access API and Ifd - testsuite now uses C API - Removed C++ demos - Link some tests statically
Diffstat (limited to 'demo')
-rw-r--r--demo/Makefile.am12
-rw-r--r--demo/cfa.cpp113
-rw-r--r--demo/thumb.cpp147
3 files changed, 3 insertions, 269 deletions
diff --git a/demo/Makefile.am b/demo/Makefile.am
index dfdfc85..1ac9bd2 100644
--- a/demo/Makefile.am
+++ b/demo/Makefile.am
@@ -4,14 +4,14 @@ if BUILD_GNOME_SUPPORT
GNOME_BINARIES = gdk pixbufload
endif
-noinst_PROGRAMS = extensions thumb thumbc cfa ccfa ppmload $(GNOME_BINARIES)
+noinst_PROGRAMS = extensions thumbc ccfa ppmload $(GNOME_BINARIES)
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/lib \
-I$(top_srcdir)/gnome/include \
@LIBGDKPIXBUF_CFLAGS@ @BOOST_CPPFLAGS@
-LIBOPENRAW_LIBS = ../lib/libopenraw.la
-LIBOPENRAWGNOME_LIBS = ../gnome/libopenrawgnome.la \
+LIBOPENRAW_LIBS = $(top_builddir)/lib/libopenraw.la
+LIBOPENRAWGNOME_LIBS = $(top_builddir)/gnome/libopenrawgnome.la \
@LIBGDKPIXBUF_LIBS@
extensions_SOURCES = extensions.cpp
@@ -20,12 +20,6 @@ extensions_LDADD = $(LIBOPENRAW_LIBS)
thumbc_SOURCES = thumbc.c
thumbc_LDADD = $(LIBOPENRAW_LIBS)
-thumb_SOURCES = thumb.cpp
-thumb_LDADD = $(LIBOPENRAW_LIBS)
-
-cfa_SOURCES = cfa.cpp
-cfa_LDADD = $(LIBOPENRAW_LIBS)
-
ccfa_SOURCES = ccfa.c
ccfa_LDADD = $(LIBOPENRAW_LIBS)
diff --git a/demo/cfa.cpp b/demo/cfa.cpp
deleted file mode 100644
index fb7348e..0000000
--- a/demo/cfa.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * libopenraw - cfa.cpp
- *
- * Copyright (C) 2007-2018 Hubert Figuiere
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <iostream>
-#include <memory>
-#include <libopenraw/libopenraw.h>
-#include <libopenraw/debug.h>
-
-#include "thumbnail.hpp"
-#include "rawfile.hpp"
-#include "rawdata.hpp"
-
-using OpenRaw::Thumbnail;
-
-int
-main(int argc, char** argv)
-{
- bool keepCompressed = false;
- if (argc < 2) {
- std::cerr << "missing parameter" << std::endl;
- return 1;
- }
-
- int c;
- do {
- c = getopt(argc, argv, "r");
- if(c != -1) {
- if(c == 'r') {
- keepCompressed = true;
- }
- }
- } while(c != -1);
-
- OpenRaw::init();
- or_debug_set_level(DEBUG2);
- FILE * f;
- size_t written_size;
-
- std::unique_ptr<OpenRaw::RawFile> raw_file(OpenRaw::RawFile::newRawFile(argv[optind]));
-
- OpenRaw::RawData rdata;
- uint32_t options = (keepCompressed ? OR_OPTIONS_DONT_DECOMPRESS : 0);
- raw_file->getRawData(rdata, options);
-
- if(keepCompressed) {
- std::cout << "keep compressed" << std::endl;
- }
- std::cout << "data size = " << rdata.size() << std::endl;
- std::cout << "data type = " << rdata.dataType() << std::endl;
-
- if(!keepCompressed && rdata.dataType() == OR_DATA_TYPE_RAW) {
- f = fopen("image.pgm", "wb");
- fprintf(f, "P5\n");
- fprintf(f, "%d %d\n", rdata.width(), rdata.height());
- fprintf(f, "%d\n", (1 << rdata.bpc()) - 1);
- }
- else {
- f = fopen("image.cfa", "wb");
- }
- // Convert data byte order to most significant byte first
- if(rdata.bpc() == 16) {
- uint8_t* buf = (uint8_t*)malloc(rdata.size());
- uint8_t* p = buf;
- uint16_t* n = reinterpret_cast<uint16_t*>(rdata.data());
- for(size_t i = 0; i < rdata.size() / 2; i++) {
- unsigned char lo = n[i] & 0xFF;
- unsigned char hi = n[i] >> 8;
- p[i * 2] = hi;
- p[i * 2 + 1] = lo;
- }
- written_size = fwrite(buf, 1, rdata.size(), f);
- free(buf);
- }
- else {
- written_size = fwrite(rdata.data(), 1, rdata.size(), f);
- }
- if (written_size != rdata.size()) {
- printf("short write\n");
- }
- fclose(f);
-
- return 0;
-}
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0))
- indent-tabs-mode:nil
- fill-column:80
- End:
-*/
diff --git a/demo/thumb.cpp b/demo/thumb.cpp
deleted file mode 100644
index e755c0c..0000000
--- a/demo/thumb.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * libopenraw - thumb.cpp
- *
- * Copyright (C) 2006-2016 Hubert Figuiere
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-
-#include <stdio.h>
-
-#include <iostream>
-#include <memory>
-#include <libopenraw/libopenraw.h>
-#include <libopenraw/debug.h>
-
-#include "thumbnail.hpp"
-#include "rawfile.hpp"
-
-using OpenRaw::Thumbnail;
-
-void writeThumbnail(const std::unique_ptr<Thumbnail> & thumb,
- const char* basename)
-{
- FILE * f;
- size_t s;
- auto thumbnailFormat = thumb->dataType();
- std::cerr << "thumb data size =" << thumb->size() << std::endl;
- std::cerr << "thumb data type =" << thumbnailFormat << std::endl;
-
- std::string filename = basename;
-
- switch (thumbnailFormat) {
- case OR_DATA_TYPE_JPEG:
- filename += ".jpg";
- break;
- case OR_DATA_TYPE_PIXMAP_8RGB:
- filename += ".ppm";
- break;
- default:
- std::cerr << "invalid format" << std::endl;
- return;
- }
-
- f = fopen(filename.c_str(), "wb");
- if(thumbnailFormat == OR_DATA_TYPE_PIXMAP_8RGB) {
- fprintf(f, "P6\n");
- fprintf(f, "%u\n%u\n", thumb->width(), thumb->height());
- fprintf(f, "%d\n", 255);
- }
-
- s = fwrite(thumb->data(), 1, thumb->size(), f);
- if(s != thumb->size()) {
- std::cerr << "short write of " << s << " bytes\n";
- }
- fclose(f);
-}
-
-
-int
-main(int argc, char** argv)
-{
- ::or_error err = OR_ERROR_NONE;
-
- if (argc < 2) {
- std::cerr << "missing parameter" << std::endl;
- return 1;
- }
-
- OpenRaw::init();
- or_debug_set_level(DEBUG2);
-
- {
- std::unique_ptr<OpenRaw::RawFile> raw_file(
- OpenRaw::RawFile::newRawFile(argv[1]));
- if(!raw_file)
- {
- std::cout << "Unable to open raw file.\n";
- return 1;
- }
- auto list = raw_file->listThumbnailSizes();
- for(auto elem : list)
- {
- std::cout << "found " << elem << " pixels\n";
- }
- }
-
- {
- std::unique_ptr<Thumbnail> thumb(
- Thumbnail::getAndExtractThumbnail(argv[1],
- 160, err));
- if (thumb != NULL) {
- writeThumbnail(thumb, "thumb");
- }
- else {
- std::cerr << "error = " << err << std::endl;
- }
- }
-
- {
- std::unique_ptr<Thumbnail> thumb(
- Thumbnail::getAndExtractThumbnail(argv[1],
- 640, err));
- if (thumb != NULL) {
- writeThumbnail(thumb, "thumbl");
- }
- else {
- std::cerr << "error = " << err << std::endl;
- }
- }
-
- {
- std::unique_ptr<Thumbnail> thumb(
- Thumbnail::getAndExtractThumbnail(argv[1],
- 2048, err));
- if (thumb != NULL) {
- writeThumbnail(thumb, "preview");
- }
- else {
- std::cerr << "error = " << err << std::endl;
- }
- }
-
- return 0;
-}
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0))
- indent-tabs-mode:nil
- fill-column:80
- End:
-*/