ImgView v1.36
by Lonny Pursell
A YesCREW Production
(C)2021-2024 Lonny Pursell and ENCOM


Requirements
------------

NVDI 5.03 (lesser versions are buggy!)
Plugins for various image formats
AV Server for Drag & Drop, Thing Desktop is recommended
AES 4.1 with real toolbars recommended
  N.AES v2 was used for development (worth every penny)
MiNT 1.16.x or better recommended
Lots of ram, the more the better
Higher the resolution the better, recommend BlowUP030, or gfx card

This might be the first application made that leveraging the full power
of NVDI for dithering, scaling, and transforming images on the fly.  :oD
If I'm wrong please correct me.

So why the high requirements?
  I'm tired of coding around the limits of outdated setups, like doing fake
  popups or fake toolbars which add a bunch of bloat. I've decided to code
  for my setup and utilize direct system calls. If this program works for you,
  great, if not you're just out of luck. ;o)

-------------------------------------------------------------------------------

Official NVDI 5.03 update: http://www.nvdi.de/gb/Download/FRESHUP.TOS
Installer: https://docs.dev-docs.org/htm/search.php?find=NVDI+v5.03+%28HFE
Preinstalled copy: https://www.atari-forum.com/viewtopic.php?p=407051#p407051

NVDI note: Although NVDI supports the Falcon 16-bit mode it seems to render
           images as if it's RGB555. This causes extra banding with greens.
           There's an optional workaround for this.

-------------------------------------------------------------------------------

WARNING: fVDI is an unfinished project and ImgView will not run with it alone.
         A combination of fVDI + NVDI is required.
         Some options might still be unstable.
         Such issues can only be resolved if someone decides to finish fVDI.

         A CTPCI/Radeon setup must have all NVDI drivers disabled at
         \gemsys\nvdi*.sys per the CTPCI documentation.
         This is true with any setup that boots fVDI.

         I have no way to test under MagiC. Toolbar will be disabled.

-------------------------------------------------------------------------------

Intro
-----

If GEM-View and zView had a love child, this might be the result. :o)
GEM-View style log window and zView style windows.

It's basically an image viewer with some bonus features. It maintains an
internal 24-bit representation of the loaded image. All image manipulation
happens in 24-bit for maximum quality regardless of the video mode. What's
seen in the window is a representation of the 24-bit image.

Key features:

Compact size compared to other image viewers

Plugins are loaded and unloaded on the fly as needed

Plugins can be removed or added without restarting the app

Supports multi-file drag & drop (Drag & drop on any window)

Dithering, scaling, and transforming is handled entirely by NVDI
  Monochrome scaling works correctly

Should work in any video mode or graphics card

The original image remains in ram, most options use the original as the base
  Window content is the current video mode representation of the original

Images are remapped to the current video modes color palette
  256 color mode looks pretty good
  For best results use high-color or true-color modes

New easier to use plugin format
  In most cases they are about 1700 bytes smaller than the old LDG plugins

-------------------------------------------------------------------------------

Installation of plugins
-----------------------

Plugins must be installed at:
  c:\gemsys\plugin\

-------------------------------------------------------------------------------

Options
-------

Image Info
  Show info about original image

Plugin Info
  Show info about plugin used to load the image

Log Plugins
  Generates a text file log of all plugin data to: plugin.txt

Log - show or hide the log window (status is saved)

Dither - Dither options
  On   - always on (typically best results)
  Off  - always off
  Auto - tries to decide on it's own (results might not be the best)

BG - Determines the BackGround color when images are smaller than the window
  White
  Gray
  Black
  Custom (user defined background color)
  Note: Also used for alpha channel blending

16-bit: Determines how conversion is done for Falcon compaitible mode
  RGB555 (lower quality/faster) or RGB565 (higher quality/slower)
  Although NVDI supports the Falcon 16-bit mode it seems to render images as
  if it's RGB555. This causes extra banding with greens.

JPEG options
TIFF options
WeBP options
BG color options

Save cnf file
  Current dither mode
  Current background color
  Log window status and position
  JPEG options
  TIFF options
  WebP options
  Grayscale options
  Status of GEM effects
  Custom background color
  Mouse status during snapshots
  Snapshot output format
  Load priority
  16-bit RGB conversion method

Save Image
  Save original, presents a popup with only the plugins that support saving
    Saves the original image, not the window contents
    JPEG, TIFF, and WebP output options can be changed
  Save window, save the image as seen in the window (always outputs TGA Type 2)

-------------------------------------------------------------------------------

More options
------------

Crop: Hold the control key down and click hold the mouse button in the window,
      a rubber box will appear. Keep the control key down to complete the
      crop. Release the control key to abort the crop. This crops the original
      image stored off screen.

-------------------------------------------------------------------------------

Most options manipulate the original image stored off screen. A few options
change the window represention only, they are marked with [*].

Toolbar Icons (left to right)
-------------

