#!/bin/ksh ## ## Script: sgiscrn_blur_proc ## in $FEDIR/scripts ## where FEDIR=/apps/nns_com/fea ########################################################################## ## ## Purpose: To handle 'blur' processing for several 'sgiscrn2' utility ## programs. Optionally, uses 'xconfirm' to prompt whether ## blurring is wanted and what degree (NONE,MEDIUM,HEAVY). ## ## Uses the SGI 'blur' program that comes with IRIX. ## This is a poor-man's anti-aliasing (removal of jaggies). ########################################################################## ## ## Called by: 1) sgiscrn2hpjetPlotAB ## 2) sgiscrn2hpjetPlotBig ## 3) sgiscrn2postscrPlotAB ## 4) sgiscrn2postscrPlotBig ## 5) sgiscrn2rasterfil, which is called by ## sgiscrn2gif, sgiscrn2tiff, sgiscrn2pcx, sgiscrn2bmp, etc. ## ########################################################################## ## Call format: . $FEDIR/scripts/sgiscrn_blur_proc ## (note the leading dot) ## ## See the internals of the above calling scripts ## for examples of the calling format. ## ########################################################################## ## Input-Output: ## Expects the following variables to be set by the calling ## script: ## ## $BLURLEV (if null, this script does 'xconfirm' prompt) ## $WINGEOM $WINFONT $WINTITLE $CHOICES (xconfirm window vars) ## ## $TEMPRGB name of output .rgb file ## $TEMPRGB2 name of temporary work .rgb file ## ########################################################################## ## Development/Maintenance Notes: ## ## For some history of the development of the options ## within this script, see this section of the scripts ## 'sgiscrn2hpjetPlotAB' & 'sgiscrn2hpjetPlotBig'. ## ## Written by: Blaise Montandon E40/C61 29Sep98 based on 'BLURLEV' section ## of first generation sgiscrn2rasterfil. ## Updated by: Blaise Montandon E40/C61 23Nov98 add WINFONT on xconfirm's ## ########################################################################## ########################################################################## ####### Prompt for blur 'level' if BLURLEV not previously set ############ ####### (uses an 'xconfirm' window for the prompt) ############ ########################################################################## if test "$BLURLEV" = "" then BLURLEV=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ $WINFONT \ -B NONE -b MEDIUM -b HEAVY \ -t "$CHOICES" \ -t "" \ -t " BLUR THE IMAGE? -- to attempt to reduce 'jaggies'." \ -t "" \ -t " OPTIONS: NONE, MEDIUM, HEAVY" \ -t "" \ -t " Warning: Blur will reduce the resolution of text and lines." \ -t " But it can soften jaggies on shaded images." \ -t "" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi CHOICES=$CHOICES" Blur=$BLURLEV" ########################################################################## ############ Do the 'Blur' on $TEMPRGB, ############################## ############ if $BLURLEV is MEDIUM or HEAVY ############################## ########################################################################## if test ! "$BLURLEV" = "NONE" then /usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ $WINFONT \ -B DISMISS \ -t "The BLUR OPERATION will take several seconds. Dismiss me." \ -icon warning & fi IMGX=`/usr/sbin/imgsize $TEMPRGB | awk '{print $1}'` IMGY=`/usr/sbin/imgsize $TEMPRGB | awk '{print $2}'` if test "$BLURLEV" = "MEDIUM" then /usr/sbin/blur $TEMPRGB $TEMPRGB2 $IMGX $IMGY /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi if test "$BLURLEV" = "HEAVY" then IMGX2=`echo "scale = 10; 0.60*$IMGX" | bc` IMGY2=`echo "scale = 10; 0.60*$IMGY" | bc` /usr/sbin/blur $TEMPRGB $TEMPRGB2 $IMGX2 $IMGY2 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi