diff --git a/examples/CImg_demo.cpp b/examples/CImg_demo.cpp index b9f421880e474458839ef2041a239172340213be..effe051f674a3f676ab969fd3ee8460dd9c3d55f 100644 --- a/examples/CImg_demo.cpp +++ b/examples/CImg_demo.cpp @@ -308,7 +308,7 @@ void* item_mandelbrot_explorer() { static CImg<unsigned char> help = CImg<unsigned char>().draw_text(0,0,"\n" " Use mouse to zoom on desired region. \n" - " H Show/Hide help \n" + " H Show/Hide help \n" " PAD 1...9 Fractal navigation \n" " PAD +/- Zoom/Unzoom \n" " SPACE Set/Disable color smoothing \n" @@ -655,8 +655,12 @@ void* item_plasma() { const int y0 = (int)(visu.height()/2 + visu.height()/4*std::sin(ts + x/(70 + 30*std::cos(beta)))); cimg_forY(scroll,y) { if (scroll(x,y)) { - const unsigned int y1 = y0 + y + 2; visu(x,y1,0)/=2; visu(x,y1,1)/=2; visu(x,y1,2)/=2; - const unsigned int y2 = y1 - 6; visu(x,y2,0) = visu(x,y2,1) = visu(x,y2,2) = 255; + const unsigned int y1 = y0 + y + 2; visu(x,y1,0)*=0.7; visu(x,y1,1)*=0.7; visu(x,y1,2)*=0.7; + const unsigned int y2 = y1 - 6; + const float c = scroll(x,y)/255.0f; + (visu(x,y2,0)*= 1 - c)+=254*c; + (visu(x,y2,1)*= 1 - c)+=254*c; + (visu(x,y2,2)*= 1 - c)+=254*c; } } } @@ -1620,6 +1624,7 @@ int main(int argc, char **argv) { back.draw_rectangle(0,y0 - 7,back.width() - 1,y0 + 20,red); fore.assign(back.width(),50,1,1,0).draw_text(20,y0 - 3,"** CImg %u.%u.%u Samples **",grey,0,1,23, cimg_version/100,(cimg_version/10)%10,cimg_version%10); + cimg_for(fore,ptr,unsigned char) *ptr = 127*(*ptr>64); (fore+=fore.get_dilate(3).dilate(3)).resize(-100,-100,1,3); cimg_forXY(fore,x,y) if (fore(x,y)==127) fore(x,y,0) = fore(x,y,1) = fore(x,y,2) = 1; @@ -1669,9 +1674,9 @@ int main(int argc, char **argv) { for (int i = 0; i<60; ++i) { const float mx = (float)(img.width()/2 + (img.width()/2 - 30)*((1 - gamma)*std::cos(3*t + rx*i*18.0f*cimg::PI/180) + - gamma*std::cos(3*t + nrx*i*18.0f*cimg::PI/180))), + gamma*std::cos(3*t + nrx*i*18.0f*cimg::PI/180))), my = (float)(img.height()/2 + (img.height()/2 - 30)*((1 - gamma)*std::sin(4*t + ry*i*18.0f*cimg::PI/180) + - gamma*std::sin(4*t + nry*i*18.0f*cimg::PI/180))), + gamma*std::sin(4*t + nry*i*18.0f*cimg::PI/180))), mz = (float)(1.3f + 1.2f*((1 - gamma)*std::sin(2*t + (rx + ry)*i*20*cimg::PI/180) + gamma*std::sin(2*t + (nrx + nry)*i*20*cimg::PI/180))); const int j = i%5; diff --git a/examples/Makefile b/examples/Makefile index 4c9bf09ba82962dec5eb9206e3e8d822c88e7b76..ea8b9204a7c4f75b6b32a7eb9d9c4327525c3daf 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -84,31 +84,34 @@ EXTRA_FILES = use_tiff_stream use_jpeg_buffer # Set correct variables and paths #--------------------------------- VERSION = `grep 'cimg_version\ ' ../CImg.h | tail -c4 | head -c3` -X11PATH = /usr/X11R6 -EXEPFX = +X11PATH = /usr/X11R6 + +EXE_PRE = +EXE_EXT = ifeq ($(MSYSTEM),MINGW32) -EXESFX = .exe -else -ifeq ($(MSYSTEM),MINGW64) -EXESFX = .exe -else -EXESFX = +EXE_EXT = .exe endif +ifeq ($(MSYSTEM),MINGW64) +EXE_EXT = .exe endif -CXXVER = $(CXX) + +CXXVER = $(CXX) ifeq ($(notdir $(CXX)),g++) -CXXVER = `$(CXX) -v 2>&1 | tail -n 1` +IS_GCC = 1 +CXXVER = `$(CXX) -v 2>&1 | tail -n 1` endif ifeq ($(notdir $(CXX)),clang++) -CXXVER = `$(CXX) -v 2>&1 | head -n 1` +IS_CLANG = 1 +CXXVER = `$(CXX) -v 2>&1 | head -n 1` endif ifeq ($(notdir $(CXX)),icpc) -CXXVER = "icpc \( `$(CXX) -v 2>&1`\)" -CFLAGS = -I.. -LIBS = +CXXVER = "icpc \( `$(CXX) -v 2>&1`\)" +IS_ICPC = 1 +CFLAGS = -I.. +LIBS = else -CFLAGS = -I.. -Wall -Wextra -Wfatal-errors -LIBS = -lm +CFLAGS = -I.. -Wall -Wextra -Wfatal-errors +LIBS = -lm endif #-------------------------------------------------- @@ -130,23 +133,23 @@ DEBUG_CFLAGS = -Dcimg_verbosity=3 -Dcimg_strict_warnings -g -fsanitize=address VT100_CFLAGS = -Dcimg_use_vt100 # Flags to enable code optimization by the compiler. -ifeq ($(notdir $(CXX)),g++) -OPT_CFLAGS = -Ofast -mtune=generic -else -ifeq ($(notdir $(CXX)),icpc) -OPT_CFLAGS = -fast -else OPT_CFLAGS = -Ofast +ifdef IS_GCC +OPT_CFLAGS = -Ofast -mtune=generic endif +ifdef IS_ICPC +OPT_CFLAGS = -fast endif # Flags to enable OpenMP support. -ifeq ($(notdir $(CXX)),icpc) -OPENMP_CFLAGS = #-Dcimg_use_openmp -openmp -i-static # -> Seems to bug the compiler! -else OPENMP_DEFINE = -Dcimg_use_openmp -fopenmp OPENMP_INCDIR = OPENMP_CFLAGS = $(OPENMP_DEFINE) $(OPENMP_INCDIR) +ifdef IS_ICPC +OPENMP_CFLAGS = #-Dcimg_use_openmp -openmp -i-static # -> Seems to bug the compiler! +endif +ifdef IS_CLANG +OPENMP_CFLAGS = endif # Flags to enable OpenCV support. @@ -266,7 +269,7 @@ LAPACK_CFLAGS = $(LAPACK_DEFINE) $(LAPACK_INCDIR) LAPACK_LIBS = -lblas -llapack # Flags to enable the use of the Board library -# ( http://libboard.sourceforge.net/ ) +# ( https://github.com/c-koi/libboard ) BOARD_DEFINE = -Dcimg_use_board BOARD_INCDIR = -I/usr/include/board BOARD_CFLAGS = $(BOARD_DEFINE) $(BOARD_INCDIR) @@ -287,9 +290,9 @@ endif @echo @echo "** Compiling '$* ($(VERSION))' with '$(CXXVER)'" @echo - $(CXX) -o $(EXEPFX)$*$(EXESFX) $< $(CFLAGS) $(CONF_CFLAGS) $(LIBS) $(CONF_LIBS) + $(CXX) -o $(EXE_PRE)$*$(EXE_EXT) $< $(CFLAGS) $(CONF_CFLAGS) $(LIBS) $(CONF_LIBS) ifeq ($(STRIP_EXE),true) - strip $(EXEPFX)$*$(EXESFX) + strip $(EXE_PRE)$*$(EXE_EXT) endif menu: @echo @@ -328,8 +331,8 @@ all: $(FILES) clean: rm -rf *.exe *.o *~ \#* $(FILES) $(EXTRA_FILES) -ifneq ($(EXEPFX),) - rm -f $(EXEPFX)* +ifneq ($(EXE_PRE),) + rm -f $(EXE_PRE)* endif # Custom user-defined target diff --git a/examples/scene3d.cpp b/examples/scene3d.cpp index ba05293a1a2b4ce14bb521c76fc8e7011e4f73de..f7ec4d101b28a4139b34dd3aa0e11d579233bba2 100644 --- a/examples/scene3d.cpp +++ b/examples/scene3d.cpp @@ -114,7 +114,7 @@ int main() { scene_pts.save_off(scene_prims,scene_cols,"output.off"); // Save 3D view in SVG, EPS and FIG files. - // (using the Board library : http://libboard.sourceforge.net/ ). + // (using the Board library : https://github.com/c-koi/libboard ). #ifdef cimg_use_board // Define a Board instance