Scale to window work area size                       [*]
Scale custom w/h (user defined w/h)                  [*]
Scale by width proportionally (height is calculated) [*]
  Double click doubles the width
Scale by height proportionally (width is calculated) [*]
  Double click doubles the height

Rotate left 90 degrees
Rotate right 90 degrees
Rotate clockwise x degress
Flip left to right
Flip top to bottom

Mirror right to left
Mirror top to bottom

Half image size (double click to double image size)  [*]
1:1 restore original image size                      [*]

Proportionally scale image to max window size                       [*]
View original image full screen without GEM (scaled down if needed) [*]
  Press any key to exit full screen view

Adjust brightness
Adjust tint
Invert RGB colors
Convert to grayscale (double click for options)
Pixelate image
Blur image
Emboss image (adjustable threshold)
  zero is the default, negative values go darker, positive values go lighter

Refresh window, if changing the dither mode, use this to force an update
  Double click to reload the image (window content is lost)

-------------------------------------------------------------------------------

Keyboard controls
-----------------

Control-I       Image info
Control-L       Log plugins
Control-O       Open image
Control-P       Plugin info
Control-Q       Quit program
Control-S       Save original (24-bit off screen buffer)
Control-U       Close top most image window
Control-W       Save window contents
Control-X       Close all image windows
-               Magnify down
+               Magnify up
*               Actual size (1:1)
Up arrow        Scroll image up
Down arrow      Scroll image down
Left arrow      Scroll image left
Down arrow      Scroll image right
G               Toggle GEM effects (growbox)
M               Cycle load priority (default: Standard 1st -> RECOIL 2nd)
N               Load next image in the directory
P               Load previous image in the directory
Undo            Reload image
ESCape          Full screen (no Gem)

Alternate key + click a toolbar icon, info line tells what the icon does

-------------------------------------------------------------------------------

RECOIL Notes
------------

This plugin supports 550+ formats and thus contains many duplicate file
extentions and thus treated as a special case. To work around this ImgView has
four load priority modes. These modes determine which plugins are used.

1) Standard (RECOIL is ignored)
2) Standard plugins are tried 1st, if no match, then it's passed to RECOIL 2nd
3) RECOIL only (all other plugins are ignored)
4) RECOIL is tried 1st, if no match, then it's passed to standard plugins

Mode 2 is the default mode because RECOIL won't load any modern formats.
However, because of file extension conflicts you might need to adjust the mode
to load a particular file. Simply press the 'M' key to toggle the mode.

Note: Load priorty is saved in the config.

If you prefer to have a particular format always loaded by RECOIL disable the
other plugin by renaming it *.ilx so a match isn't found.

Be aware that RECOIL decodes everything to full 32-bit and thus can require
lots of memory.

-------------------------------------------------------------------------------

Misc
----

No progress indicator, instead the mouse busy be is used
  progess bars of any kind slow down loading (log window shows some progress)

Supports images of any size, limited by memory
  Even with 256mb of fastram I can't load an image 8000 pixels wide

NVDI uses error diffusion (in addition, when reducing the size, interpolation
is used in this case so that the details are not completely lost in the
reduction).

Toolbar is automatically disabled under MagiC and SingleTOS

-------------------------------------------------------------------------------

What doesn't it do?
-------------------

PDF, those are sluggish even on ARAnyM
Animations, it will however load the first frame as an image

-------------------------------------------------------------------------------

Contact
-------

http://gfabasic.net/
http://www.facebook/lonny.pursell/

-------------------------------------------------------------------------------

Known issues
------------

Full screen seems to crash fVDI + NVDI

Developed with NAES v2, your milage my vary with other AES's.

Binary size stats (bytes, as of this writing):
ImgView          148212
GemView          333407
zView SLB build  404029
ImageCopyCD      484317
zView LDG build  807852
mm_pic          5596245
mm_recoil       1414513

-------------------------------------------------------------------------------

Change log
----------

1.00 12/26/2021 1st release
1.01 Added aspect ratio check, adjust toolbar to icon height (ST medium)
     Fixed full window option, didn't account for toolbar height
     Fixed plugin info 'support'
     Fixed CF build (some options crashed)
     Various optimizations
1.02 Minor cosmetic changes
     Various optimizations
     Minor bug fixes
     App is aware of animations, displays frame count
1.03 Slight improvement to exif filtering (UTF8 is not supported)
     Added P & N keys
     Limit total windows to 32
1.04 Toolbar disabled under MagiC (It might work)
1.05 Added proportional iconify (always dithered)
     Log window iconify reworked
     Fixed log window title going blank after iconify
     Experimental loading via external plugins. (disabled by default)
1.06 Small optimizations in the redraw routines
     Reworked log window management
     Lowered initial ram usage
1.07 No longer supports XaAES (window handle management breaks app)
     Detects MyAeS
1.08 Rebuilt with lastest GBE library
     Added GEM effects to dialogs (growbox)
     Added G key
     Added drag&drop protocol v1.1 (supports multi-file drops)
     Fixed AV Server showing as blank if missing
     Removed alert box if AV Server missing (falls back to drag&drop protocol)
     Internal changes to plugin structure
