This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
c780fe4
commit 240de90
Showing
3 changed files
with
78 additions
and
75 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
86 changes: 71 additions & 15 deletions
86
JavaSource/resources/ferret/scripts/LAS_setup_watermark.jnl
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,26 +1,82 @@ | ||
! LAS_setup_watermark.jnl | ||
! Add the settings for a watermark image to the | ||
! quqlifiers in symbol set_window_quals | ||
! qualifiers in symbol set_window_quals | ||
! | ||
! If they asked for a watermark, place it on the page. This uses "plot inches" | ||
! expressed as fractions of 1000 measured from the upper-left corner. | ||
! Make a plot to load pplus symbols | ||
|
||
! How do we know what the size of the watermark image is? | ||
! Assume it's ~100 pixels; The LAS configurer creates the right size image? | ||
! The linux command returns the image info including size in pixels. | ||
! Ferret properties for the dataset, variable or the entire LAS: | ||
! * The image name | ||
! * The (approx) image size, in pixels. Assumes 100 if not given. | ||
! The linux command "identify" returns the image info including size in pixels: | ||
! identify -ping imagefile.png | ||
! | ||
! * A scale factor to use, default 1 | ||
! | ||
! * The opacity to use in percent, default 50 | ||
! | ||
! * Where to place the watermark within the image. These are defined here: | ||
! ulc, urc, llc, lrc upper left corner, upper right corner, lower left... | ||
! uli, uli, lli, lri upper left within the image, ... | ||
! More, such as centered along the bottom ? | ||
! | ||
! <ferret> | ||
! <wmark_image>/home/users/ansley/socat_cat.png</wmark_image> | ||
! <wmark_size>200</wmark_size> | ||
! <wmark_scale>0.5</wmark_scale> | ||
! <wmark_opacity>50</wmark_opacity> | ||
! <wmark_loc>lli</wmark_loc> | ||
! </ferret> | ||
! | ||
|
||
LET wmscale = 1 ! scale factor: | ||
LET wmopac = 50 ! percent opacity | ||
IF `($ferret_wmark_image"0|*>1") EQ 0` THEN EXIT/SCRIPT | ||
|
||
! Watermark in the upper left | ||
IF ($wmark"0|ul>1|*>0") THEN | ||
LET wmxloc = 5 ! pixels from upper left corner | ||
LET wmyloc = 5 ! pixels from upper left corner | ||
LET wmsize = ($ferret_wmark_size"100|*") ! image size | ||
LET wmscale = ($ferret_wmark_scale"1|*") ! scale factor to use | ||
LET wmopac = ($ferret_wmark_opacity"50|*") ! opacity to use | ||
|
||
|
||
! Location for the watermark within ghe plot | ||
|
||
! ulc, urc, llc, lrc for upper left corner, upper right corner... | ||
! By default, or if unrecognized value, use upper left corner | ||
|
||
DEFINE SYMBOL wmark_loc = ($ferret_wmark_loc"ulc|uli|ulc|urc|llc|lrc|uli|uli|lli|lri|*>ulc|uli") | ||
|
||
!!!! Right now the only one that works well is upper=left corner | ||
|
||
DEFINE SYMBOL wmark_loc = ulc | ||
|
||
! To account for the size of the watermark image. | ||
let fudge = wmscale* wmsize | ||
|
||
! Make a plot to get pplus symbols for this window | ||
|
||
shade/x=0:1/y=0:1/nolab/noax x+y | ||
|
||
show sym ppl$width, ppl$xorg, ppl$height, ppl$yorg | ||
DEFINE SYMBOL x_rt_margin = `($ppl$width) - ($ppl$xlen) - ($ppl$xorg)` | ||
DEFINE SYMBOL y_up_margin = `($ppl$height) - ($ppl$ylen) - ($ppl$yorg)` | ||
|
||
show sym ppl$width, ppl$xlen, ppl$xorg, x_rt_margin | ||
show sym ppl$height, ppl$ylen, ppl$yorg, y_up_margin | ||
|
||
|
||
! Watermark in the upper left corner | ||
IF ($wmark_loc"0|ulc>1|*>0") THEN | ||
LET wmxloc = 5 | ||
LET wmyloc = 5 | ||
ENDIF | ||
|
||
! Watermark in the lower left | ||
IF ($wmark"0|ll>1|*>0") THEN | ||
LET wmxloc = 5 ! pixels from upper left corner | ||
LET wmyloc = pix_y - 100 ! pixels from upper left corner | ||
! Watermark in the lower left corner | ||
IF ($wmark_loc"0|llc>1|*>0") THEN | ||
LET wmxloc = 5 | ||
LET wmyloc = 100* (($ppl$ylen) + ($y_up_margin)) - fudge | ||
ENDIF | ||
|
||
IF ($wmark"0|*>1") THEN DEFINE SYMBOL set_window_quals = ($set_window_quals)\ | ||
|
||
DEFINE SYMBOL set_window_quals = ($set_window_quals)\ | ||
/wmark="($ferret_wmark_image)"/wmscale=`wmscale`/wmopac=`wmopac`/wmxloc=`wmxloc`/wmyloc=`wmyloc` | ||
|
||
SET WINDOW/CLEAR |
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