A little Java help please.


Posting rules: It shouldn't need saying, but... play nice. Please keep your discussions civil. You can disagree, just don't be disagreeable. And, of course, all of the usual stuff like no spamming. Tex adds: I'll be rigorously enforcing this as we go along. We're probably going to be a small community in a little lifeboat, so we can't have members at each others' throats. This is for the sake of the project as a whole. So when you post, pretend you're speaking in person with your very wealthy auntie who has always treated you wonderfully and currently lists you prominently in her will. I won't be tossing anyone out of the forums because we are all in this together (except spammers: immediate membership cancelation), but I'll delete suspect posts right away.


14 posts / 0 new
Last post
jknights
A little Java help please.

In the Wish List part of the forum there is a topic (http://lightzoneproject.org/lorum/add-graph-tone-curve-alternative-adams...) that had a long discussion but because it seemed to challenge the concept of LightZone namely Zones and there seemed to be frantic cries of heresy coming from some parts at the thought of Zones being used with Curves so there was a lot of resistance to adding this feature.  I find it strange that people are open minded as long as they get what they want alone, but wont consider alternatives or combinations of something else with their solution for use by other people.

Can I remind people that Galileo was nearly burned as a heretic for saying the Earth went around the Sun!!!!  Whilst there are still some people who believe the old Church view that the Sun goes round the Earth, most sane people dont!

 

I suggested an alternative compromise solution might be .........

"If I could see Zones tab, Histogram tab and the Sampler tab simultaneously.  I could probably work with just the Zones and Histogram tab being visible.  This then provides a huge amount of information so you could adjust and see visual data changes changes to Zones and Histogram.

One other item is would it be able to make it possible to rotate the ZoneMapper representation by a 90 degree clockwise rotation.
This would seem to be as simple as providing a checkbox in the interface that allowed a rotate of the tab by 90 degrees clockwise."

 

I am NOT a Java programmer but I am sure that if someone pointed me at the relevant code block I could start to learn.

 

So this post has a two fold request for help.

 

1.   Please can someone point me to a section (file name and location in the directory structure) in the source code where I could identify the UI presentation for the LZ UI when in the Edit mode that displays the four tabs (Sampler, Histogram, Color Mask and Zones).  Once there I can try to understand how it is controlled and displayed.

2.  I would like to be able to try and see if I can implement my compromise suggestion (above) and test it in use on my machine.

 

Thanks in advance for any help.

 

ktgw0316
Hello jjknights, it is great

Hello jjknights, it is great to hear your interest for the LZ code.

 

As for the Preview tabs on top-right in the window, you need to look into (at least)

  • com.lightcrafts.ui.editor.PreviewTabs

and

  • com.lightcrafts.model.ImageEditor.ZoneFinder
  • com.lightcrafts.model.ImageEditor.ColorSelectionPreview
  • com.lightcrafts.model.ImageEditor.HistogramPreview
  • com.lightcrafts.model.ImageEditor.DropperPreview

classes. You'll find them in folders under lightcrafts/src/.

As for the "rotated ZoneMapper", you may be interested in classes in package com.lightcrafts.ui.operation.zone.

 

I don't think it matters if you are a Java programmer or not. When I started to look into the LZ code last year, I was just a Japanese translator but not a programmer. ;)

 

Masahiro

jknights
Thanks Masahiro.

Thanks Masahiro.

I will start looking there.

I have my Java book to help me and also I have some knowledge of other programming languages (BASIC, COBOL, C, Pascal, C++) but from many years ago!

 

Thanks I will be looking further over the next few weeks when I have more time.

 

jknights
I have looked at the module

I have looked at the module com.lightcrafts.ui.editor.PreviewTabs  but I cant understand the section that says how the tabs should be handled/displayed.  I guess there must be a sub-class that handles the behaviour of the pane that displays the individual tools.

I guess what I need to do is find that sub-class and change its behaviour so that it displays all the tools.

 

What I am trying to do is have a display like this.

https://dl.dropboxusercontent.com/u/55165434/LightZone%20proposed%20scre...

 

 

Also once I have made the changes is there a cheat sheet as to how to compile this for Mac ?  I am totally unfamiliar with this portion.  I guess that there is a java compiler or object code parser.

 

ktgw0316
Build instruction for Mac OS X

There's an instruction by jdmonin on LZ github wiki:

https://github.com/Aries85/LightZone/blob/master/macosx/BUILD-macosx.md

but it is somewhat outdated, for instance JAI jar is not required and some other libraries are required now.

I'll update the instruction in this weekend, if I can.

ktgw0316
I've just updated the

I've just updated the instruction.

jknights
Thanks Masahiro.

Thanks Masahiro.

The new instructions look very clear and easy to follow.

 

I am looking at the code and still cant see how to control the display pane for the four tools (ZoneFinder, Color Selection, Histogram,Dropper).  I must be looking at the wrong place as it should be (my confused logic) in the Tabbed Pane control properties section.   I am starting to think that this must be a base level property so it would require a different handling of the pane.  Instead I would need to show four floating but resizeable pane windows with each individual tool being updated in these pane windows.

 

I think that I may have found the control code that I need in /source/com/lightcrafts/app/EditorLayout.java as this describes the layout of the Editor window and its panels but I may also need to investigate other lower level controls.

I am more used to reading UML Object Model diagrams.

Please can you comment on this.  (my brain hurts!!).

 

jknights
OK with some external help I

OK with some external help I think that I have managed to code what I want to do which is to have an additional/alternative panel that shows all four tools.

 

Please can someone review the REVISED code for the PreviewTabs.java attached here.

OK try this link instead.

https://www.dropbox.com/s/679nkj6ekaw3264/Lightzone%20changes.zip?dl=0

 

 

Will this work ?

 

 

 

 

ktgw0316
I couldn't download the file.

I couldn't download the file. That link only shows a page with "The resource could not be found." message.

jknights
OK.  Sorry I thought that I

OK.  Sorry I thought that I had checked the link worked.

 

Try this one.  It seems to work.

https://www.dropbox.com/s/679nkj6ekaw3264/Lightzone%20changes.zip?dl=0

 

 

jknights
I tried to do a build with

I tried to do a build with the revised code.

ant clean   was sucessful  :-)