1.09 Added Undo key
     Fixed toolbar clicks in medium resolution
     Added plugin stats
1.10 Removed XaAES limits, gives a warning instead
1.11 Fixed error #71 when doing grayscale conversions
1.12 Rebuilt with latest library
     Fixed iconify if image was not at 0,0
     Fixed unhide deadlock
1.13 Fixed typo in error message
     Improved error reporting when saving images
     Added Webp opitons
     Rebuilt with latest library
1.14 Changes to plugin info
     Add plugin log option
     Added ESCape key option
1.15 Fixed save image popup string length error
     Improved sanity checks for plugin loading
     Disabled FPU options on the V4
     Rebuilt with GBE v3.73
1.16 Removed the V4 check
     Rebuilt with GBE v3.74 beta
1.20 Minor tweaks to saving images
     Rework save original popup
     Revised NVDI check
     Removed fVDI/XaAES warnings
     Brightness option recoded
     Tint option recoded
     Fixed wrong handle going into v_open_bm()
     Pass VDI handle to plugin
     Removed orientation check/code, plugin handles that
     Removed mono conversion method, components phased out
     Removed exif data handling
     Removed environment check, plugin path is hard coded
     Added missing shrink-box effects
     Fixed full window gadget redraw issue
     Fixed Atari's AES 4.1 detection
     TC iconify (MagiC not supported)
     New plugin API v2.00

1.21 Add custom background color
     Background color is sent to plugin (alpha channel support)

1.22 Changed 1st drop-down menu title to 'ImgView'
     Fixed mouse stuck as busy bee at startup on SingleTOS
     Fixed AV Server info showing up as "none)"
     Fixed illegal AES opcode at startup on SingleTOS
     Fixed toolbar enabled on SingleTOS
     Fixed menu_register() on SingleTOS
     Runs in all native ST modes, log window shrinks if needed
     Drop-down menus adjusted slightly for ST low resolution
     Moved image info to drop-down menu File (removed from toolbar)
     Moved plugin info to drop-down menu File (removed from toolbar)
     Moved save image to drop-down menu File (removed from toolbar)
     Fixed typo in an error message
     Added DHST protocol support if it's found
     Cache handling on the CT60 revised thanks to Mikro

1.23 Control-L didn't work
     Adjustments to some dialogs for SingleTOS
     Shortened some alerts for SingleTOS
     Special support for RECOIL plugin
     Support for plugins with very large stack requirements
     Raster support check done sooner in the startup phase
     Size of window info line slightly reduced
     Found 3 functions returning floats
     fVDI added to initial startup info

1.24 Changes to log window messages
     Improvements to image saving (added log window messages)
     Improved Radeon detection
     Added NOVA detection
     Added screen enhancer detection
     Save window moved to menu bar
     Updated to latest plugin API changes (AES Global)
     Compiled with GBE 3.74

1.25 If NVDI 5.03 is detected ignore vq_extnd() -> work_out(30) -> bit #1
       Now runs on the Milan and Firebee
     Fancy TC iconify icon disabled under XaAES (crashed on Firebee)

1.26 Added machine detection
     Fallback path on ext2 fs fixed (config read/write failed)
     Don't call pdomain() on SingleTOS

1.27 More strict toolbar check, issue with AES 4.0 fixed (MultiTOS)

1.28 Plugin error codes updated
     Don't call fsel_exinput() on older AES

1.29 Fixed pixel format showing up as [$0] with fVDI
     Fixed unstable issue with Thing Desktop crashing
     Rebuilt with GBE 3.74 pl1

1.30 CT60 detection fixed without MiNT
     Changed log window color count wording to match window info line
     Fixed bug in Save Window (palette based modes)
     Rebuilt with GBE 3.75b (faster palette conversions)

1.31 Save Window option is much faster (always Type 2)
     RECOIL 6.4.1 file extension tweak

1.32 Rebuilt with GBE 3.74 pl2
     Multi-file drag&drop command line fixed
     Supports quoted file names with AV-Protocol and MultiTOS drag&drop

1.33 Drag&drop paths are now ignored
     Save window even faster with aligned images
     Added screen snapshot (Targa Type 2)

1.34 Reworked dither options (reduce menu height)
     Reworked background color options (reduce menu height)
     Disable TC icon if AES < v3.3 (fixed endless loop with EmuTOS)
     Fixed wrong handle passed to v_open_bm()
     'Log' moved to 'Window' drop down menu
     Save popup entries are sorted
     Added 16-bit to Option drop down menu
     RECOIL 6.4.4 support
     Compiled with GBE 3.75 (beta)
     Yanked snapshot option (there's better tools for that)

1.35 Fixed readout of planes/colors in 15-bit video mode
     Fixed popup height calculation


1.36 V4SA+ MHz detection
     Internal changes to iconify
     Compiled with GBE 3.75 (beta)


*
