/*
 * Make3Dpic v1.3
 * Arexx Macro for use with ImageFX
 *
 * Makes a 3D picture for use with Red & Blue glasses.
 * Must be rendered in Imagine with Stereo3D turned on.
 * (or in any program that generates pictures in X-Specs Format)
 *
 *
 * Written By Torgeir Holm ©1994
 *
 * For comments and feedback: torgeir.holm@tbc.powertech.no
 *
 */

OPTIONS RESULTS

DrawMode Normal
Blend 100
EdgeMode Normal 0
FillMode Solid 0 0 0 SMOOTH

SaveUndo ; Undo Off ; Redraw off

GetMain
PARSE VAR result name width height depth

/* Ask for Image Type */

Gadget.1 = 'Choose type of image:'
Gadget.2 = 'Monochrome'
Gadget.3 = 'Color'

ListRequest 3 Gadget
IF rc ~= 0 THEN EXIT 0
type = result

/* Convert image */

/* Separate the Left and Right Image.*/

w = width
h = (height/2)
a = (height/2+1)
Crop 0 0 w h TOSWAP
Crop 0 a w h

/* Monochrome process */

IF type == 2 THEN DO

  /* Make Red & Cyan buffers*/

  Buffer2Alpha
  ClearBuffer 0 0 0 FORCE
  ActiveColor 4
  MenuPalette
  SetPalette '-1' 0 255 255
  MenuToolbox
  AlphaChannel Frisket
  FloodFill 1 1 255
  Brightness '64'

  Swap

  Buffer2Alpha
  ClearBuffer 0 0 0 FORCE
  ActiveColor 5
  MenuPalette
  SetPalette '-1' 255 0 0
  MenuToolbox
  FloodFill 1 1 255
  Brightness '64'


  /* Combine the Images to make 3D image */

  Add

  /* Delete unwanted stuff */

  AlphaChannel Off
  KillAlpha
  KillSwap

END

/* Color process */

IF type == 3 THEN DO

  /* Make Red & Cyan buffers*/

  Negative
  ActiveColor 5
  MenuPalette
  SetPalette '-1' 255 0 0
  MenuToolbox
  Drawmode Add
  FloodFill 1 1 255
  Negative

  Swap

  Negative
  ActiveColor 4
  MenuPalette
  SetPalette '-1' 0 255 255
  MenuToolbox
  FloodFill 1 1 255
  Negative

  /* Combine the Images to make 3D image */

  Add

  /* Delete unwanted stuff */

  KillSwap

End

Undo On ; Redraw On
Drawmode Normal

EXIT