ant build failed   

I have Orcle JDK8SE (Java 1.8) installed, I am using Mavericks 10.9.4 and I cant find the Java Preferences app that will allow me to append to the path JAVA_HOME = /Library/Java/Home

I have been able to set the JAVA_HOME using some commands

Set JAVA_HOME using this command in Terminal: export JAVA_HOME=/Library/Java/Home
Then echo $JAVA_HOME    in Terminal to confirm the path
 

I think I am a little out of my depth!!.

 

I got this from the Terminal.

Last login: Thu Aug 28 00:24:42 on ttys000
server:macosx jonathan$ export JAVA_HOME=/Library/Java/Home
server:macosx jonathan$ echo $JAVA_HOME
/Library/Java/Home
server:macosx jonathan$ ant clean
Buildfile: /Volumes/MacPro1/LightZone source code/New_Revised_code_set/macosx/build.xml

distclean:

clean-up:

distclean:

clean-up:
     [exec] -----> Entering jniutils
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libLCJNI.dylib.dSYM
     [exec] rm -fr libLCJNI.dylib  libLCJNI-ppc.dylib libLCJNI-x86.dylib 
     [exec] -----> Leaving jniutils
     [exec] -----> Entering arrays
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libLCArrays.jnilib.dSYM
     [exec] rm -fr libLCArrays.jnilib  libLCArrays-ppc.jnilib libLCArrays-x86.jnilib 
     [exec] -----> Leaving arrays
     [exec] -----> Entering cache
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libLCCache.jnilib.dSYM
     [exec] rm -fr libLCCache.jnilib  libLCCache-ppc.jnilib libLCCache-x86.jnilib 
     [exec] -----> Leaving cache
     [exec] -----> Entering dcraw
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libDCRaw.jnilib.dSYM
     [exec] rm -fr libDCRaw.jnilib  libDCRaw-ppc.jnilib libDCRaw-x86.jnilib 
     [exec] -----> Leaving dcraw
     [exec] -----> Entering EDISON
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libSegment.jnilib.dSYM
     [exec] rm -fr libSegment.jnilib  libSegment-ppc.jnilib libSegment-x86.jnilib 
     [exec] -----> Leaving EDISON
     [exec] -----> Entering fileutil
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libLCFileUtil.jnilib.dSYM
     [exec] rm -fr libLCFileUtil.jnilib  libLCFileUtil-ppc.jnilib libLCFileUtil-x86.jnilib 
     [exec] -----> Leaving fileutil
     [exec] -----> Entering jai
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libJAI.jnilib.dSYM
     [exec] rm -fr libJAI.jnilib  libJAI-ppc.jnilib libJAI-x86.jnilib 
     [exec] -----> Leaving jai
     [exec] -----> Entering fast_jai
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libFASTJAI.jnilib.dSYM
     [exec] rm -fr libFASTJAI.jnilib  libFASTJAI-ppc.jnilib libFASTJAI-x86.jnilib 
     [exec] -----> Leaving fast_jai
     [exec] -----> Entering fast_bilateral
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libfbf.jnilib.dSYM
     [exec] rm -fr libfbf.jnilib  libfbf-ppc.jnilib libfbf-x86.jnilib 
     [exec] -----> Leaving fast_bilateral
     [exec] -----> Entering jpeg
     [exec] /Applications/Xcode.app/Contents/Developer/usr/bin/make --no-print-directory  -f lcjpeg.mk distclean
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libLCJPEG.jnilib.dSYM
     [exec] rm -fr libLCJPEG.jnilib  libLCJPEG-ppc.jnilib libLCJPEG-x86.jnilib 
     [exec] -----> Leaving jpeg
     [exec] -----> Entering lcms
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libLCMS.jnilib.dSYM
     [exec] rm -fr libLCMS.jnilib  libLCMS-ppc.jnilib libLCMS-x86.jnilib 
     [exec] -----> Leaving lcms
     [exec] -----> Entering tiff
     [exec] /Applications/Xcode.app/Contents/Developer/usr/bin/make --no-print-directory  -f lctiff.mk distclean
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libLCTIFF.jnilib.dSYM
     [exec] rm -fr libLCTIFF.jnilib  libLCTIFF-ppc.jnilib libLCTIFF-x86.jnilib  autom4te.cache configure config.* tif_config.h
     [exec] -----> Leaving tiff
     [exec] -----> Entering dcraw
     [exec] rm -fr *.o .*.d
     [exec] rm -fr ../../products/dcraw dcraw-ppc dcraw-x86
     [exec] -----> Leaving dcraw
     [exec] -----> Entering forkdaemon
     [exec] rm -fr *.o .*.d
     [exec] rm -fr ../../products/LightZone-forkd LightZone-forkd-ppc LightZone-forkd-x86
     [exec] -----> Leaving forkdaemon
     [exec] rm -fr

