-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
26 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
^src/Makevars$ | ||
.travis.yml | ||
appveyor.yml | ||
^windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,7 @@ | |
*.o | ||
*.a | ||
*.so | ||
*.dll | ||
*.png | ||
src/Makevars | ||
windows |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
PKG_CPPFLAGS=-I../windows/imagemagick-7.0.2.2/include/ImageMagick-7 | ||
PKG_CXXFLAGS=-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 | ||
CXX_STD=CXX11 | ||
|
||
PKG_LIBS= -L../windows/imagemagick-7.0.2.2/lib${R_ARCH} \ | ||
-lMagick++-7.Q16 -lMagickWand-7.Q16 -lMagickCore-7.Q16 \ | ||
-lpng -ljpeg -ltiff -ltiffxx -lfreetype -lharfbuzz \ | ||
-llzma -lbz2 -lz -lgdi32 -lws2_32 -lOleAut32 | ||
|
||
all: clean | ||
|
||
clean: | ||
rm -f $(OBJECTS) $(SHLIB) | ||
|
||
winlibs: clean | ||
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" | ||
|
||
.PHONY: all winlibs clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
#include <Magick++.h> | ||
#include <Rcpp.h> | ||
#include <Magick++.h> | ||
#include <iostream> | ||
using namespace std; | ||
using namespace Magick; | ||
|
||
// [[Rcpp::export]] | ||
Rcpp::RawVector convert_to(Rcpp::RawVector x, Rcpp::String to){ | ||
//Magick::InitializeMagick(); | ||
Blob input( x.begin(), x.length()); | ||
Image image( input ); | ||
Blob output; | ||
Magick::Blob input( x.begin(), x.length()); | ||
Magick::Image image( input ); | ||
Magick::Blob output; | ||
image.magick( to ); // Set JPEG output format | ||
image.write( &output ); | ||
Rcpp::RawVector res(output.length()); | ||
std::memcpy(res.begin(), output.data(), output.length()); | ||
memcpy(res.begin(), output.data(), output.length()); | ||
return res; | ||
} |