Skip to content

Commit

Permalink
CxImage Linux port
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-t committed Mar 13, 2017
1 parent a7d1f14 commit 11278f1
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 7 deletions.
39 changes: 39 additions & 0 deletions src/Externals/cximage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 2.8.0)
project(cximage)

set(SOURCES
ximacfg.cpp
ximaenc.cpp
ximaexif.cpp
ximage.cpp
ximainfo.cpp
ximaint.cpp
ximajpg.cpp
ximalpha.cpp
ximalyr.cpp
ximapal.cpp
ximasel.cpp
ximath.cpp
xmemfile.cpp
)

set(HEADERS
xfile.h
ximacfg.h
ximadef.h
ximage.h
ximaiter.h
ximajpg.h
ximath.h
xiofile.h
xmemfile.h
)

add_definitions(-DCXIMAGE_BUILD)

include_directories("." ${CMAKE_SOURCE_DIR})

add_library(cximage STATIC ${SOURCES} ${HEADERS})

set_target_properties(cximage PROPERTIES PREFIX "")
target_link_libraries(cximage)
3 changes: 3 additions & 0 deletions src/Externals/cximage/ximacfg.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#if !defined(__ximaCFG_h)
#define __ximaCFG_h
#if !defined(WIN32)
#include <cstddef>
#endif

extern "C" void* cxalloc(size_t size);
extern "C" void cxfree(void* ptr);
Expand Down
6 changes: 6 additions & 0 deletions src/Externals/cximage/ximadef.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned int UINT;
typedef const char* LPCTSTR;

typedef DWORD COLORREF;
typedef unsigned int HANDLE;
typedef void* HRGN;
typedef void* HDC;

typedef int boolean;

#define _tfopen fopen

#ifndef BOOL
#define BOOL bool
Expand Down
12 changes: 8 additions & 4 deletions src/Externals/cximage/ximainfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include "ximage.h"

#if !defined(WIN32)
#define _tcsnicmp(a,b,c) strcasecmp(a,b)
#endif

////////////////////////////////////////////////////////////////////////////////
/**
* \return the color used for transparency, and/or for background color
Expand Down Expand Up @@ -538,7 +542,7 @@ void CxImage::SetOffset(long x,long y)
////////////////////////////////////////////////////////////////////////////////
/**
* \sa SetJpegQuality, GetJpegQualityF
* \author [DP]; changes [Stefan Schürmans]
* \author [DP]; changes [Stefan Sch�rmans]
*/
BYTE CxImage::GetJpegQuality() const
{
Expand All @@ -547,7 +551,7 @@ BYTE CxImage::GetJpegQuality() const
////////////////////////////////////////////////////////////////////////////////
/**
* \sa SetJpegQuality, GetJpegQuality
* \author [Stefan Schürmans]
* \author [Stefan Sch�rmans]
*/
float CxImage::GetJpegQualityF() const
{
Expand All @@ -557,7 +561,7 @@ float CxImage::GetJpegQualityF() const
/**
* quality level for JPEG and JPEG2000
* \param q: can be from 0 to 100
* \author [DP]; changes [Stefan Schürmans]
* \author [DP]; changes [Stefan Sch�rmans]
*/
void CxImage::SetJpegQuality(BYTE q){
info.fQuality = (float)q;
Expand All @@ -567,7 +571,7 @@ void CxImage::SetJpegQuality(BYTE q){
* quality level for JPEG and JPEG2000
* necessary for JPEG2000 when quality is between 0.0 and 1.0
* \param q: can be from 0.0 to 100.0
* \author [Stefan Schürmans]
* \author [Stefan Sch�rmans]
*/
void CxImage::SetJpegQualityF(float q){
if (q>0) info.fQuality = q;
Expand Down
2 changes: 1 addition & 1 deletion src/Externals/cximage/ximajpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#define XMD_H
#define HAVE_BOOLEAN
#include <jpeg/jmorecfg.h>
#include <jmorecfg.h>
#undef HAVE_BOOLEAN
#undef XMD_H

Expand Down
4 changes: 2 additions & 2 deletions src/Externals/cximage/ximajpg.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#define XMD_H
#define HAVE_BOOLEAN
extern "C" {
#include <jpeg/jpeglib.h>
#include <jpeg/jerror.h>
#include <jpeglib.h>
#include <jerror.h>
}
#undef HAVE_BOOLEAN
#undef XMD_H
Expand Down

0 comments on commit 11278f1

Please sign in to comment.