distclean:
     [exec] if [ -d /Volumes/LightZone-prototype ]; then hdiutil detach /Volumes/LightZone-prototype; fi
     [exec] rm -fr LightZone-prototype.dmg
     [exec] if [ -f /Volumes/LightZone/prototype_flag ]; then rm -fr /Volumes/LightZone; fi
     [exec] if [ -d /Volumes/LightZone ]; then hdiutil detach /Volumes/LightZone; fi
     [exec] if [ -d /Volumes/LightZone-temp ]; then hdiutil detach /Volumes/LightZone-temp; fi
     [exec] rm -fr LightZone-temp.dmg
     [exec] if [ -d /Volumes/LightZone\ 1 ]; then hdiutil detach /Volumes/LightZone\ 1; fi
     [exec] rm -fr LightZone.dmg LightZone.iso
     [exec] -----> Entering CrashReporter
     [exec] rm -fr *.o .*.d
     [exec] rm -fr CrashReporter CrashReporter-ppc CrashReporter-x86 CrashReporter.app
     [exec] -----> Leaving CrashReporter
     [exec] -----> Entering JavaAppLauncher
     [exec] rm -fr *.o .*.d jar_md5_include
     [exec] rm -fr JavaAppLauncher JavaAppLauncher-ppc JavaAppLauncher-x86
     [exec] -----> Leaving JavaAppLauncher
     [exec] -----> Entering libMacOSX
     [exec] rm -fr *.o .*.d javah *-ranlib.a *.dSYM *.res libMacOSX.jnilib.dSYM
     [exec] rm -fr libMacOSX.jnilib  libMacOSX-ppc.jnilib libMacOSX-x86.jnilib 
     [exec] -----> Leaving libMacOSX
     [exec] rm -fr

cc-clean:

clean:

BUILD SUCCESSFUL
Total time: 10 seconds

 

server:macosx jonathan$ ant build
Buildfile: /Volumes/MacPro1/LightZone source code/New_Revised_code_set/macosx/build.xml

common:

javac:
     [exec] ln -fs "../lib/script-api.jar" "script-api.jar"
     [exec] ln -fs "../lib/substance-lite.jar" "substance-lite.jar"
    [mkdir] Created dir: /Volumes/MacPro1/LightZone source code/New_Revised_code_set/lightcrafts/extbuild
    [javac] Compiling 846 source files to /Volumes/MacPro1/LightZone source code/New_Revised_code_set/lightcrafts/extbuild
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [mkdir] Created dir: /Volumes/MacPro1/LightZone source code/New_Revised_code_set/lightcrafts/build
    [javac] Compiling 1042 source files to /Volumes/MacPro1/LightZone source code/New_Revised_code_set/lightcrafts/build
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

coprocesses:
     [exec] -----> Entering dcraw
     [exec] gcc -MM -DAUTO_DEP -DNODEPS -DLIGHTZONE -Dfgetc=getc_unlocked -D_DARWIN_C_SOURCE -D__DARWIN_C_LEVEL=199506L -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk   dcraw.c | sed "s!^\([^ :]*\):!\1 .dcraw.d : !" | sed 's/\(\w\):/\/cygdrive\/\L\1/g' > .dcraw.d; [ -s .dcraw.d ]  || rm -fr .dcraw.d
     [exec] clang: warning: argument unused during compilation: '-fopenmp'
     [exec] gcc -c -g -march=core2 -mtune=generic -O3 -fno-trapping-math -fomit-frame-pointer -msse2 -mfpmath=sse -fopenmp  -DNODEPS -DLIGHTZONE -Dfgetc=getc_unlocked -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk   dcraw.c
     [exec] dcraw.c:1025:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
     [exec]           else ip[col][c] = (ip[col-width][c] + ip[col+width][c] + 1) >> 1;
     [exec]           ^
     [exec] dcraw.c:9239:41: warning: data argument not used by format string [-Wformat-extra-args]
     [exec]         _("Converting to %s colorspace...\n"), name[output_color-1]);
     [exec]                                                ^
     [exec] dcraw.c:9644:29: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
     [exec]       case 'F':  ofbase     = argv[arg++];  break;
     [exec]                             ^ ~~~~~~~~~~~
     [exec] dcraw.c:9935:44: warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int]
     [exec]       write_ext = ".pgm\0.ppm\0.ppm\0.pam" + colors*5-5;
     [exec]                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
     [exec] dcraw.c:9935:44: note: use array indexing to silence this warning
     [exec]       write_ext = ".pgm\0.ppm\0.ppm\0.pam" + colors*5-5;
     [exec]                                            ^
     [exec]                   &                        [         ]
     [exec] mkdir -p ../../products
     [exec] gcc -g -march=core2 -mtune=generic -O3 -fno-trapping-math -fomit-frame-pointer -msse2 -mfpmath=sse -fopenmp  -DNODEPS -DLIGHTZONE -Dfgetc=getc_unlocked -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L../../../lightcrafts/products   -o ../../products/dcraw *.o 
     [exec] 4 warnings generated.
     [exec] ld: library not found for -lgomp
     [exec] clang: error: linker command failed with exit code 1 (use -v to see invocation)
     [exec] make[1]: *** [../../products/dcraw] Error 1
     [exec] make: *** [all] Error 1

BUILD FAILED
/Volumes/MacPro1/LightZone source code/New_Revised_code_set/macosx/build.xml:31: The following error occurred while executing this line:
/Volumes/MacPro1/LightZone source code/New_Revised_code_set/lightcrafts/build.xml:73: exec returned: 2

Total time: 20 seconds
server:macosx jonathan$

 

 

 

Help.... What do I do to fix this ?

 

 

Seems like there is a library -lgomp missing.

ktgw0316
It seems that XCode's gcc

It seems that XCode's gcc doesn't support OpenMP. I think that the easiest way to make it work is:

brew tap homebrew/versions
brew install gcc49
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/gcc
ln -s /usr/local/bin/g++-4.9 /usr/local/bin/g++

then make sure that output from "which gcc" is "/usr/local/bin/gcc".

Hope this helps.

jknights
Now I get this error.

I did as you suggested above.

Now I get this error.

 

server:macosx jonathan$ bash setJavaHome.sh

/Library/Java/Home
server:macosx jonathan$ ant build
Buildfile: /Volumes/MacPro1/LightZone source code/New_Revised_code_set/macosx/build.xml

common:

javac:
     [exec] ../../lightcrafts/mk/platform.mk:12: *** "JAVA_HOME" must be set.  Stop.

BUILD FAILED
/Volumes/MacPro1/LightZone source code/New_Revised_code_set/macosx/build.xml:31: The following error occurred while executing this line:
/Volumes/MacPro1/LightZone source code/New_Revised_code_set/lightcrafts/build.xml:51: exec returned: 2

Total time: 0 seconds
server:macosx jonathan$

 

Seems like Java_Home needs to be somewhere else apart from    /Library/Java/Home

 

jknights
Oh dear I am stalled. 

Oh dear I am stalled. 

I cant find a way out of this compile issue.