Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / Win32

Persian Gulf in 3D Anaglyph

Rate me:
Please Sign up or sign in to vote.
4.99/5 (74 votes)
12 Aug 2013CPOL19 min read 96.9K   5.4K   70  
This application uses some simple 2D methods to make 3D scenes which can be seen with Red/Cyan Anaglyph glasses.
  • Anaglyph_demo2.zip
    • Anaglyph
      • Animals
        • animal30.png
        • Animals-135.png
        • Animals-159.png
        • bird-uid-1075390.png
        • bird-uid-1077009.png
        • Blacktail-Deer.png
        • Creatures-uid-1013075.png
        • dog-uid-1080734.png
        • flying-eagle-uid-1076271.png
        • IMG_0777.png
        • Just-a-Sip,-Impala.png
        • Large-black-dog-sitting.png
        • Masai-Giraffe,-Masai-Mara,-Kenya.png
        • Morning-Howl,-Howling-Wolf.png
        • Red_breasted_Robin_1024.png
        • seagull-on-a-post-uid-1080705.png
        • Spotted-Reflections-at-the-Watering-Hole,-Leopard,-Africa.png
        • The-Lookout,-Leopard.png
        • Thumbs.db
      • Birds
        • bird-uid-1077229.png
        • bird-uid-1077233.png
        • flying-eagle-uid-1076267.png
        • Goose_flying.gif
        • Thumbs.db
      • Clouds
        • 25vc.png
        • 39.png
        • 89.png
        • Champagne-Pool,-Waiotapu-Thermal-Area,-North-Island,-New-Zealand.png
        • Chia-Da-Range,-Tibet.png
        • Columbus-Skyline,-Ohio.png
        • Drifters.png
        • Edith-Lake,-Jasper-National-Park,-Canada.png
        • Exploring-the-Crystal-Clear-Water.png
        • God's-Rays.png
        • Grand-Sable-Dunes,-Michigan.png
        • Heart-of-Polynesia,-Cook-Islands.png
        • Island-of-Tahaa,-French-Polynesia.png
        • Painted-Hills,-Oregon.png
        • Peaceful-Formations,-Ocean-Beach,-Californi2a.png
        • Peaceful-Formations,-Ocean-Beach,-California.png
        • Rapeseed-Field,-Idaho.png
        • Tahiti,-French-hhPolynesia.png
        • Tahiti,-French-Polynesia.png
        • Taro-Fields-of-Hanalei,-Kauai.png
      • Fishes
        • A-Whale-of-a-Tail.png
        • dolphin06.png
        • Dolphin1.png
        • shark1.png
      • Flowers
        • 31ed164f37501f53db60bbf1cd855b28[1].png
        • Chicory-flower-L1.png
        • flower1.png
        • flower5.png
        • hd.png
        • leaf-31.png
        • Northern-Geranium,-Alaska.png
        • Orange-Hibiscus.png
        • Orchids-of-the-World-0062.png
        • plantstalk-uid-1111070.png
        • Pressed-wildflower-L6.png
        • Thumbs.db
        • Vinca.png
        • Water-Lily01.png
        • Wild-Rose-Against-a-Red-Pine,-Canada.png
      • Ground
        • dfr.jpg
        • DSC03495.JPG
        • DSC03499.JPG
        • DSC03787.JPG
        • Thumbs.db
      • Misc
        • Arash.png
        • bolbol.png
        • BUTERFLY.png
        • cro.png
        • F22.png
        • home.png
        • IMG_3589.png
        • kavir.png
        • moon.png
        • Prehistoric-World-0059.png
        • propeller-7.png
        • snail.png
        • snowman.png
        • sun.png
        • swan.png
      • Sky
        • 46.jpg
        • 47.jpg
        • Clouds-149.png
        • Cumulus-clouds-4.png
        • Eternal Sky.jpg
        • Masai Mara Game Reserve, Kenya.jpg
        • Nature-144.jpg
        • Vegetation.jpg
  • Anaglyph_demo3.zip
    • Humans
      • DSC03448.png
      • DSC03511.png
      • DSC03515.png
      • DSC03794.png
      • IMG_0178.png
      • IMG_0205.png
      • IMG_0778.png
      • IMG_0813.png
      • IMG_1467.png
      • IMG_1532.png
      • IMG_1535.png
      • IMG_4022.png
      • IMG_4212.png
      • IMG_4243.png
      • IMG_4665.png
      • IMG_4665x.png
      • Rocks
        • 0207_vietnam.png
        • 0607_thai_4.png
        • 6.png
        • 62.png
        • 64.png
        • 78.png
        • 89.png
        • 91.png
        • 97.png
        • Aerial-View,-Mount-McKinley,-Alaska.png
        • Alpenglow-on-Peak-Chugach-Mouggntains,-Alaska.png
        • Alpenglow-on-Peak-Chugach-Mountains,-Alaska.png
        • Bachsee,-Wetterhorn,-Schreckhorn,-Switzerland.png
        • Besso,-Ober-Gablethorn,-and-Matterhorn,-Switzerland.png
        • MountCookNewZealand.png
        • Mt.png
        • Natural-Beauty,-Banff-National-Park,-Alberta,-Canada.png
        • Prusik-Peak-and-Gnome-Tarn,-Alpine-Lakes-Wilderness,-Washington.png
        • rockdd4.png
        • San-Juan-Mountains,-Colorado.png
        • Teton-Barn,-Antelope-Flats,-Jackson-Hole,-Wyoming.png
        • Top-Class-Mountains-(17).png
        • Top-Class-Mountains-(2).png
        • Torres-Del-Paine-National-Park,-Chile.png
        • Wallpaper-1080p-(64).png
        • Wind-Shear,-Matterhorn,-Switzerland.png
  • Anaglyph_demo4.zip
    • 3D
      • IMG_069dd5.JPG
      • IMG_073d7.JPG
      • Ships
        • 36.png
        • 73.png
        • 88.png
        • Nature-136.png
        • Noorderlicht,-Spitzberg,-Norway.png
        • submarine2.png
      • Snow
        • snow0.png
        • snow2.png
        • snow3.png
        • snow4.png
        • snow5.png
      • Trees
        • cadyou.com_Autumn Tree.png
        • Eucalyptus.png
        • Greenhouse-Palm-acai01.png
        • Jacaranda.png
        • Palm-arecaceae.png
        • Sophora.png
        • Thumbs.db
        • tree336.png
      • Water
        • 25912.jpg
        • 77.jpg
        • Cabo San Lucas, Mexico.jpg
        • Carlsbad, California.jpg
        • Nature-100.jpg
        • Newport Beach, California.jpg
        • Victoria Beach, Laguna Beach, California.jpg
        • water1.jpg
  • Anaglyph_demo1e.zip
  • Anaglyph_photoshop.zip
    • anaglyph-test1.psd
    • anaglyph-test2.psd
    • anaglyph-test3.psd
  • Anaglyph_src4.zip
    • Anaglyph.sln
    • Anaglyph.suo
    • Anaglyph
      • Anaglyph.csproj
      • app.config
      • bin
        • Debug
          • Animals
            • bird-uid-1077009.png
            • dog-uid-1080734.png
            • flying-eagle-uid-1076271.png
            • Red_breasted_Robin_1024.png
            • Spotted-Reflections-at-the-Watering-Hole,-Leopard,-Africa.png
            • Thumbs.db
            • Birds
              • bird-uid-1077229.png
              • flying-eagle-uid-1076267.png
              • Thumbs.db
            • Clouds
              • 25vc.png
              • Peaceful-Formations,-Ocean-Beach,-Californi2a.png
              • Tahiti,-French-hhPolynesia.png
            • Fishes
              • A-Whale-of-a-Tail.png
              • dolphin06.png
              • Dolphin1.png
              • shark1.png
            • Flowers
              • Orange-Hibiscus.png
              • plantstalk-uid-1111070.png
              • Pressed-wildflower-L6.png
              • Thumbs.db
            • Ground
              • Thumbs.db
            • Misc
              • BUTERFLY.png
              • F22.png
              • sun.png
            • Rocks
              • 0207_vietnam.png
              • 78.png
              • rockdd4.png
            • Ships
              • 73.png
            • Snow
              • snow0.png
              • snow2.png
              • snow3.png
              • snow4.png
              • snow5.png
            • Trees
              • Thumbs.db
        • clsData.cs
        • frmAbout.cs
        • frmAbout.designer.cs
        • frmAbout.resx
        • frmEdit.cs
        • frmEdit.Designer.cs
        • frmEdit.resx
        • frmEditObjects.cs
        • frmEditObjects.Designer.cs
        • frmEditObjects.resx
        • frmEditOver.cs
        • frmEditOver.Designer.cs
        • frmEditOver.resx
        • frmMain.cs
        • frmMain.designer.cs
        • frmMain.resx
        • frmObject.cs
        • frmObject.designer.cs
        • frmObject.resx
        • frmSelection.cs
        • frmSelection.designer.cs
        • frmSelection.resx
        • Program.cs
        • Properties
        • Resources
          • _3D_farsian.JPG
          • _3D_galikesh.JPG
          • _3D_kavir.jpg
          • 008_Reminder_32x42_72.png
          • 009_HighPriority_48x48_72.png
          • 009_HighPriority_48x48_721.png
          • 010_LowPriority_32x32_72.png
          • 037_Colorize_32x32_72.png
          • 05dx.png
          • 05x.png
          • 0710.png
          • 109_AllAnnotations_Complete_32x42_72.png
          • 109_AllAnnotations_Default_32x42_72.png
          • 109_AllAnnotations_Default_32x42_721.png
          • 109_AllAnnotations_Error_32x42_72.png
          • 109_AllAnnotations_Error_32x42_721.png
          • 109_AllAnnotations_Help_32x42_72.png
          • 109_AllAnnotations_Help_32x42_721.png
          • 109_AllAnnotations_Info_32x42_72.png
          • 109_AllAnnotations_Info_32x42_721.png
          • 109_AllAnnotations_Warning_32x42_72.png
          • 109_AllAnnotations_Warning_32x42_721.png
          • 112_ArrowCurve_Blue_Left_32x42_72.png
          • 112_DownArrowLong_Orange_32x42_72.png
          • 112_DownArrowShort_Blue_32x42_72.png
          • 112_DownArrowShort_Grey_32x42_72.png
          • 112_DownArrowShort_Grey_32x42_721.png
          • 112_DownArrowShort_Orange_32x42_72.png
          • 112_LeftArrowShort_Blue_32x42_72.png
          • 112_LeftArrowShort_Green_32x42_72.png
          • 112_LeftArrowShort_Green_32x42_721.png
          • 112_LeftArrowShort_Grey_32x42_72.png
          • 112_LeftArrowShort_Grey_32x42_721.png
          • 112_LeftArrowShort_Orange_32x42_72.png
          • 112_LeftArrowShort_Orange_32x42_721.png
          • 112_Minus_Grey_32x42_72.png
          • 112_Minus_Grey_32x42_721.png
          • 112_Minus_Orange_32x42_72.png
          • 112_Plus_Blue_32x42_72.png
          • 112_Plus_Green_32x42_72.png
          • 112_Plus_Orange_32x42_72.png
          • 112_RefreshArrow_Blue_32x32.png
          • 112_RefreshArrow_Green_48x48_72.png
          • 112_RightArrowLong_Blue_32x42_72.png
          • 112_RightArrowLong_Green_32x42_72.png
          • 112_RightArrowLong_Grey_32x42_72.png
          • 112_RightArrowLong_Orange_32x42_72.png
          • 112_RightArrowShort_Green_32x42_72.png
          • 112_Tick_Blue_32x32_72.png
          • 112_Tick_Green_32x32_72.png
          • 112_Tick_Green_64x64_72.png
          • 112_Tick_Grey_32x32_72.png
          • 112_Tick_Orange_32x32_72.png
          • 112_UpArrowLong_Blue_32x42_72.png
          • 112_UpArrowLong_Green_32x42_72.png
          • 112_UpArrowLong_Orange_32x42_72.png
          • 112_UpArrowShort_Blue_32x42_72.png
          • 112_UpArrowShort_Green_32x42_72.png
          • 112_UpArrowShort_Grey_32x42_72.png
          • 1385_Disable_24x24_72.png
          • 1522_stop_waeetch_48x48.png
          • 1522_stop_watch_48ffx48.png
          • 1522_stop_watch_48x48.png
          • 1522_stop_watch_48x481.png
          • 1522_stop_watch_48xdd48.png
          • 1522_stop_watddch_48x48.png
          • 1532_Flag_system_Blue.png
          • 1532_Flag_system_Green.png
          • 1532_Flag_system_Purple.png
          • 1532_Flag_system_red.png
          • 1532_Flag_system_yellow.png
          • 1683_Lightbulb_32x32.png
          • 1683_Lightbulb_32x321.png
          • 16z.png
          • 305_Close_32x42_72.png
          • 30c.png
          • 30d.png
          • 33w.png
          • 33w1.png
          • 34z.png
          • 46e.png
          • 46e1.png
          • 5347.png
          • anaglyph.ico
          • animal1.png
          • animal2.png
          • animal3.png
          • animal4.png
          • animation1.gif
          • animation2.gif
          • Annotation_New.png
          • backl.jpg
          • backr.jpg
          • base_floppgydisk_32.png
          • base_floppydisgk_32.png
          • base_floppydisk_32.png
          • base_floppydisk_321.png
          • base_floppydisk_gj32.png
          • base_speaker_32.png
          • base_star_32.png
          • base_text.png
          • bird1.png
          • bird2.png
          • boat1.png
          • boldhs.png
          • Camera.png
          • Camera1.png
          • Camerah.png
          • Camerhgja.png
          • ChooseColor.png
          • clocgk.png
          • clock.png
          • clock1.png
          • clockhjl.png
          • clockk.png
          • cloud1.png
          • cloud2.png
          • cloud3.png
          • cloud4.png
          • ColorHS.png
          • cp.PNG
          • DataContainer_MoveNextHS.png
          • delete.png
          • Delete_black_32x32.png
          • emd.png
          • FavoriteStar_FrontFacing_32x32_72.png
          • fb.PNG
          • fish1.png
          • FloppyDisk.png
          • flower1.png
          • flower2.png
          • flower3.png
          • flower4.png
          • flower5.png
          • Folder.png
          • FormRunHS.png
          • glassekks.png
          • glasses.png
          • glasseus.png
          • GoToPreviousMessage.png
          • ground1.JPG
          • ground2.JPG
          • history.png
          • human1.png
          • ItalicHS.png
          • kavir.jpg
          • Key.png
          • Key_Right.png
          • m2.png
          • Music_Note_Double_48.png
          • Music_Note_Single_48.png
          • openHS.png
          • PieChart3DHS.png
          • PieChartHS.png
          • RepeatHS.png
          • RightArrow2HS.png
          • RightArrowHS.png
          • rock1.png
          • rock2.png
          • rock3.png
          • rock4.png
          • rock5.png
          • SaveAllHS.png
          • SecurityLock.png
          • ship1.png
          • ship2.png
          • sky1.jpg
          • sky2.jpg
          • skynight.png
          • smartmedia.png
          • snow1.png
          • tree1.png
          • tree2.png
          • water1.png
          • water2.jpg
          • water3.jpg
          • water4.jpg
          • white.png
          • winter.png
  • Anaglyph_demo1-noexe.zip
    • Anaglyph.exe.config
    • Anaglyph.vshost.exe.config
    • Anaglyph.vshost.exe.manifest
    • 36.png
    • 73.png
    • 88.png
    • Nature-136.png
    • Noorderlicht,-Spitzberg,-Norway.png
    • submarine2.png
    • snow0.png
    • snow2.png
    • snow3.png
    • snow4.png
    • snow5.png
    • cadyou.com_Autumn Tree.png
    • Eucalyptus.png
    • Greenhouse-Palm-acai01.png
    • Jacaranda.png
    • Palm-arecaceae.png
    • Sophora.png
    • Thumbs.db
    • tree336.png
    • 25912.jpg
    • 77.jpg
    • Cabo San Lucas, Mexico.jpg
    • Carlsbad, California.jpg
    • Nature-100.jpg
    • Newport Beach, California.jpg
    • Victoria Beach, Laguna Beach, California.jpg
    • water1.jpg
  • Anaglyph_demo1.zip
    • Anaglyph.exe
    • Anaglyph.exe.config
    • Anaglyph.pdb
    • Anaglyph.vshost.exe
    • Anaglyph.vshost.exe.config
    • Anaglyph.vshost.exe.manifest
    • 36.png
    • 73.png
    • 88.png
    • Nature-136.png
    • Noorderlicht,-Spitzberg,-Norway.png
    • submarine2.png
    • snow0.png
    • snow2.png
    • snow3.png
    • snow4.png
    • snow5.png
    • cadyou.com_Autumn Tree.png
    • Eucalyptus.png
    • Greenhouse-Palm-acai01.png
    • Jacaranda.png
    • Palm-arecaceae.png
    • Sophora.png
    • Thumbs.db
    • tree336.png
    • 25912.jpg
    • 77.jpg
    • Cabo San Lucas, Mexico.jpg
    • Carlsbad, California.jpg
    • Nature-100.jpg
    • Newport Beach, California.jpg
    • Victoria Beach, Laguna Beach, California.jpg
    • water1.jpg
  • Anaglyph_src2.zip
    • Anaglyph.sln
    • Anaglyph.suo
    • Anaglyph.csproj
    • app.config
    • 3D
      • bird-uid-1077009.png
      • dog-uid-1080734.png
      • flying-eagle-uid-1076271.png
      • Red_breasted_Robin_1024.png
      • Spotted-Reflections-at-the-Watering-Hole,-Leopard,-Africa.png
      • Thumbs.db
      • bird-uid-1077229.png
      • flying-eagle-uid-1076267.png
      • Thumbs.db
      • 25vc.png
      • Peaceful-Formations,-Ocean-Beach,-Californi2a.png
      • Tahiti,-French-hhPolynesia.png
      • A-Whale-of-a-Tail.png
      • dolphin06.png
      • Dolphin1.png
      • shark1.png
      • Orange-Hibiscus.png
      • plantstalk-uid-1111070.png
      • Pressed-wildflower-L6.png
      • Thumbs.db
      • Thumbs.db
      • Humans
        • BUTERFLY.png
        • F22.png
        • sun.png
        • 0207_vietnam.png
        • 78.png
        • rockdd4.png
        • 73.png
        • Sky
          • snow0.png
          • snow2.png
          • snow3.png
          • snow4.png
          • snow5.png
          • Thumbs.db
          • Water
        • clsData.cs
        • frmAbout.cs
        • frmAbout.designer.cs
        • frmAbout.resx
        • frmEdit.cs
        • frmEdit.Designer.cs
        • frmEdit.resx
        • frmEditObjects.cs
        • frmEditObjects.Designer.cs
        • frmEditObjects.resx
        • frmEditOver.cs
        • frmEditOver.Designer.cs
        • frmEditOver.resx
        • frmGlasses.cs
        • frmGlasses.Designer.cs
        • frmGlasses.resx
        • frmMain.cs
        • frmMain.designer.cs
        • frmMain.resx
        • frmObject.cs
        • frmObject.designer.cs
        • frmObject.resx
        • frmSelection.cs
        • frmSelection.designer.cs
        • frmSelection.resx
        • obj
          • x86
        • Program.cs
        • AssemblyInfo.cs
        • Resources.Designer.cs
        • Resources.resx
        • Settings.Designer.cs
        • Settings.settings
        • _3D_farsian.JPG
        • _3D_galikesh.JPG
        • _3D_kavir.jpg
        • 008_Reminder_32x42_72.png
        • 009_HighPriority_48x48_72.png
        • 009_HighPriority_48x48_721.png
        • 010_LowPriority_32x32_72.png
        • 037_Colorize_32x32_72.png
        • 05dx.png
        • 05x.png
        • 0710.png
        • 109_AllAnnotations_Complete_32x42_72.png
        • 109_AllAnnotations_Default_32x42_72.png
        • 109_AllAnnotations_Default_32x42_721.png
        • 109_AllAnnotations_Error_32x42_72.png
        • 109_AllAnnotations_Error_32x42_721.png
        • 109_AllAnnotations_Help_32x42_72.png
        • 109_AllAnnotations_Help_32x42_721.png
        • 109_AllAnnotations_Info_32x42_72.png
        • 109_AllAnnotations_Info_32x42_721.png
        • 109_AllAnnotations_Warning_32x42_72.png
        • 109_AllAnnotations_Warning_32x42_721.png
        • 112_ArrowCurve_Blue_Left_32x42_72.png
        • 112_DownArrowLong_Orange_32x42_72.png
        • 112_DownArrowShort_Blue_32x42_72.png
        • 112_DownArrowShort_Grey_32x42_72.png
        • 112_DownArrowShort_Grey_32x42_721.png
        • 112_DownArrowShort_Orange_32x42_72.png
        • 112_LeftArrowShort_Blue_32x42_72.png
        • 112_LeftArrowShort_Green_32x42_72.png
        • 112_LeftArrowShort_Green_32x42_721.png
        • 112_LeftArrowShort_Grey_32x42_72.png
        • 112_LeftArrowShort_Grey_32x42_721.png
        • 112_LeftArrowShort_Orange_32x42_72.png
        • 112_LeftArrowShort_Orange_32x42_721.png
        • 112_Minus_Grey_32x42_72.png
        • 112_Minus_Grey_32x42_721.png
        • 112_Minus_Orange_32x42_72.png
        • 112_Plus_Blue_32x42_72.png
        • 112_Plus_Green_32x42_72.png
        • 112_Plus_Orange_32x42_72.png
        • 112_RefreshArrow_Blue_32x32.png
        • 112_RefreshArrow_Green_48x48_72.png
        • 112_RightArrowLong_Blue_32x42_72.png
        • 112_RightArrowLong_Green_32x42_72.png
        • 112_RightArrowLong_Grey_32x42_72.png
        • 112_RightArrowLong_Orange_32x42_72.png
        • 112_RightArrowShort_Green_32x42_72.png
        • 112_Tick_Blue_32x32_72.png
        • 112_Tick_Green_32x32_72.png
        • 112_Tick_Green_64x64_72.png
        • 112_Tick_Grey_32x32_72.png
        • 112_Tick_Orange_32x32_72.png
        • 112_UpArrowLong_Blue_32x42_72.png
        • 112_UpArrowLong_Green_32x42_72.png
        • 112_UpArrowLong_Orange_32x42_72.png
        • 112_UpArrowShort_Blue_32x42_72.png
        • 112_UpArrowShort_Green_32x42_72.png
        • 112_UpArrowShort_Grey_32x42_72.png
        • 1385_Disable_24x24_72.png
        • 1522_stop_waeetch_48x48.png
        • 1522_stop_watch_48ffx48.png
        • 1522_stop_watch_48x48.png
        • 1522_stop_watch_48x481.png
        • 1522_stop_watch_48xdd48.png
        • 1522_stop_watddch_48x48.png
        • 1532_Flag_system_Blue.png
        • 1532_Flag_system_Green.png
        • 1532_Flag_system_Purple.png
        • 1532_Flag_system_red.png
        • 1532_Flag_system_yellow.png
        • 1683_Lightbulb_32x32.png
        • 1683_Lightbulb_32x321.png
        • 16z.png
        • 305_Close_32x42_72.png
        • 30c.png
        • 30d.png
        • 33w.png
        • 33w1.png
        • 34z.png
        • 46e.png
        • 46e1.png
        • 5347.png
        • anaglyph.ico
        • animal1.png
        • animal2.png
        • animal3.png
        • animal4.png
        • Annotation_New.png
        • backl.jpg
        • backr.jpg
        • base_floppgydisk_32.png
        • base_floppydisgk_32.png
        • base_floppydisk_32.png
        • base_floppydisk_321.png
        • base_floppydisk_gj32.png
        • base_speaker_32.png
        • base_star_32.png
        • bird1.png
        • bird2.png
        • boat1.png
        • Camera.png
        • Camera1.png
        • Camerah.png
        • Camerhgja.png
        • clocgk.png
        • clock.png
        • clock1.png
        • clockhjl.png
        • clockk.png
        • cloud1.png
        • cloud2.png
        • cloud3.png
        • cloud4.png
        • cp.PNG
        • DataContainer_MoveNextHS.png
        • delete.png
        • Delete_black_32x32.png
        • emd.png
        • FavoriteStar_FrontFacing_32x32_72.png
        • fb.PNG
        • fish1.png
        • FloppyDisk.png
        • flower1.png
        • flower2.png
        • flower3.png
        • flower4.png
        • flower5.png
        • Folder.png
        • FormRunHS.png
        • glassekks.png
        • glasses.png
        • glasseus.png
        • GoToPreviousMessage.png
        • ground1.JPG
        • ground2.JPG
        • history.png
        • human1.png
        • kavir.jpg
        • Key.png
        • Key_Right.png
        • m2.png
        • Music_Note_Double_48.png
        • Music_Note_Single_48.png
        • openHS.png
        • RepeatHS.png
        • RightArrow2HS.png
        • RightArrowHS.png
        • rock1.png
        • rock2.png
        • rock3.png
        • rock4.png
        • rock5.png
        • SaveAllHS.png
        • SecurityLock.png
        • ship1.png
        • ship2.png
        • sky1.jpg
        • sky2.jpg
        • skynight.png
        • smartmedia.png
        • snow1.png
        • tree1.png
        • tree2.png
        • water1.png
        • water2.jpg
        • water3.jpg
        • water4.jpg
        • white.png
        • winter.png
  • Anaglyph_src3.zip
    • Anaglyph.sln
    • Anaglyph.suo
    • Anaglyph.csproj
    • app.config
    • bird-uid-1077009.png
    • dog-uid-1080734.png
    • flying-eagle-uid-1076271.png
    • Red_breasted_Robin_1024.png
    • Spotted-Reflections-at-the-Watering-Hole,-Leopard,-Africa.png
    • Thumbs.db
    • bird-uid-1077229.png
    • flying-eagle-uid-1076267.png
    • Thumbs.db
    • 25vc.png
    • Peaceful-Formations,-Ocean-Beach,-Californi2a.png
    • Tahiti,-French-hhPolynesia.png
    • A-Whale-of-a-Tail.png
    • dolphin06.png
    • Dolphin1.png
    • shark1.png
    • Orange-Hibiscus.png
    • plantstalk-uid-1111070.png
    • Pressed-wildflower-L6.png
    • Thumbs.db
    • Thumbs.db
    • BUTERFLY.png
    • F22.png
    • sun.png
    • 0207_vietnam.png
    • 78.png
    • rockdd4.png
    • 73.png
    • snow0.png
    • snow2.png
    • snow3.png
    • snow4.png
    • snow5.png
    • Thumbs.db
    • clsData.cs
    • frmAbout.cs
    • frmAbout.designer.cs
    • frmAbout.resx
    • frmEdit.cs
    • frmEdit.Designer.cs
    • frmEdit.resx
    • frmEditObjects.cs
    • frmEditObjects.Designer.cs
    • frmEditObjects.resx
    • frmEditOver.cs
    • frmEditOver.Designer.cs
    • frmEditOver.resx
    • frmGlasses.cs
    • frmGlasses.Designer.cs
    • frmGlasses.resx
    • frmMain.cs
    • frmMain.designer.cs
    • frmMain.resx
    • frmObject.cs
    • frmObject.designer.cs
    • frmObject.resx
    • frmSelection.cs
    • frmSelection.designer.cs
    • frmSelection.resx
    • Program.cs
    • AssemblyInfo.cs
    • Resources.Designer.cs
    • Resources.resx
    • Settings.Designer.cs
    • Settings.settings
    • _3D_farsian.JPG
    • _3D_galikesh.JPG
    • _3D_kavir.jpg
    • 008_Reminder_32x42_72.png
    • 009_HighPriority_48x48_72.png
    • 009_HighPriority_48x48_721.png
    • 010_LowPriority_32x32_72.png
    • 037_Colorize_32x32_72.png
    • 05dx.png
    • 05x.png
    • 0710.png
    • 109_AllAnnotations_Complete_32x42_72.png
    • 109_AllAnnotations_Default_32x42_72.png
    • 109_AllAnnotations_Default_32x42_721.png
    • 109_AllAnnotations_Error_32x42_72.png
    • 109_AllAnnotations_Error_32x42_721.png
    • 109_AllAnnotations_Help_32x42_72.png
    • 109_AllAnnotations_Help_32x42_721.png
    • 109_AllAnnotations_Info_32x42_72.png
    • 109_AllAnnotations_Info_32x42_721.png
    • 109_AllAnnotations_Warning_32x42_72.png
    • 109_AllAnnotations_Warning_32x42_721.png
    • 112_ArrowCurve_Blue_Left_32x42_72.png
    • 112_DownArrowLong_Orange_32x42_72.png
    • 112_DownArrowShort_Blue_32x42_72.png
    • 112_DownArrowShort_Grey_32x42_72.png
    • 112_DownArrowShort_Grey_32x42_721.png
    • 112_DownArrowShort_Orange_32x42_72.png
    • 112_LeftArrowShort_Blue_32x42_72.png
    • 112_LeftArrowShort_Green_32x42_72.png
    • 112_LeftArrowShort_Green_32x42_721.png
    • 112_LeftArrowShort_Grey_32x42_72.png
    • 112_LeftArrowShort_Grey_32x42_721.png
    • 112_LeftArrowShort_Orange_32x42_72.png
    • 112_LeftArrowShort_Orange_32x42_721.png
    • 112_Minus_Grey_32x42_72.png
    • 112_Minus_Grey_32x42_721.png
    • 112_Minus_Orange_32x42_72.png
    • 112_Plus_Blue_32x42_72.png
    • 112_Plus_Green_32x42_72.png
    • 112_Plus_Orange_32x42_72.png
    • 112_RefreshArrow_Blue_32x32.png
    • 112_RefreshArrow_Green_48x48_72.png
    • 112_RightArrowLong_Blue_32x42_72.png
    • 112_RightArrowLong_Green_32x42_72.png
    • 112_RightArrowLong_Grey_32x42_72.png
    • 112_RightArrowLong_Orange_32x42_72.png
    • 112_RightArrowShort_Green_32x42_72.png
    • 112_Tick_Blue_32x32_72.png
    • 112_Tick_Green_32x32_72.png
    • 112_Tick_Green_64x64_72.png
    • 112_Tick_Grey_32x32_72.png
    • 112_Tick_Orange_32x32_72.png
    • 112_UpArrowLong_Blue_32x42_72.png
    • 112_UpArrowLong_Green_32x42_72.png
    • 112_UpArrowLong_Orange_32x42_72.png
    • 112_UpArrowShort_Blue_32x42_72.png
    • 112_UpArrowShort_Green_32x42_72.png
    • 112_UpArrowShort_Grey_32x42_72.png
    • 1385_Disable_24x24_72.png
    • 1522_stop_waeetch_48x48.png
    • 1522_stop_watch_48ffx48.png
    • 1522_stop_watch_48x48.png
    • 1522_stop_watch_48x481.png
    • 1522_stop_watch_48xdd48.png
    • 1522_stop_watddch_48x48.png
    • 1532_Flag_system_Blue.png
    • 1532_Flag_system_Green.png
    • 1532_Flag_system_Purple.png
    • 1532_Flag_system_red.png
    • 1532_Flag_system_yellow.png
    • 1683_Lightbulb_32x32.png
    • 1683_Lightbulb_32x321.png
    • 16z.png
    • 305_Close_32x42_72.png
    • 30c.png
    • 30d.png
    • 33w.png
    • 33w1.png
    • 34z.png
    • 46e.png
    • 46e1.png
    • 5347.png
    • anaglyph.ico
    • animal1.png
    • animal2.png
    • animal3.png
    • animal4.png
    • Annotation_New.png
    • backl.jpg
    • backr.jpg
    • base_floppgydisk_32.png
    • base_floppydisgk_32.png
    • base_floppydisk_32.png
    • base_floppydisk_321.png
    • base_floppydisk_gj32.png
    • base_speaker_32.png
    • base_star_32.png
    • base_text.png
    • bird1.png
    • bird2.png
    • boat1.png
    • Camera.png
    • Camera1.png
    • Camerah.png
    • Camerhgja.png
    • clocgk.png
    • clock.png
    • clock1.png
    • clockhjl.png
    • clockk.png
    • cloud1.png
    • cloud2.png
    • cloud3.png
    • cloud4.png
    • cp.PNG
    • DataContainer_MoveNextHS.png
    • delete.png
    • Delete_black_32x32.png
    • emd.png
    • FavoriteStar_FrontFacing_32x32_72.png
    • fb.PNG
    • fish1.png
    • FloppyDisk.png
    • flower1.png
    • flower2.png
    • flower3.png
    • flower4.png
    • flower5.png
    • Folder.png
    • FormRunHS.png
    • glassekks.png
    • glasses.png
    • glasseus.png
    • GoToPreviousMessage.png
    • ground1.JPG
    • ground2.JPG
    • history.png
    • human1.png
    • kavir.jpg
    • Key.png
    • Key_Right.png
    • m2.png
    • Music_Note_Double_48.png
    • Music_Note_Single_48.png
    • openHS.png
    • RepeatHS.png
    • RightArrow2HS.png
    • RightArrowHS.png
    • rock1.png
    • rock2.png
    • rock3.png
    • rock4.png
    • rock5.png
    • SaveAllHS.png
    • SecurityLock.png
    • ship1.png
    • ship2.png
    • sky1.jpg
    • sky2.jpg
    • skynight.png
    • smartmedia.png
    • snow1.png
    • tree1.png
    • tree2.png
    • water1.png
    • water2.jpg
    • water3.jpg
    • water4.jpg
    • white.png
    • winter.png
  • Anaglyph_src.zip
    • Anaglyph.sln
    • Anaglyph.suo
    • Anaglyph.csproj
    • app.config
    • bird-uid-1077009.png
    • dog-uid-1080734.png
    • flying-eagle-uid-1076271.png
    • Red_breasted_Robin_1024.png
    • Spotted-Reflections-at-the-Watering-Hole,-Leopard,-Africa.png
    • Thumbs.db
    • bird-uid-1077229.png
    • flying-eagle-uid-1076267.png
    • Thumbs.db
    • 25vc.png
    • Peaceful-Formations,-Ocean-Beach,-Californi2a.png
    • Tahiti,-French-hhPolynesia.png
    • A-Whale-of-a-Tail.png
    • dolphin06.png
    • Dolphin1.png
    • shark1.png
    • Orange-Hibiscus.png
    • plantstalk-uid-1111070.png
    • Pressed-wildflower-L6.png
    • Thumbs.db
    • Thumbs.db
    • BUTERFLY.png
    • F22.png
    • sun.png
    • 0207_vietnam.png
    • 78.png
    • rockdd4.png
    • 73.png
    • snow0.png
    • snow2.png
    • snow3.png
    • snow4.png
    • snow5.png
    • Thumbs.db
    • clsData.cs
    • frmAbout.cs
    • frmAbout.designer.cs
    • frmAbout.resx
    • frmEdit.cs
    • frmEdit.Designer.cs
    • frmEdit.resx
    • frmEditObjects.cs
    • frmEditObjects.Designer.cs
    • frmEditObjects.resx
    • frmEditOver.cs
    • frmEditOver.Designer.cs
    • frmEditOver.resx
    • frmMain.cs
    • frmMain.designer.cs
    • frmMain.resx
    • frmObject.cs
    • frmObject.designer.cs
    • frmObject.resx
    • frmSelection.cs
    • frmSelection.designer.cs
    • frmSelection.resx
    • Program.cs
    • AssemblyInfo.cs
    • Resources.Designer.cs
    • Resources.resx
    • Settings.Designer.cs
    • Settings.settings
    • 008_Reminder_32x42_72.png
    • 009_HighPriority_48x48_72.png
    • 009_HighPriority_48x48_721.png
    • 010_LowPriority_32x32_72.png
    • 037_Colorize_32x32_72.png
    • 05dx.png
    • 05x.png
    • 109_AllAnnotations_Complete_32x42_72.png
    • 109_AllAnnotations_Default_32x42_72.png
    • 109_AllAnnotations_Default_32x42_721.png
    • 109_AllAnnotations_Error_32x42_72.png
    • 109_AllAnnotations_Error_32x42_721.png
    • 109_AllAnnotations_Help_32x42_72.png
    • 109_AllAnnotations_Help_32x42_721.png
    • 109_AllAnnotations_Info_32x42_72.png
    • 109_AllAnnotations_Info_32x42_721.png
    • 109_AllAnnotations_Warning_32x42_72.png
    • 109_AllAnnotations_Warning_32x42_721.png
    • 112_ArrowCurve_Blue_Left_32x42_72.png
    • 112_DownArrowLong_Orange_32x42_72.png
    • 112_DownArrowShort_Blue_32x42_72.png
    • 112_DownArrowShort_Grey_32x42_72.png
    • 112_DownArrowShort_Grey_32x42_721.png
    • 112_DownArrowShort_Orange_32x42_72.png
    • 112_LeftArrowShort_Blue_32x42_72.png
    • 112_LeftArrowShort_Green_32x42_72.png
    • 112_LeftArrowShort_Green_32x42_721.png
    • 112_LeftArrowShort_Grey_32x42_72.png
    • 112_LeftArrowShort_Grey_32x42_721.png
    • 112_LeftArrowShort_Orange_32x42_72.png
    • 112_LeftArrowShort_Orange_32x42_721.png
    • 112_Minus_Grey_32x42_72.png
    • 112_Minus_Grey_32x42_721.png
    • 112_Minus_Orange_32x42_72.png
    • 112_Plus_Blue_32x42_72.png
    • 112_Plus_Green_32x42_72.png
    • 112_Plus_Orange_32x42_72.png
    • 112_RefreshArrow_Blue_32x32.png
    • 112_RefreshArrow_Green_48x48_72.png
    • 112_RightArrowLong_Blue_32x42_72.png
    • 112_RightArrowLong_Green_32x42_72.png
    • 112_RightArrowLong_Grey_32x42_72.png
    • 112_RightArrowLong_Orange_32x42_72.png
    • 112_RightArrowShort_Green_32x42_72.png
    • 112_Tick_Blue_32x32_72.png
    • 112_Tick_Green_32x32_72.png
    • 112_Tick_Green_64x64_72.png
    • 112_Tick_Grey_32x32_72.png
    • 112_Tick_Orange_32x32_72.png
    • 112_UpArrowLong_Blue_32x42_72.png
    • 112_UpArrowLong_Green_32x42_72.png
    • 112_UpArrowLong_Orange_32x42_72.png
    • 112_UpArrowShort_Blue_32x42_72.png
    • 112_UpArrowShort_Green_32x42_72.png
    • 112_UpArrowShort_Grey_32x42_72.png
    • 1385_Disable_24x24_72.png
    • 1522_stop_waeetch_48x48.png
    • 1522_stop_watch_48ffx48.png
    • 1522_stop_watch_48x48.png
    • 1522_stop_watch_48x481.png
    • 1522_stop_watch_48xdd48.png
    • 1522_stop_watddch_48x48.png
    • 1532_Flag_system_Blue.png
    • 1532_Flag_system_Green.png
    • 1532_Flag_system_Purple.png
    • 1532_Flag_system_red.png
    • 1532_Flag_system_yellow.png
    • 1683_Lightbulb_32x32.png
    • 1683_Lightbulb_32x321.png
    • 16z.png
    • 305_Close_32x42_72.png
    • 30c.png
    • 30d.png
    • 33w.png
    • 33w1.png
    • 34z.png
    • 46e.png
    • 46e1.png
    • anaglyph.ico
    • animal1.png
    • animal2.png
    • animal3.png
    • animal4.png
    • Annotation_New.png
    • backl.jpg
    • backr.jpg
    • base_floppgydisk_32.png
    • base_floppydisgk_32.png
    • base_floppydisk_32.png
    • base_floppydisk_321.png
    • base_floppydisk_gj32.png
    • base_speaker_32.png
    • base_star_32.png
    • bird1.png
    • bird2.png
    • boat1.png
    • Camera.png
    • Camera1.png
    • Camerah.png
    • Camerhgja.png
    • clocgk.png
    • clock.png
    • clock1.png
    • clockhjl.png
    • clockk.png
    • cloud1.png
    • cloud2.png
    • cloud3.png
    • cloud4.png
    • DataContainer_MoveNextHS.png
    • delete.png
    • Delete_black_32x32.png
    • emd.png
    • FavoriteStar_FrontFacing_32x32_72.png
    • fb.PNG
    • fish1.png
    • FloppyDisk.png
    • flower1.png
    • flower2.png
    • flower3.png
    • flower4.png
    • flower5.png
    • FormRunHS.png
    • glassekks.png
    • glasses.png
    • glasseus.png
    • GoToPreviousMessage.png
    • ground1.JPG
    • ground2.JPG
    • history.png
    • human1.png
    • kavir.jpg
    • Key.png
    • Key_Right.png
    • m2.png
    • Music_Note_Double_48.png
    • Music_Note_Single_48.png
    • RepeatHS.png
    • RightArrow2HS.png
    • RightArrowHS.png
    • rock1.png
    • rock2.png
    • rock3.png
    • rock4.png
    • rock5.png
    • SaveAllHS.png
    • SecurityLock.png
    • ship1.png
    • ship2.png
    • sky1.jpg
    • sky2.jpg
    • skynight.png
    • smartmedia.png
    • snow1.png
    • tree1.png
    • tree2.png
    • water1.png
    • water2.jpg
    • water3.jpg
    • water4.jpg
    • winter.png
  • Anaglyph_demo1e-noexe.zip
  • Anaglyph_demo1z.zip
  • Anaglyph_demo1z-noexe.zip
  • Anaglyph_demo1x.zip
  • Anaglyph_demo1x-noexe.zip
��using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.IO;

using System.Drawing.Imaging;

using System.Diagnostics;



// Note: some parts of code are from 2009 and some parts 2012 - so maybe it is a little messy



namespace Anaglyph

{

    public partial class frmMain : Form

    {



        #region Variable definition



        private List<string> imageTypes = new List<string>(new string[] { "*.jpg", "*.png", "*.gif", "*.bmp" });



        private List<Image>[] picsAll = new List<Image>[] { new List<Image>(), new List<Image>(),

            new List<Image>() , new List<Image>(), new List<Image>(), new List<Image>(),

            new List<Image>() , new List<Image>(), new List<Image>(), new List<Image>(), 

            new List<Image>() , new List<Image>(), new List<Image>(), new List<Image>(), 

            new List<Image>(), new List<Image>(), new List<Image>() };



        private picCollection myPicInfo;

        private List<picCollection> myAllPicCollection = new List<picCollection>();





        private List<frmObject> mySnowCollection = new List<frmObject>();

        private List<ToolStripItem> myMenuItemCollection = new List<ToolStripItem>();



        private Bitmap rightBitmap, leftBitmap, bmpAnaglyph, redBitmap, cyanBitmap;



        float maxDepth, minDepth, meanDepth;



        StringBuilder stbInfo = new StringBuilder();



        private Random myRandom = new Random();



        private string myTitle = "Anaglyph ";



        private int baseDepth = -100;

        private int baseWidthCorrection = 200;



        float[][][] picMatrix;

        float[][][] anaglyphMatrix;



        int picSkySelected = 0;

        int picGroundSelected = 0;

        int picWaterSelected = 0;





        float myGeneralSize, myAltitude, myViewAngle;

        int myGroundHeight, myBackHeight;



        int myObjectsOrientation = 0;

        int MyDefaultImageFormat = 1;// 0=jpg, 1=png



        bool isFullScreen = false;

        int borderTop, borderLeft;



        string myGeneralFileName;

        #endregion





        #region Prepare the program - load data from the hard disk



        public frmMain()

        {

            InitializeComponent();

            firstStart();

        }





        private void firstStart()

        {

            this.Width = Screen.PrimaryScreen.Bounds.Width;

            this.Height = Screen.PrimaryScreen.Bounds.Height;



            setControlsSize();

            loadPictures();

            setMatices();





            cmbGeneralEffect.SelectedIndex = 0;

            picSkySelected = myRandom.Next(2, picsAll[myObjectTypes.Sky.GetHashCode()].Count);

            picSky.BackgroundImage = picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected];



            picGroundSelected = myRandom.Next(2, picsAll[myObjectTypes.Ground.GetHashCode()].Count);

            picGround.BackgroundImage = picsAll[myObjectTypes.Ground.GetHashCode()][picGroundSelected];



            picWaterSelected = myRandom.Next(1, picsAll[myObjectTypes.Water.GetHashCode()].Count);

            picWater.BackgroundImage = picsAll[myObjectTypes.Water.GetHashCode()][picWaterSelected];





            tmrNext.Interval = (int)updTimerNext.Value * 1000;



            // add menu items to my collection for random auto run

            foreach (ToolStripItem tsm in mnuPersianGulf.DropDownItems) myMenuItemCollection.Add(tsm);

            foreach (ToolStripItem tsm in mnuGolestanPark.DropDownItems) myMenuItemCollection.Add(tsm);

            foreach (ToolStripItem tsm in mnuSpecialEffect.DropDownItems) myMenuItemCollection.Add(tsm);





            // making "SAVE" directory for saving output images

            try

            {

                DirectoryInfo myDir = new DirectoryInfo(Application.StartupPath + "\\Save\\");

                if (!myDir.Exists) myDir.Create();



                myDir = new DirectoryInfo(Application.StartupPath + "\\Save\\Data\\");

                if (!myDir.Exists) myDir.Create();

            }

            catch (Exception e)

            {

                MessageBox.Show(e.Message);

            }



        }





        // at the start of the program, load some images and shapes

        private void loadPictures()

        {

            // add some pictures from internal resources



            picsAll[myObjectTypes.Snow.GetHashCode()].Add(Properties.Resources.snow1);



            picsAll[myObjectTypes.Cloud.GetHashCode()].Add(Properties.Resources.cloud1);

            picsAll[myObjectTypes.Cloud.GetHashCode()].Add(Properties.Resources.cloud2);

            picsAll[myObjectTypes.Cloud.GetHashCode()].Add(Properties.Resources.cloud3);

            picsAll[myObjectTypes.Cloud.GetHashCode()].Add(Properties.Resources.cloud4);



            picsAll[myObjectTypes.Ground.GetHashCode()].Add(Properties.Resources.winter);

            picsAll[myObjectTypes.Ground.GetHashCode()].Add(Properties.Resources.kavir);

            picsAll[myObjectTypes.Ground.GetHashCode()].Add(Properties.Resources.ground1);

            picsAll[myObjectTypes.Ground.GetHashCode()].Add(Properties.Resources.ground2);



            picsAll[myObjectTypes.Ship.GetHashCode()].Add(Properties.Resources.boat1);

            picsAll[myObjectTypes.Ship.GetHashCode()].Add(Properties.Resources.ship1);

            picsAll[myObjectTypes.Ship.GetHashCode()].Add(Properties.Resources.ship2);

            picsAll[myObjectTypes.Ship.GetHashCode()].Add(Properties.Resources.ship2);



            picsAll[myObjectTypes.Fish.GetHashCode()].Add(Properties.Resources.fish1);



            picsAll[myObjectTypes.Rock.GetHashCode()].Add(Properties.Resources.rock1);

            picsAll[myObjectTypes.Rock.GetHashCode()].Add(Properties.Resources.rock2);

            picsAll[myObjectTypes.Rock.GetHashCode()].Add(Properties.Resources.rock3);

            picsAll[myObjectTypes.Rock.GetHashCode()].Add(Properties.Resources.rock4);

            picsAll[myObjectTypes.Rock.GetHashCode()].Add(Properties.Resources.rock5);



            picsAll[myObjectTypes.Water.GetHashCode()].Add(Properties.Resources.winter);

            picsAll[myObjectTypes.Water.GetHashCode()].Add(Properties.Resources.water1);

            picsAll[myObjectTypes.Water.GetHashCode()].Add(Properties.Resources.water2);

            picsAll[myObjectTypes.Water.GetHashCode()].Add(Properties.Resources.water3);

            picsAll[myObjectTypes.Water.GetHashCode()].Add(Properties.Resources.water4);

            picsAll[myObjectTypes.Water.GetHashCode()].Add(Properties.Resources.water4);



            picsAll[myObjectTypes.Sky.GetHashCode()].Add(Properties.Resources.winter);

            picsAll[myObjectTypes.Sky.GetHashCode()].Add(Properties.Resources.skynight);

            picsAll[myObjectTypes.Sky.GetHashCode()].Add(Properties.Resources.sky1);

            picsAll[myObjectTypes.Sky.GetHashCode()].Add(Properties.Resources.sky2);



            picsAll[myObjectTypes.Bird.GetHashCode()].Add(Properties.Resources.bird1);

            picsAll[myObjectTypes.Bird.GetHashCode()].Add(Properties.Resources.bird1);

            picsAll[myObjectTypes.Bird.GetHashCode()].Add(Properties.Resources.bird2);



            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower1);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower1);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower2);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower2);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower3);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower4);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower4);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower5);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower5);

            picsAll[myObjectTypes.Flower.GetHashCode()].Add(Properties.Resources.flower5);



            picsAll[myObjectTypes.Tree.GetHashCode()].Add(Properties.Resources.tree1);

            picsAll[myObjectTypes.Tree.GetHashCode()].Add(Properties.Resources.tree2);



            picsAll[myObjectTypes.Human.GetHashCode()].Add(Properties.Resources.human1);



            picsAll[myObjectTypes.Animal.GetHashCode()].Add(Properties.Resources.animal1);

            picsAll[myObjectTypes.Animal.GetHashCode()].Add(Properties.Resources.animal2);

            picsAll[myObjectTypes.Animal.GetHashCode()].Add(Properties.Resources.animal3);

            picsAll[myObjectTypes.Animal.GetHashCode()].Add(Properties.Resources.animal4);



            //load some pictures from Hard disk (different sub directories)

            loadFromHard("Clouds", picsAll[myObjectTypes.Cloud.GetHashCode()], null);

            loadFromHard("Rocks", picsAll[myObjectTypes.Rock.GetHashCode()], null);

            loadFromHard("Birds", picsAll[myObjectTypes.Bird.GetHashCode()], null);

            loadFromHard("Trees", picsAll[myObjectTypes.Tree.GetHashCode()], null);

            loadFromHard("Ships", picsAll[myObjectTypes.Ship.GetHashCode()], null);

            loadFromHard("Fishes", picsAll[myObjectTypes.Fish.GetHashCode()], null);

            loadFromHard("Humans", picsAll[myObjectTypes.Human.GetHashCode()], null);

            loadFromHard("Animals", picsAll[myObjectTypes.Animal.GetHashCode()], null);

            loadFromHard("Flowers", picsAll[myObjectTypes.Flower.GetHashCode()], null);

            loadFromHard("Snow", picsAll[myObjectTypes.Snow.GetHashCode()], null);

            loadFromHard("Ground", picsAll[myObjectTypes.Ground.GetHashCode()], null);

            loadFromHard("Water", picsAll[myObjectTypes.Water.GetHashCode()], null);

            loadFromHard("Sky", picsAll[myObjectTypes.Sky.GetHashCode()], null);

            loadFromHard("Misc", picsAll[myObjectTypes.Misc.GetHashCode()], null);



        }



        // load pictures from the hard disk

        private void loadFromHard(string myDir, List<Image> myPicList, List<Image> myPicList2)

        {

            DirectoryInfo myFileDir = new DirectoryInfo(Application.StartupPath + "\\" + myDir);

            if (myFileDir.Exists)

            {

                // For each image extension (.jpg, .bmp, etc.)

                foreach (string imageType in imageTypes)

                {

                    // all graphic files in the directory 

                    foreach (FileInfo myFile in myFileDir.GetFiles(imageType))

                    {

                        // add image

                        try

                        {

                            Image image = Image.FromFile(myFile.FullName);

                            myPicList.Add(image);

                        }

                        catch (OutOfMemoryException)

                        {

                            continue;

                        }

                    }

                }

            }



        }



        #endregion



        #region Color Matrices definition



        //  color matrices 

        private void setMatices()

        {



            float[][] matrixNormal = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };







            float[][] matrixBW = new float[][] {

                new float[] {.34f, .34f, .34f, 0, 0}, //  Red  

                new float[] {.34f, .34f, .34f, 0, 0}, //  Green

                new float[] {.34f, .34f, .34f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            float[][] matrixBW_Contrast = new float[][] {

                new float[] {.4f, .4f,.4f, 0, 0}, //  Red  

                new float[] {.4f, .4f,.4f, 0, 0}, //  Green

                new float[] {.4f, .4f, .4f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            float[][] matrixBW_Contrast_More = new float[][] {

                new float[] {.5f, .5f,.5f, 0, 0}, //  Red  

                new float[] {.5f, .5f,.5f, 0, 0}, //  Green

                new float[] {.5f, .5f, .5f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };





            float[][] matrixBW_Contrast_Most = new float[][] {

                new float[] {.8f, .8f,.8f, 0, 0}, //  Red  

                new float[] {.8f, .8f,.8f, 0, 0}, //  Green

                new float[] {.8f, .8f, .8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            float[][] matrixBW_Brighter = new float[][] {

                new float[] {.34f, .34f, .34f, 0, 0}, //  Red  

                new float[] {.34f, .34f, .34f, 0, 0}, //  Green

                new float[] {.34f, .34f, .34f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.1f, .1f, .1f, 0, 1}

            };



            float[][] matrixBW_Brighter_More = new float[][] {

                new float[] {.35f, .35f, .35f, 0, 0}, //  Red  

                new float[] {.35f, .35f, .35f, 0, 0}, //  Green

                new float[] {.35f, .35f, .35f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.25f, .25f, .25f, 0, 1}

            };





            float[][] matrixBW_Brighter_Most = new float[][] {

                new float[] {.4f, .4f,.4f, 0, 0}, //  Red  

                new float[] {.4f, .4f,.4f, 0, 0}, //  Green

                new float[] {.4f, .4f, .4f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.5f, 0.5f, 0.5f, 0, 1}

            };



            float[][] matrixBW_Darker = new float[][] {

                new float[] {.3f, .3f,.3f, 0, 0}, //  Red  

                new float[] {.3f, .3f,.3f, 0, 0}, //  Green

                new float[] {.3f, .3f, .3f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };





            float[][] matrixBW_Darker_More = new float[][] {

                new float[] {.25f, .25f,.25f, 0, 0}, //  Red  

                new float[] {.25f, .25f,.25f, 0, 0}, //  Green

                new float[] {.25f, .25f, .25f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            float[][] matrixBW_Darker_Most = new float[][] {

                new float[] {.14f, .14f,.14f, 0, 0}, //  Red  

                new float[] {.14f, .14f,.14f, 0, 0}, //  Green

                new float[] {.14f, .14f, .14f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            ////////////////////////////////////////////////////////////////////////////

            float[][] matrixContrast = new float[][] {

                new float[] {1.1f, .1f, .1f, 0, 0}, //  Red  

                new float[] {.1f, 1.1f, .1f, 0, 0}, //  Green

                new float[] {.1f, .1f, 1.1f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixContrast_More = new float[][] {

                new float[] {1.2f, .25f, .25f, 0, 0}, //  Red  

                new float[] {.25f, 1.2f, .25f, 0, 0}, //  Green

                new float[] {.25f, .25f, 1.2f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixContrast_Most = new float[][] {

                new float[] {1.3f, .5f, .5f, 0, 0}, //  Red  

                new float[] {.5f, 1.3f, .5f, 0, 0}, //  Green

                new float[] {.5f, .5f, 1.3f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };





            float[][] matrixContrast_Full = new float[][] {

                 new float[] {2, 1, 1, 0, 0}, //  Red  

                new float[] {1, 2, 1, 0, 0}, //  Green

                new float[] {1, 1, 2, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixBright = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.1f, .1f, .1f, 0, 1}

            };

            float[][] matrixBrightP = new float[][] {

                new float[] {1.05f, .025f, .025f, 0, 0}, //  Red  

                new float[] {.025f, 1.05f, .025f, 0, 0}, //  Green

                new float[] {.025f, .025f, 1.05f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.1f, .1f, .1f, 0, 1}

            };

            float[][] matrixBrighter_More = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.3f, 0.3f, 0.3f, 0, 1}

            };

            float[][] matrixBrighter_MoreP = new float[][] {

                new float[] {1.15f, .1f, 0.1f, 0, 0}, //  Red  

                new float[] {0.1f, 1.15f, 0.1f, 0, 0}, //  Green

                new float[] {0.1f, 0.1f, 1.15f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.3f, 0.3f, 0.3f, 0, 1}

            };



            float[][] matrixBrighter_Most = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.5f, 0.5f, 0.5f, 0, 1}

            };



            float[][] matrixBrighter_MostP = new float[][] {

                new float[] {1.2f, .1f, 0.1f, 0, 0}, //  Red  

                new float[] {0.1f, 1.2f, 0.1f, 0, 0}, //  Green

                new float[] {0.1f, 0.1f, 1.2f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.5f, 0.5f, 0.5f, 0, 1}

            };





            float[][] matrixBright_Full = new float[][] {

                new float[] {1.1f, .05f, .05f, 0, 0}, //  Red  

                new float[] {.05f, 1.1f, .05f, 0, 0}, //  Green

                new float[] {.05f, .05f, 1.1f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.7f, .7f, .7f, 0, 1}

           };



            float[][] matrixBright_FullP = new float[][] {

                new float[] {1.3f, .2f, .2f, 0, 0}, //  Red  

                new float[] {.2f, 1.3f, .2f, 0, 0}, //  Green

                new float[] {.2f, .2f, 1.3f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.8f, .8f, .8f, 0, 1}

           };





            /////////////////////////////////////////////////////////////////////////////////

            float[][] matrixDark = new float[][] {

                new float[] {.9f, -.05f, -.05f, 0, 0}, //  Red  

                new float[] {.05f, .9f, .05f, 0, 0}, //  Green

                new float[] {.05f, .05f, .9f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            float[][] matrixDarkP = new float[][] {

                new float[] {.9f, -.05f, -.05f, 0, 0}, //  Red  

                new float[] {.05f, .9f, .05f, 0, 0}, //  Green

                new float[] {.05f, .05f, .9f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.1f, -.1f, -.1f, 0, 1}

            };



            float[][] matrixDarker_More = new float[][] {

                new float[] {.8f, -.1f, -.1f, 0, 0}, //  Red  

                new float[] {-.1f, .8f, -.1f, 0, 0}, //  Green

                new float[] {-.1f, -.1f, .8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.05f, -.05f, -.05f, 0, 1}

            };



            float[][] matrixDarker_MoreP = new float[][] {

                new float[] {.8f, -.1f, -.1f, 0, 0}, //  Red  

                new float[] {-.1f, .8f, -.1f, 0, 0}, //  Green

                new float[] {-.1f, -.1f, .8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.2f, -.2f, -.2f, 0, 1}

            };



            float[][] matrixDarker_Most = new float[][] {

                new float[] {.7f, -.2f, -.2f, 0, 0}, //  Red  

                new float[] {-.2f, .7f, -.2f, 0, 0}, //  Green

                new float[] {-.2f, -.2f, .7f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.1f, -.1f, -.1f, 0, 1}

            };



            float[][] matrixDarker_MostP = new float[][] {

                new float[] {.7f, -.2f, -.2f, 0, 0}, //  Red  

                new float[] {-.2f, .7f, -.2f, 0, 0}, //  Green

                new float[] {-.2f, -.2f, .7f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.15f, -.15f, -.15f, 0, 1}

            };





            float[][] matrixDarkFull = new float[][] {

               new float[] {.6f, -.4f, -.4f, 0, 0}, //  Red  

                new float[] {-.4f, .6f, -.4f, 0, 0}, //  Green

                new float[] {-.4f, -.4f, .6f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            //////////////////////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixColorize = new float[][] {

                new float[] {1.1f, -.05f, -.05f, 0, 0}, //  Red  

                new float[] {-.05f, 1.1f, -.05f, 0, 0}, //  Green

                new float[] {-.05f, -.05f, 1.1f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorizeP = new float[][] {

                new float[] {1.2f, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1.2f, 0, 0, 0}, //  Green

                new float[] {0, 0, 1.2f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorizeM = new float[][] {

                new float[] {1, -.1f, -.1f, 0, 0}, //  Red  

                new float[] {-.1f, 1, -.1f, 0, 0}, //  Green

                new float[] {-.1f, -.1f, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };





            float[][] matrixColorize_More = new float[][] {

                new float[] {1.3f, -.1f, -.1f, 0, 0}, //  Red  

                new float[] {-.1f, 1.3f, -.1f, 0, 0}, //  Green

                new float[] {-.1f, -.1f, 1.3f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_MoreP = new float[][] {

                new float[] {1.5f, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1.5f, 0, 0, 0}, //  Green

                new float[] {0, 0, 1.5f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_MoreM = new float[][] {

                new float[] {1.1f, -.2f, -.2f, 0, 0}, //  Red  

                new float[] {-.2f, 1.1f, -.2f, 0, 0}, //  Green

                new float[] {-.2f, -.2f, 1.1f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            float[][] matrixColorize_Most = new float[][] {

                new float[] {1.4f, -.2f, -.2f, 0, 0}, //  Red  

                new float[] {-.2f, 1.4f, -.2f, 0, 0}, //  Green

                new float[] {-.2f, -.2f, 1.4f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_MostP = new float[][] {

                new float[] {1.6f, -.1f, -.1f, 0, 0}, //  Red  

                new float[] {-.1f, 1.6f, -.1f, 0, 0}, //  Green

                new float[] {-.1f, -.1f, 1.6f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_MostM = new float[][] {

                new float[] {1.2f, -.3f, -.3f, 0, 0}, //  Red  

                new float[] {-.3f, 1.2f, -.3f, 0, 0}, //  Green

                new float[] {-.3f, -.3f, 1.2f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_Full = new float[][] {

                new float[] {1.8f, -.3f, -.3f, 0, 0}, //  Red  

                new float[] {-.3f, 1.8f, -.3f, 0, 0}, //  Green

                new float[] {-.3f, -.3f, 1.8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_FullP = new float[][] {

                new float[] {2, -.2f, -.2f, 0, 0}, //  Red  

                new float[] {-.2f, 2, -.2f, 0, 0}, //  Green

                new float[] {-.2f, -.2f, 2, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_FullM = new float[][] {

                new float[] {1.6f, -.4f, -.4f, 0, 0}, //  Red  

                new float[] {-.4f, 1.6f, -.4f, 0, 0}, //  Green

                new float[] {-.4f, -.4f, 1.6f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            float[][] matrixColorize_FullPP = new float[][] {

                new float[] {3f, -1, -1, 0, 0}, //  Red  

                new float[] {-1f, 3f, -1f, 0, 0}, //  Green

                new float[] {-1f, -1f, 3f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };

            float[][] matrixColorize_FullPPM = new float[][] {

                new float[] {3f, -1, -1, 0, 0}, //  Red  

                new float[] {-1f, 3f, -1f, 0, 0}, //  Green

                new float[] {-1f, -1f, 3f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.5f, -.5f, -.5f, 0, 1}

            };



            //////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixRedChannel = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 0, 0, 0, 0}, //  Green

                new float[] {0, 0, 0, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixRedMore = new float[][] {

                new float[] {1.2f, -.1f, -.1f, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixRedMost = new float[][] {

                new float[] {1,  0,0, 0, 0}, //  Red  

                new float[] {0, .8f, 0, 0, 0}, //  Green

                new float[] {0,  0,.8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.2f, 0, 0, 0, 1}

           };

            float[][] matrixRedOnly = new float[][] {

                new float[] {1,0, 0,  0,0}, //  Red  

                new float[] {.34f, .34f, .34f, 0, 0}, //  Green

                new float[] {.34f, .34f, .34f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixRedLess = new float[][] {

                new float[] {.8f, 0.1f, 0.1f, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };





            ///////////////////////////////////////////////////////////////////////////////////////////////

            //////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixGreenChannel = new float[][] {

                new float[] {0, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 0, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixGreenMore = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red

                new float[] { -.1f,1.2f, -.1f, 0, 0}, //  Green  

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixGreenMost = new float[][] {

                new float[] {.8f,  0,0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0,  0,.8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, .2f, 0, 0, 1}

           };

            float[][] matrixGreenOnly = new float[][] {

                new float[] {.34f, .34f, .34f, 0, 0}, //  Red

                new float[] {0, 1, 0,  0,0}, //  Green  

                new float[] {.34f, .34f, .34f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixGreenLess = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red

                new float[] { 0.1f,.8f, 0.1f, 0, 0}, //  Green  

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };





            ///////////////////////////////////////////////////////////////////////////////////////////////

            //////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixBlueChannel = new float[][] {

                new float[] {0, 0, 0, 0, 0}, //  Red  

                new float[] {0, 0, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixBlueMore = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {-.1f, -.1f,1.2f, 0, 0}, //  Blue  

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixBlueMost = new float[][] {

                new float[] {.8f,  0,0, 0, 0}, //  Red  

                new float[] {0, .8f, 0, 0, 0}, //  Green

                new float[] {0,  0,1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, .2f, 0, 1}

           };

            float[][] matrixBlueOnly = new float[][] {

                new float[] {.34f, .34f, .34f, 0, 0}, //  Red

                new float[] {.34f, .34f, .34f, 0, 0}, //  Green

                new float[] {0,0, 1,  0,0}, //  Blue  

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixBlueLess = new float[][] {

                new float[] {0, 1, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {.1f, .1f, .8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };





            ///////////////////////////////////////////////////////////////////////////////////////////////

            //////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixCyanChannel = new float[][] {

                new float[] {0, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixCyanMore = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {-.1f, 1.2f, 0, 0, 0}, //  Green

                new float[] {-.1f, 0, 1.2f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixCyanMost = new float[][] {

                new float[] {.8f,  0,0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0,  0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, .2f, .2f, 0, 1}

           };

            float[][] matrixCyanOnly = new float[][] {

                new float[]  {.34f, .34f, .34f, 0, 0},//  Red  

                new float[] {0,1, 0,  0,0}, //  Green

                new float[]  {0,0, 1,  0,0},//  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixCyanLess = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {.01f, .9f, 0, 0, 0}, //  Green

                new float[] {.01f, 0, .9f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };





            ///////////////////////////////////////////////////////////////////////////////////////////////

            //////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixYellowChannel = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 0, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixYellowMore = new float[][] {

                new float[] {1.2f, 0, -.1f, 0, 0}, //  Red  

                new float[] {0, 1.2f, -.1f, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixYellowMost = new float[][] {

                new float[] {1,  0,0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0,  0,.8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.2f, .2f, 0, 0, 1}

           };

            float[][] matrixYellowOnly = new float[][] {

                new float[] {1,0, 0,  0,0}, //  Red  

                new float[] {0,1, 0,  0,0}, //  Green

                new float[] {.34f, .34f, .34f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };

            float[][] matrixYellowLess = new float[][] {

                new float[] {.9f, 0, 0.1f, 0, 0}, //  Red  

                new float[] {0, .9f, 0.1f, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            ///////////////////////////////////////////////////////////////////////////////////////////////



            float[][] matrixGolden = new float[][] {

                new float[] {1.2f, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {1, 1, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixGoldenP = new float[][] {

                new float[] {1.5f, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1.3f, 0, 0, 0}, //  Green

                new float[] {1, 1, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };



            float[][] matrixGoldenM = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, .95f, 0, 0, 0}, //  Green

                new float[] {.8f, .8f, .8f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

           };





            ///////////////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixHalfColor = new float[][] {

                new float[] {.7f, .2f, .2f, 0, 0}, //  Red  

                new float[] {.2f, .7f, .2f, 0, 0}, //  Green

                new float[] {.2f, .2f, .7f, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };







            float[][] matrixFullWhite = new float[][] {

                new float[] {1, 1, 1, 0, 0}, //  Red  

                new float[] {1, 1, 1, 0, 0}, //  Green

                new float[] {1, 1, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {1, 1, 1, 0, 1}

           };







            float[][] matrixFullBlack = new float[][] {

                new float[] {0, 0, 0, 0, 0}, //  Red  

                new float[] {0, 0, 0, 0, 0}, //  Green

                new float[] {0, 0, 0, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, 0, 1}

            };



            //////////////////////////////////////////////////////////////////////////////////////////////////////////

            float[][] matrixTransparent = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, -.2f, 1}

            };





            float[][] matrixTransparentP = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.2f, .2f, .2f, -.2f, 1}

            };



            float[][] matrixTransparentPP = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.35f, .35f, .35f, -.2f, 1}

            };





            float[][] matrixTransparentM = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.2f, -.2f, -.2f, -.2f, 1}

            };



            float[][] matrixTransparentMM = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.35f, -.35f, -.35f, -.2f, 1}

            };





            float[][] matrixTransparentMore = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, -.5f, 1}

            };





            float[][] matrixTransparentMoreP = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.4f, .4f, .4f, -.5f, 1}

            };





            float[][] matrixTransparentMorePP = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {.55f, .55f, .55f, -.5f, 1}

            };





            float[][] matrixTransparentMoreM = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.4f, -.4f, -.4f, -.5f, 1}

            };



            float[][] matrixTransparentMoreMM = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {-.55f, -.55f, -.55f, -.5f, 1}

            };





            float[][] matrixTransparentMost = new float[][] {

                new float[] {1, 0, 0, 0, 0}, //  Red  

                new float[] {0, 1, 0, 0, 0}, //  Green

                new float[] {0, 0, 1, 0, 0}, //  Blue

                new float[] {0, 0, 0, 1, 0}, // Transparency

                new float[] {0, 0, 0, -.7f, 1}

            };







//  No Effect

//-

//-

//Black White

//BW Contrast Upper

//BW Contrast More

//BW Contrast Most

//BW Brighter

//BW Brighter More

//BW Brighter Most

//BW Dark

//BW Darker More

//BW Darker Most

//-

//Contrast Upper

//Contrast More

//Contrast Most

//Contrast Full

//Brighter

//Brighter+

//Brighter More

//Brighter More+

//Brighter Most

//Brighter Most+

//Bright Full

//Bright Full+

//-

//Dark

//Dark+

//Darker More

//Darker More+

//Darker Most

//Darker Most+

//Dark Full

//-

//Colorize

//Colorize+

//Colorize-

//Colorize More

//Colorize More+

//Colorize More-

//Colorize Most

//Colorize Most+

//Colorize Most-

//Colorize Full

//Colorize Full+

//Colorize Full-

//Colorize Full++

//Colorize Full--

//-

//Red More

//Red Most

//Red Only

//Red Channel

//Red Less

//-

//Green More

//Green Most

//Green Only

//Green Channel 

//Green Less

//-

//Blue More

//Blue Most

//Blue Only

//Blue Channel

//Blue Less

//-

//Cyan More

//Cyan Most

//Cyan Only

//Cyan Channel

//Cyan Less

//-

//Yellow More

//Yellow Most

//Yellow Only

//Yellow Channel

//Yellow Less

//-

//Golden

//Golden Bright

//Golden Dark

//-

//Half Color

//Full White

//Full Black

//-

//Transparent

//Transparent+

//Transparent++

//Transparent-

//Transparent--

//Transparent More

//Transparent More+

//Transparent More++

//Transparent More-

//Transparent More--

//Transparent Most





            picMatrix = new float[][][] { 

                matrixNormal,matrixNormal,

                matrixNormal,matrixBW,matrixBW_Contrast,matrixBW_Contrast_More,matrixBW_Contrast_Most,matrixBW_Brighter,matrixBW_Brighter_More,matrixBW_Brighter_Most,matrixBW_Darker,matrixBW_Darker_More,matrixBW_Darker_Most,

                matrixNormal,matrixContrast,matrixContrast_More,matrixContrast_Most,matrixContrast_Full,matrixBright,matrixBrightP,matrixBrighter_More,matrixBrighter_MoreP,matrixBrighter_Most,matrixBrighter_MostP,matrixBright_Full,matrixBright_FullP,

                matrixNormal,matrixDark,matrixDarkP,matrixDarker_More,matrixDarker_MoreP,matrixDarker_Most,matrixDarker_MostP,matrixDarkFull,

                matrixNormal,matrixColorize,matrixColorizeP,matrixColorizeM,matrixColorize_More,matrixColorize_MoreP,matrixColorize_MoreM,matrixColorize_Most,matrixColorize_MostP,matrixColorize_MostM,matrixColorize_Full,matrixColorize_FullP,matrixColorize_FullM,matrixColorize_FullPP,matrixColorize_FullPPM,               

                matrixNormal,matrixRedMore,matrixRedMost,matrixRedOnly,matrixRedChannel,matrixRedLess,

                matrixNormal,matrixGreenMore,matrixGreenMost,matrixGreenOnly,matrixGreenChannel,matrixGreenLess,

                matrixNormal,matrixBlueMore,matrixBlueMost,matrixBlueOnly,matrixBlueChannel,matrixBlueLess,                

                matrixNormal,matrixCyanMore,matrixCyanMost,matrixCyanOnly,matrixCyanChannel,matrixCyanLess,

                matrixNormal,matrixYellowMore,matrixYellowMost,matrixYellowOnly,matrixYellowChannel,matrixYellowLess,               

                matrixNormal,matrixGolden,matrixGoldenP,matrixGoldenM,

                matrixNormal,matrixHalfColor,matrixFullWhite ,matrixFullBlack,



                matrixNormal,matrixTransparent,matrixTransparentP,matrixTransparentPP ,matrixTransparentM,matrixTransparentMM,matrixTransparentMore,matrixTransparentMoreP,matrixTransparentMorePP,matrixTransparentMoreM,matrixTransparentMoreMM,matrixTransparentMost };









            anaglyphMatrix = new float[][][] { matrixRedChannel, matrixCyanChannel };









        }



        #endregion





        #region Starting to Make a new Scene



        private void btnOK_Click(object sender, System.EventArgs e)

        {

            myObjectsOrientation = 0;

            startAutoRun();

        }



        private void btnRefresh_Click(object sender, EventArgs e)

        {

            myObjectsOrientation = Convert.ToInt16(((ToolStripMenuItem)sender).Tag.ToString());

            goRun(true);

        }



        private void goRun(bool reFresh)

        {

            setPanels(true);

            mnuSaveFast.Enabled = true;

            bool timerStatus = tmrNext.Enabled;

            tmrNext.Enabled = false;

            this.UseWaitCursor = true;

            mnuRun.Enabled = false;

            mnuRefresh.Enabled = false;

            if (chkFullScreen.Checked) setFullScreen(true);

            Application.DoEvents();

            myGeneralFileName = DateTime.Now.ToString("yyyyMMMdd_HHmmss__") +

                (rdoLandscapePersianGulf.Checked ? "Persian_Gulf" : "Golestan_Park") + "__" +  mnuOut1.Text.Trim()+ "_" +  mnuOut2.Text.Trim();

            myGeneralFileName = myGeneralFileName.Replace("-", "_").Replace(" ", "").Replace(".", "").Replace("(", "_").Replace(")", "_").Replace("[", "_").Replace("]", "_").Replace("=", "_");

            try

            {

                if (!reFresh)

                {

                    setDepth();

                    setControlsSize();

                    resetCollections();

                    startCalculation();

                }

                Application.DoEvents();

                Draw3D();

                showResult(mnuShowAnaglyph.SelectedIndex); // show anaglyph or left or right or red or cyan

                setTitle();

                setDataForSave();



                //if (!reFresh) 

                saveData(stbInfo);

                if (mnuAutoSave.Checked) ImageSave();

                if (mnuShowSnow.Checked)

                    foreach (frmObject mySnow in mySnowCollection) mySnow.Show();



                mnuFile.Select();





            }

            catch (Exception e) { Debug.WriteLine(e.Message); }



            mnuRun.Enabled = true;

            mnuRefresh.Enabled = true;

            this.UseWaitCursor = false;

            tmrNext.Enabled = timerStatus;

        }





        private void setDepth()

        {

            if (chkDepthRandom.Checked)

            {

                int myMin = (int)(trbBaseDepth.Value - updDepthRandom.Value);

                myMin = myMin < trbBaseDepth.Minimum ? trbBaseDepth.Minimum : myMin;



                int myMax = (int)(trbBaseDepth.Value + updDepthRandom.Value);

                myMax = myMax > trbBaseDepth.Maximum ? trbBaseDepth.Maximum : myMax;

                baseDepth = -myRandom.Next(myMin, myMax);



            }

            else baseDepth = -trbBaseDepth.Value;



            baseWidthCorrection = trbBaseDepth.Value + 100;



        }



        private void setControlsSize()

        {

            int newWidth = (pnlBottom.Size.Width + baseWidthCorrection);

            int newHeight = (pnlBottom.Size.Height);



            picAnaglyph.Size =   new Size(newWidth, newHeight);

        }



        private void resetCollections()

        {

            foreach (frmObject mySnow in mySnowCollection) mySnow.Dispose();

        }



        private void showResult(int myItem)

        {

            switch (myItem)

            {

                case 0:

                    picAnaglyph.Image = bmpAnaglyph;

                    break;

                case 1:

                    picAnaglyph.Image = leftBitmap;

                    break;

                case 2:

                    picAnaglyph.Image = rightBitmap;

                    break;

                case 3:

                    picAnaglyph.Image = redBitmap;

                    break;

                case 4:

                    picAnaglyph.Image = cyanBitmap;

                    break;

            }

        }

        #endregion





        #region Main Calculations



        // Main Calculations

        private void startCalculation()

        {



            int rocksType = myRandom.Next(14);

            int cloudsType = myRandom.Next(13);



            myAllPicCollection = new List<picCollection>();

            mySnowCollection = new List<frmObject>();







            myGeneralSize = trbGeneralSize.Value * .05f;

            myViewAngle = (140 - trbViewAngle.Value) * .03f;

            myAltitude = trbAltitude.Value / 4f;

            myGroundHeight = (int)(picAnaglyph.Height / myViewAngle);

            myBackHeight = picAnaglyph.Height - myGroundHeight;



            //selecting Rocks and mountains  with different size for painting on the scene

            if (chkRockObjects.Checked)

            {

                if (picsAll[myObjectTypes.Rock.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updRockObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myTypeNumber = myObjectTypes.Rock.GetHashCode();

                            myPicInfo.myType = myObjectTypes.Rock;

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Rock.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Rock.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthRockStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthRocksMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthRocks.Value / (15 * myRandom.NextDouble() + (100 - trbDepthRocksNoise.Value) / 100f))))

                                , 2);



                            myPicInfo.myScale = (float)(Math.Pow(trbSizeRock.Value, 1.5) / 120 / Math.Pow(myPicInfo.myDepth, (.5 + (trbZoom.Value - 20) / 100f + trbZoomRocks.Value / 100f)) * myGeneralSize / Math.Pow(myAltitude, .5) + (trbInitialSize.Value / 100f + trbInitialRocks.Value / 100f));

                            if (rocksType == 1) myPicInfo.myX = (myRandom.Next(-(int)myPicInfo.myImage.Width, (int)(picAnaglyph.Width / 4 - myPicInfo.myDepth * picAnaglyph.Width / 40 - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (rocksType == 2) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 4 + myPicInfo.myDepth * picAnaglyph.Width / 40), (int)(picAnaglyph.Width + (myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (rocksType == 3) myPicInfo.myX = (myRandom.Next(-(int)myPicInfo.myImage.Width, (int)(picAnaglyph.Width / 6 + myPicInfo.myDepth * picAnaglyph.Width / 60 - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (rocksType == 4) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 2 - myPicInfo.myDepth * picAnaglyph.Width / 50), (int)(picAnaglyph.Width + (myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (rocksType == 5) myPicInfo.myX = (myRandom.Next((int)(-picAnaglyph.Width / 2 + myPicInfo.myDepth * picAnaglyph.Width / 5), (int)(picAnaglyph.Width + (myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (rocksType == 6) myPicInfo.myX = (myRandom.Next(2) == 0 ? (myRandom.Next(-(int)myPicInfo.myImage.Width, (int)(picAnaglyph.Width / 5 - myPicInfo.myImage.Width))) : (myRandom.Next(picAnaglyph.Width * 2 / 3, picAnaglyph.Width)));

                            else if (rocksType == 7) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 20 + myPicInfo.myDepth * picAnaglyph.Width / 30), (int)(picAnaglyph.Width / 2 - (myPicInfo.myImage.Width * myPicInfo.myScale / 1.5f))));

                            else if (rocksType == 8) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 5 + myPicInfo.myDepth * picAnaglyph.Width / 10), (int)(picAnaglyph.Width / 20 + (myPicInfo.myImage.Width * myPicInfo.myScale))));

                            else if (rocksType == 9) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 6f), (int)(Math.Cos(myPicInfo.myDepth / 1.5f * Math.PI / 180) * picAnaglyph.Width / 5f)));

                            else if (rocksType == 10) myPicInfo.myX = (myRandom.Next((int)(Math.Sin(myPicInfo.myDepth / 1.1f * Math.PI / 180) * picAnaglyph.Width), picAnaglyph.Width));

                            else if (rocksType == 11) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 2 - Math.Sin(myPicInfo.myDepth * Math.PI / 180) * picAnaglyph.Width), (int)(picAnaglyph.Width / 2f + Math.Sin(myPicInfo.myDepth * Math.PI / 180) * picAnaglyph.Width - myPicInfo.myImage.Width * myPicInfo.myScale)));

                            else myPicInfo.myX = (myRandom.Next(2) == 0 ? (myRandom.Next(-(int)myPicInfo.myImage.Width, (int)(picAnaglyph.Width / 5 - myPicInfo.myImage.Width * myPicInfo.myScale))) : (myRandom.Next(picAnaglyph.Width * 2 / 3, picAnaglyph.Width)));



                            if (myPicInfo.myX < (picAnaglyph.Width))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }



            // selecting Clouds  with different size for painting on the scene

            if (chkCloudObjects.Checked)

            {

                if (picsAll[myObjectTypes.Cloud.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updCloudObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myTypeNumber = myObjectTypes.Cloud.GetHashCode();

                            myPicInfo.myType = myObjectTypes.Cloud;

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Cloud.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Cloud.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthCloudsStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthCloudsMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthClouds.Value / (10 * myRandom.NextDouble() + (100 - trbDepthCloudsNoise.Value) / 100f))))

                                , 2);



                            myPicInfo.myScale = (float)(Math.Pow(trbSizeCloud.Value, 1.5) / 50 * myGeneralSize / Math.Pow(myAltitude, .4) + (trbInitialSize.Value / 100f));

 

                            if (cloudsType == 1) myPicInfo.myX = (myRandom.Next((int)(-picAnaglyph.Width / 10 - myPicInfo.myImage.Width), (int)(picAnaglyph.Width / 2 - myPicInfo.myDepth * picAnaglyph.Width / 40 - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (cloudsType == 2) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 10 + myPicInfo.myDepth * picAnaglyph.Width / 60), (int)(picAnaglyph.Width + (myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (cloudsType == 3) myPicInfo.myX = (myRandom.Next(-(int)myPicInfo.myImage.Width, (int)(picAnaglyph.Width / 8 + myPicInfo.myDepth * picAnaglyph.Width / 60 - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (cloudsType == 4) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width * 2 / 3 - myPicInfo.myDepth * picAnaglyph.Width / 50), (int)(picAnaglyph.Width + (myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (cloudsType == 5) myPicInfo.myX = (myRandom.Next((int)(-picAnaglyph.Width / 2 + myPicInfo.myDepth * picAnaglyph.Width / 5), (int)(picAnaglyph.Width + (myPicInfo.myImage.Width * myPicInfo.myScale / 2))));

                            else if (cloudsType == 6) myPicInfo.myX = (myRandom.Next(2) == 0 ? (myRandom.Next(-(int)myPicInfo.myImage.Width, (int)(picAnaglyph.Width / 4 - myPicInfo.myImage.Width))) : (myRandom.Next(picAnaglyph.Width / 2, picAnaglyph.Width)));

                            else if (cloudsType == 7) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 20 + myPicInfo.myDepth * picAnaglyph.Width / 30), (int)(picAnaglyph.Width * 2 / 3 - (myPicInfo.myImage.Width * myPicInfo.myScale / 1.5f))));

                            else if (cloudsType == 8) myPicInfo.myX = (myRandom.Next(-(int)myPicInfo.myImage.Width, picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2)));

                            else if (cloudsType == 9) myPicInfo.myX = (myRandom.Next(2) == 0 ? (myRandom.Next(-(int)myPicInfo.myImage.Width, (int)(picAnaglyph.Width / 3 - myPicInfo.myImage.Width * myPicInfo.myScale))) : (myRandom.Next(picAnaglyph.Width * 2 / 3, picAnaglyph.Width)));

                            else if (cloudsType == 10) myPicInfo.myX = (myRandom.Next((int)(picAnaglyph.Width / 2 - Math.Sin(myPicInfo.myDepth * Math.PI / 180) * picAnaglyph.Width), (int)(picAnaglyph.Width / 2f + Math.Sin(myPicInfo.myDepth * Math.PI / 180) * picAnaglyph.Width - myPicInfo.myImage.Width * myPicInfo.myScale)));



                            else myPicInfo.myX = (myRandom.Next(picAnaglyph.Width));



                            myPicInfo.myY = (myRandom.Next(

                                (int)(1 - myPicInfo.myImage.Height * myPicInfo.myScale),

                                (int)(myBackHeight * 3 / 4f - myPicInfo.myImage.Height * myPicInfo.myScale - myPicInfo.myDepth * myAltitude + (trbInitialCloud.Value - 50) * 10 + (myPicInfo.myDepth * trbZoomCloud.Value / 2))));



                            if (myPicInfo.myX < (picAnaglyph.Width))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }







            // making Fog  for painting on the scene

            if (chkFogObjects.Checked)

            {

                if (picsAll[myObjectTypes.Cloud.GetHashCode()].Count > 0) // fog uses clouds objects

                {

                    for (int i = 1; i <= updFogObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myTypeNumber = myObjectTypes.Fog.GetHashCode();

                            myPicInfo.myType = myObjectTypes.Fog;

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Cloud.GetHashCode()].Count);// fog uses clouds objects

                            myPicInfo.myImage = picsAll[myObjectTypes.Cloud.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthFogStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthFogMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthFog.Value / (10 * myRandom.NextDouble() + (100 - trbDepthFogNoise.Value) / 100f))))

                                , 2);

                            myPicInfo.myScale = (float)(Math.Pow(myPicInfo.myDepth, (1 + trbZoom.Value / 100f + trbZoomFog.Value / 100f)) * Math.Pow(trbSizeFog.Value, 1.2) / 1000 * myGeneralSize / Math.Pow(myAltitude, .5) + (trbInitialFog.Value / 100f + trbInitialFog.Value / 100f));



                            myPicInfo.myX = (myRandom.Next(-(int)(myPicInfo.myImage.Width * myPicInfo.myScale), picAnaglyph.Width));



                            if (myPicInfo.myX < (picAnaglyph.Width))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }







            //selecting Fishes  with different size for painting on the scene

            if (chkFishObject.Checked && rdoLandscapePersianGulf.Checked)

            {

                if (picsAll[myObjectTypes.Fish.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updFishesObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myTypeNumber = myObjectTypes.Fish.GetHashCode();

                            myPicInfo.myType = myObjectTypes.Fish;

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Fish.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Fish.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthFishesStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthFishesMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthFish.Value / (15 * myRandom.NextDouble() + (100 - trbDepthFishesNoise.Value) / 100f))))

                                , 2);





                             myPicInfo.myScale = (float)(Math.Pow(myPicInfo.myDepth, (1 + trbZoom.Value / 100f + trbZoomFishes.Value / 100f)) * Math.Pow(trbSizeFish.Value, 1.3) / 25000 * myGeneralSize / Math.Pow(myAltitude, .5) + (trbInitialSize.Value / 100f + trbInitialFishes.Value / 100f));

                            myPicInfo.myX = (myRandom.Next(

                                picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2)));



                            if (myPicInfo.myX < (this.Width - myPicInfo.myImage.Width * myPicInfo.myScale - Math.Abs(baseDepth + myPicInfo.myDepth)))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }









            //selecting Ship and boats  with different size for painting on the scene

            if (chkShipObject.Checked && rdoLandscapePersianGulf.Checked)

            {

                if (picsAll[myObjectTypes.Ship.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updShipObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myTypeNumber = myObjectTypes.Ship.GetHashCode();

                            myPicInfo.myType = myObjectTypes.Ship;

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Ship.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Ship.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthShipStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthShipMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthShip.Value / (15 * myRandom.NextDouble() + (100 - trbDepthShipNoise.Value) / 100f))))

                                , 2);



                            myPicInfo.myScale = (float)(Math.Pow(myPicInfo.myDepth, (1 + trbZoom.Value / 100f + trbZoomShips.Value / 100f)) * Math.Pow(trbSizeShip.Value, 1.3) / 25000 * myGeneralSize / Math.Pow(myAltitude, .5) + (trbInitialSize.Value / 100f + trbInitialShip.Value / 100f));

                            myPicInfo.myX = (myRandom.Next(

                                picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2)));



                            if (myPicInfo.myX < (this.Width - myPicInfo.myImage.Width * myPicInfo.myScale - Math.Abs(baseDepth + myPicInfo.myDepth)))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }







            // selecting Flowers  with different size for painting on the scene

            if (chkFlowerObject.Checked && !rdoLandscapePersianGulf.Checked)

            {

                if (picsAll[myObjectTypes.Flower.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updFlowerObject.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myType = myObjectTypes.Flower;

                            myPicInfo.myTypeNumber = myObjectTypes.Flower.GetHashCode();

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Flower.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Flower.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                               (((Math.Abs(baseDepth) * trbDepthFlowerStart.Value / 100f)

                               + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthFlowerMinimum.Value / 100f)))

                               + (myRandom.NextDouble() * ((float)trbDepthFlower.Value / (15 * myRandom.NextDouble() + (100 - trbDepthFlowerNoise.Value) / 100f))))

                               , 2);



                            myPicInfo.myScale = (float)(Math.Pow(myPicInfo.myDepth, (1 + trbZoom.Value / 100f + trbZoomFlowers.Value / 100f)) * Math.Pow(trbSizeFlower.Value, 1.3) / 12000f * myGeneralSize / Math.Pow(myAltitude, .4f) + (trbInitialSize.Value / 100f + trbInitialFlowers.Value / 100f));

                            myPicInfo.myX = (myRandom.Next(

                                 picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale)));

                             if (myPicInfo.myX < (this.Width - myPicInfo.myImage.Width * myPicInfo.myScale - Math.Abs(baseDepth + myPicInfo.myDepth)))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }





            //selecting Trees  with different size for painting on the scene

            if (chkTreeObject.Checked && !rdoLandscapePersianGulf.Checked)

            {

                if (picsAll[myObjectTypes.Tree.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updTreeObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myType = myObjectTypes.Tree;

                            myPicInfo.myTypeNumber = myObjectTypes.Tree.GetHashCode();

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Tree.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Tree.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthTreetart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthTreeMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthTree.Value / (15 * myRandom.NextDouble() + (100 - trbDepthTreeNoise.Value) / 100f))))

                                , 2);



                            myPicInfo.myScale = (float)(Math.Pow(myPicInfo.myDepth, (1 + trbZoom.Value / 100f + trbZoomTrees.Value / 100f)) * Math.Pow(trbSizeTree.Value, 1.8) / 5000 * myGeneralSize / Math.Pow(myAltitude, .5) + (trbInitialSize.Value / 100f + trbInitialTrees.Value / 100f));



                            myPicInfo.myX = (myRandom.Next(-(int)myPicInfo.myImage.Width, picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale / 2)));



                            if (myPicInfo.myDepth < (Math.Abs(baseDepth)) && myPicInfo.myX < (picAnaglyph.Width)) // I don't want to show trees in front of the monitor screen 

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }















            // selecting Animals  with different size for painting on the scene

            if (chkAnimalObjects.Checked && !rdoLandscapePersianGulf.Checked)

            {

                if (picsAll[myObjectTypes.Animal.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updAnimalObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myTypeNumber = myObjectTypes.Animal.GetHashCode();

                            myPicInfo.myType = myObjectTypes.Animal;

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Animal.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Animal.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthAnimalsStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthAnimalsMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthAnimals.Value / (15 * myRandom.NextDouble() + (100 - trbDepthAnimalsNoise.Value) / 100f))))

                                , 2);



                            myPicInfo.myScale = (float)(Math.Pow(myPicInfo.myDepth, (1 + trbZoom.Value / 100f + trbZoomAnimals.Value / 100f)) * Math.Pow(trbSizeAnimal.Value, 1.3) / 1500 * myGeneralSize / Math.Pow(myAltitude, .5) + (trbInitialSize.Value / 100f + trbInitialAnimal.Value / 100f));

                            myPicInfo.myX = (myRandom.Next(

                                picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale)));



                            if (myPicInfo.myX < (this.Width - myPicInfo.myImage.Width * myPicInfo.myScale - Math.Abs(baseDepth + myPicInfo.myDepth)))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }





            // selecting Humans  with different size for painting on the scene

            if (chkHumanObject.Checked && !rdoLandscapePersianGulf.Checked)

            {

                if (picsAll[myObjectTypes.Human.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updHumansObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myType = myObjectTypes.Human;

                            myPicInfo.myTypeNumber = myObjectTypes.Human.GetHashCode();

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Human.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Human.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthHumansStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthHumansMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthHuman.Value / (15 * myRandom.NextDouble() + (100 - trbDepthHumansNoise.Value) / 100f))))

                                , 2);



                            myPicInfo.myScale = (float)(Math.Pow(myPicInfo.myDepth, (1 + trbZoom.Value / 100f + trbZoomHumans.Value / 100f)) * Math.Pow(trbSizeHuman.Value, 1.3) / 2300 * myGeneralSize / Math.Pow(myAltitude, .5) + (trbInitialSize.Value / 100f + trbInitialHumans.Value / 100f));

                            myPicInfo.myX = (myRandom.Next(

                                picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale)));



                            if (myPicInfo.myX < (this.Width - myPicInfo.myImage.Width * myPicInfo.myScale - Math.Abs(baseDepth + myPicInfo.myDepth)))

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }





            // selecting Birds  with different size for painting on the scene

            if (chkBirdObjects.Checked)

            {

                if (picsAll[myObjectTypes.Bird.GetHashCode()].Count > 0)

                {

                    for (int i = 1; i <= updBirdObjects.Value; i++)

                    {

                        try

                        {

                            myPicInfo = new picCollection();

                            myPicInfo.myType = myObjectTypes.Bird;

                            myPicInfo.myTypeNumber = myObjectTypes.Bird.GetHashCode();

                            myPicInfo.myOrientation = myRandom.Next(2);

                            myPicInfo.myImageNumber = myRandom.Next(picsAll[myObjectTypes.Bird.GetHashCode()].Count);

                            myPicInfo.myImage = picsAll[myObjectTypes.Bird.GetHashCode()][myPicInfo.myImageNumber];

                            myPicInfo.myImage2 = myPicInfo.myImage;

                            myPicInfo.myDepth = (float)Math.Round(

                                (((Math.Abs(baseDepth) * trbDepthBirdsStart.Value / 100f)

                                + myRandom.NextDouble() * ((Math.Abs(baseDepth) * trbDepthBirdsMinimum.Value / 100f)))

                                + (myRandom.NextDouble() * ((float)trbDepthBirds.Value / (10 * myRandom.NextDouble() + (100 - trbDepthBirdsNoise.Value) / 100f))))

                                , 2);



                            myPicInfo.myScale = (float)(myPicInfo.myDepth * Math.Pow(trbSizeBird.Value, (1 + trbZoom.Value / 100f + trbZoomBirds.Value / 100f)) / 5000 * myGeneralSize / Math.Pow(myAltitude, .4) + (trbInitialSize.Value / 100f + trbInitialBirds.Value / 100f));

                            myPicInfo.myX = (myRandom.Next(

                                (int)Math.Abs(myPicInfo.myDepth + baseDepth),

                                picAnaglyph.Width - (int)(myPicInfo.myImage.Width * myPicInfo.myScale)));

                            myPicInfo.myY = (myRandom.Next((int)(myBackHeight - myPicInfo.myImage.Height * myPicInfo.myScale + myPicInfo.myDepth / 2f - 150 + myAltitude)));



                            if (myPicInfo.myX < (this.Width - myPicInfo.myImage.Width * myPicInfo.myScale - Math.Abs(baseDepth + myPicInfo.myDepth))) // both red and cyan images in the screen. bird's depth could be greater than max depth.

                                myAllPicCollection.Add(myPicInfo);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }





            int mySnowSurface = (int)(myBackHeight - (float)baseDepth * myAltitude);



            // Snow 

            if (mnuShowSnow.Checked && chkSnowObjects.Checked)

            {

                if (picsAll[myObjectTypes.Snow.GetHashCode()].Count > 0)

                {



                    for (int i = 1; i < trbSnow.Value; i++)

                    {

                        try

                        {

                            frmObject frmSnow = new frmObject();



                            frmSnow.MyBasePosition = this.Location;

                            frmSnow.MyBaseSize = this.Size;

                            frmSnow.borderLeft = borderLeft;

                            frmSnow.borderTop = borderTop;

                            frmSnow.borderMenu = mainMenu.Height;

                            frmSnow.isFullScreen = isFullScreen;

                            frmSnow.myDepth = myRandom.Next(40 / myRandom.Next(1, 4));

                            frmSnow.tmrMain.Interval = myRandom.Next(60 - frmSnow.myDepth, 70 - frmSnow.myDepth);

                            frmSnow.MyDirectionVertical = true;

                            frmSnow.MyMovementType = 1;

                            frmSnow.MyMoveSpeed = 1 + frmSnow.myDepth / 20;

                            frmSnow.myMoveDirection = myDirection.Positive;//  (myRandom.Next(2) == 0 ? myDirection.Positive : myDirection.Negative);



                            frmSnow.MyDirectionLimitMin = myRandom.Next(-500, -100);

                            frmSnow.MyDirectionLimitMax = picAnaglyph.Height + myRandom.Next(100, 500);

                            frmSnow.mySurface = mySnowSurface;



                            frmSnow.myPosition = new Point(myRandom.Next(this.Width), this.Height + 100);



                            frmSnow.myType = myObjectTypes.Snow;

                            frmSnow.btmR = (Bitmap)picsAll[myObjectTypes.Snow.GetHashCode()][myRandom.Next(picsAll[myObjectTypes.Snow.GetHashCode()].Count)];

                            frmSnow.btmL = null;



                            mySnowCollection.Add(frmSnow);

                        }

                        catch (ArgumentOutOfRangeException)

                        {

                            continue;

                        }

                    }

                }

            }









        }



        #endregion





        #region Drawings



        // Main Drawing Part

        private void Draw3D()

        {

            leftBitmap = new Bitmap(picAnaglyph.Width, picAnaglyph.Height);

            Graphics gLeft = Graphics.FromImage(leftBitmap);

            gLeft.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            gLeft.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;



            rightBitmap = new Bitmap(picAnaglyph.Width, picAnaglyph.Height);

            Graphics gRight = Graphics.FromImage(rightBitmap); ;

            gRight.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            gRight.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;



            if (chkRandomSky.Checked) picSkySelected = myRandom.Next(2, picsAll[myObjectTypes.Sky.GetHashCode()].Count);

            picSky.BackgroundImage = picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected];



            if (chkRandomGround.Checked) picGroundSelected = myRandom.Next(2, picsAll[myObjectTypes.Ground.GetHashCode()].Count);

            picGround.BackgroundImage = picsAll[myObjectTypes.Ground.GetHashCode()][picGroundSelected];



            if (chkRandomWater.Checked) picWaterSelected = myRandom.Next(1, picsAll[myObjectTypes.Water.GetHashCode()].Count);

            picWater.BackgroundImage = picsAll[myObjectTypes.Water.GetHashCode()][picWaterSelected];



            DrawSky(gLeft, gRight);

            DrawBase(gLeft, gRight);





            // find maximum depth of objects

            maxDepth = 0;

            minDepth = 1000;

            meanDepth = 0;



            foreach (picCollection myP in myAllPicCollection)

            {

                meanDepth += myP.myDepth;

                if (myP.myDepth > maxDepth) maxDepth = myP.myDepth;

                if (myP.myDepth < minDepth) minDepth = myP.myDepth;

            }



            stbInfo = new StringBuilder();

            // drawing all objects of the collection in order by depth on the scene

            for (int d = 0; d <= maxDepth * 100; d++)

            {

                foreach (picCollection myP in myAllPicCollection)

                {

                    if (d == (int)(myP.myDepth * 100))

                    {

                        try

                        {



                            {

                                DrawObjects(gLeft, gRight, myP);



                                //append data to save on file

                                stbInfo.Append(stbPicInfo(myP).ToString());

                            }

                        }

                        catch (Exception e) { Debug.WriteLine("error 234: " + e.Message); }

                    }

                }

            }



            if (mnuShowDepthCrossing.Checked) // drawing guiding lines to show depth values on the image

                DrawGuidLines(gLeft, gRight);





            goAnaglyph();



        }





        // Draw Sky on the scene

        private void DrawSky(Graphics gLeftx, Graphics gRightx)

        {

            // Create ImageAttributes and Set Color Matrix

            ImageAttributes imgAtt = new ImageAttributes();

            // if you select a special effect for sky, system uses it, otherwie system uses general effect

            ColorMatrix myMatrix = new ColorMatrix(picMatrix[(cmbSkyEffect.SelectedIndex > 0 ? cmbSkyEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

            imgAtt.SetColorMatrix(myMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);



            gLeftx.DrawImage(picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected], new Rectangle(baseDepth, 0, picAnaglyph.Width, myBackHeight), 0, 0, picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected].Width, picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected].Height, GraphicsUnit.Pixel, imgAtt);

            gRightx.DrawImage(picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected], new Rectangle(0, 0, picAnaglyph.Width, myBackHeight), 0, 0, picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected].Width, picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected].Height, GraphicsUnit.Pixel, imgAtt);

        }





        // Draw Ground or Water on the scene

        private void DrawBase(Graphics gLeftx, Graphics gRightx)

        {



            Image myBaseImage;

            ColorMatrix myMatrix;



            // Persian Gulf or Golestan Park selected?

            if (rdoLandscapePersianGulf.Checked)

            {

                // Persian Gulf

                myBaseImage = picsAll[myObjectTypes.Water.GetHashCode()][picWaterSelected];

                // if you select a special effect for  water, system uses it, otherwie system uses general effect

                myMatrix = new ColorMatrix(picMatrix[(cmbWaterEffect.SelectedIndex > 0 ? cmbWaterEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);



            }

            else

            {

                // Golestan Park

                myBaseImage = picsAll[myObjectTypes.Ground.GetHashCode()][picGroundSelected];

                // if you select a special effect for  ground, system uses it, otherwie system uses general effect

                myMatrix = new ColorMatrix(picMatrix[(cmbGroundEffect.SelectedIndex > 0 ? cmbGroundEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);



            }



            // Create ImageAttributes and Set Color Matrix

            ImageAttributes imgAtt = new ImageAttributes();

            imgAtt.SetColorMatrix(myMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);



            //by skewing one of the images, we make landscape depth

            Point[] skewPoints = {

                                    new Point(0, myBackHeight ),  // upper-left point

                                    new Point((int)(picAnaglyph.Width+(myGroundHeight /myAltitude)), myBackHeight),  // upper-right point  

                                    new Point((int)(-myGroundHeight /myAltitude ), picAnaglyph.Height)  // lower-left point 

                                  };







            gLeftx.DrawImage(myBaseImage, new Rectangle(baseDepth, myBackHeight, (int)(picAnaglyph.Width + myGroundHeight / myAltitude), myGroundHeight), 0, 0, myBaseImage.Width, myBaseImage.Height, GraphicsUnit.Pixel, imgAtt);

            gRightx.DrawImage(myBaseImage, skewPoints, new Rectangle(0, 0, myBaseImage.Width, myBaseImage.Height), GraphicsUnit.Pixel, imgAtt);

        }





        // Draw Objects on the scene

        private void DrawObjects(Graphics gLeftx, Graphics gRightx, picCollection myP)

        {



            ColorMatrix myMatrix = new ColorMatrix();





            // you can deactivate some objects in refresh time. also make special effects for groups of objects

            switch (myP.myType)

            {

                case myObjectTypes.Cloud:

                    if (!chkCloudObjects.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbCloudEffect.SelectedIndex > 0 ? cmbCloudEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Fog:

                    if (!chkFogObjects.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbFogEffect.SelectedIndex > 0 ? cmbFogEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Rock:

                    if (!chkRockObjects.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbRockEffect.SelectedIndex > 0 ? cmbRockEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;





                case myObjectTypes.Bird:

                    if (!chkBirdObjects.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbBirdEffect.SelectedIndex > 0 ? cmbBirdEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Ship:

                    if (!chkShipObject.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbShipEffect.SelectedIndex > 0 ? cmbShipEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Fish:

                    if (!chkFishObject.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbFishEffect.SelectedIndex > 0 ? cmbFishEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Human:

                    if (!chkHumanObject.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbHumanEffect.SelectedIndex > 0 ? cmbHumanEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Animal:

                    if (!chkAnimalObjects.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbAnimalEffect.SelectedIndex > 0 ? cmbAnimalEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Flower:

                    if (!chkFlowerObject.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbFlowerEffect.SelectedIndex > 0 ? cmbFlowerEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



                case myObjectTypes.Tree:

                    if (!chkTreeObject.Checked) return;

                    myMatrix = new ColorMatrix(picMatrix[(cmbTreeEffect.SelectedIndex > 0 ? cmbTreeEffect.SelectedIndex : cmbGeneralEffect.SelectedIndex)]);

                    break;



            }



            Bitmap tempImage = new Bitmap(myP.myImage);

            Bitmap tempImage2 = new Bitmap(myP.myImage2);



            switch (myObjectsOrientation)

            {

                case 0:

                case 1:

                    if (myP.myOrientation == 1)

                    {

                        tempImage.RotateFlip(RotateFlipType.RotateNoneFlipX);

                        tempImage2.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    }

                    break;

                case 2:

                    if (myP.myOrientation == 0)

                    {

                        tempImage.RotateFlip(RotateFlipType.RotateNoneFlipX);

                        tempImage2.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    }

                    break;

                case 3:

                    if (myRandom.Next(2) == 0)

                    {

                        tempImage.RotateFlip(RotateFlipType.RotateNoneFlipX);

                        tempImage2.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    }



                    break;

                case 4:

                    // 

                    break;

                case 5:

                    {

                        tempImage.RotateFlip(RotateFlipType.RotateNoneFlipX);

                        tempImage2.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    }

                    break;

            }



            // Create ImageAttributes and Set Color Matrix

            ImageAttributes imgAtt = new ImageAttributes();

            imgAtt.SetColorMatrix(myMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);





            if (myP.myType != myObjectTypes.Bird && myP.myType != myObjectTypes.Cloud)

                 myP.myY = myBackHeight 

                    - ((float)myP.myImage.Height * myP.myScale)

                    + (myAltitude * myP.myDepth)

                    + myAltitude;

            int mynewY = (int)myP.myY + trbdigging.Value;



            gLeftx.DrawImage(tempImage, new Rectangle((int)myP.myX, (int)(mynewY), (int)(tempImage.Width * myP.myScale), (int)(tempImage.Height * myP.myScale)), 0, 0, tempImage.Width, tempImage.Height, GraphicsUnit.Pixel, imgAtt);

            gRightx.DrawImage(tempImage2, new Rectangle((int)(myP.myX - myP.myDepth - baseDepth), (int)(mynewY), (int)(tempImage2.Width * myP.myScale), (int)(tempImage2.Height * myP.myScale)), 0, 0, tempImage2.Width, tempImage2.Height, GraphicsUnit.Pixel, imgAtt);

            tempImage.Dispose();

            tempImage2.Dispose();

        }





        // Draw Guid lines

        private void DrawGuidLines(Graphics gLeftx, Graphics gRightx)

        {

            for (int j = 0; j < 100; j++)

            {

                if (j > 4) j++;

                if (j > 8) j += 2;

                if (j > 16) j += 4;



                Brush myBrush = (j == 4 ? Brushes.Black : Brushes.White);

                int myGuide = (int)(myBackHeight - (float)baseDepth * j / 4f * myAltitude);



                gLeftx.DrawLine(new Pen(myBrush, 2f), 0, myGuide, picAnaglyph.Width, myGuide);

                gRightx.DrawLine(new Pen(myBrush, 2f), 0, myGuide, picAnaglyph.Width, myGuide);

                gLeftx.DrawString("Depth= " + (j * 25) + " % (" + (int)(-baseDepth * j / 4f) + ")", new Font("Arial", 20f, FontStyle.Bold), myBrush, 5, myGuide + 2);

                gRightx.DrawString("Depth= " + (j * 25) + " % (" + (int)(-baseDepth * j / 4f) + ")", new Font("Arial", 20f, FontStyle.Bold), myBrush, 5, myGuide + 2);

            }



        }





        #endregion







        #region Anaglyph



        private void goAnaglyph()

        {



            int outputWidth = picAnaglyph.Width,

                outputHeight = picAnaglyph.Height;

            Rectangle myRectangle = new Rectangle(0, 0, outputWidth, outputHeight);



            // Create left Graphics

            Bitmap bmpSource = new Bitmap(leftBitmap);

            Bitmap bmpOutputLeft = new Bitmap(picAnaglyph.Width, picAnaglyph.Height);



            Graphics g = Graphics.FromImage(bmpOutputLeft);

            g.Clear(System.Drawing.Color.Transparent);

            ImageAttributes imgAttribs = new ImageAttributes();

            // Set color matrix

            imgAttribs.SetColorMatrix(new ColorMatrix(anaglyphMatrix[0]), ColorMatrixFlag.Default, ColorAdjustType.Default);

            // Draw image with ImageAttributes

            g.DrawImage(bmpSource, myRectangle, 0, 0, bmpSource.Width, bmpSource.Height, GraphicsUnit.Pixel, imgAttribs);

            bmpSource.Dispose();

            g.Dispose();



            // Create right Graphics 

            bmpSource = new Bitmap(rightBitmap);

            Bitmap bmpOutputRight = new Bitmap(picAnaglyph.Width, picAnaglyph.Height);



            g = Graphics.FromImage(bmpOutputRight);

            g.Clear(System.Drawing.Color.Transparent);

            imgAttribs = new ImageAttributes();

            // Set color matrix

            imgAttribs.SetColorMatrix(new ColorMatrix(anaglyphMatrix[1]), ColorMatrixFlag.Default, ColorAdjustType.Default);

            // Draw image with ImageAttributes

            g.DrawImage(bmpSource, myRectangle, 0, 0, bmpSource.Width, bmpSource.Height, GraphicsUnit.Pixel, imgAttribs);

            bmpSource.Dispose();

            g.Dispose();



            redBitmap = new Bitmap(bmpOutputLeft);

            cyanBitmap = new Bitmap(bmpOutputRight);



            unsafe //mixing colors

            {

                BitmapData bmpData = bmpOutputLeft.LockBits(myRectangle, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

                Color myPixel;





                for (int y = 0; y < bmpData.Height; y++)

                {

                    byte* myRow = (byte*)bmpData.Scan0 + (y * bmpData.Stride);

                    for (int x = 0, p = 0; x < bmpData.Width; p += 3, x++)

                    {

                        myPixel = bmpOutputRight.GetPixel(x, y);





                        myRow[p] += myPixel.B;

                        myRow[p + 1] += myPixel.G;

                        myRow[p + 2] += myPixel.R;



                    }

                }

                bmpOutputLeft.UnlockBits(bmpData);

            }

            bmpOutputRight.Dispose();

            bmpAnaglyph = new Bitmap(outputWidth, outputHeight);

            g = Graphics.FromImage(bmpAnaglyph);

            g.DrawImage(bmpOutputLeft, 0, 0, new Rectangle(0, 0, outputWidth, outputHeight), GraphicsUnit.Pixel);

            bmpOutputLeft.Dispose();



        }





        #endregion





        #region Save output



        private StringBuilder stbPicInfo(picCollection myP)

        {



            StringBuilder sb = new StringBuilder();



            sb.AppendLine("-> ");

            sb.Append(myP.myDepth);

            sb.Append(" , ");

            sb.Append(myP.myType.GetHashCode());

            sb.Append(" , ");

            sb.Append(myP.myType);

            sb.Append(" , ");

            sb.Append(myP.myImageNumber);

            sb.Append(" , ");

            sb.Append(myP.myX);

            sb.Append(" , ");

            sb.Append(myP.myY);

            sb.Append(" , ");

            sb.Append(myP.myScale);

            sb.Append(" , ");

            sb.Append(myP.myOrientation);

            sb.Append(" , ");

            sb.Append(myP.myImage.Width);

            sb.Append(" , ");

            sb.Append(myP.myImage.Height);

            sb.Append(" , ");

            sb.Append("@&@");



            return sb;

        }







        private void setDataForSave()

        {



            StringBuilder stbMain = new StringBuilder();



            // //append data to save on file

            stbMain.AppendLine("[Persian Gulf Anaglyph]");

            stbMain.AppendLine("[ver:  1.0.1]");

            stbMain.AppendLine("-----------");

            stbMain.AppendLine(myGeneralFileName);

            stbMain.AppendLine("-----------");

            stbMain.AppendLine(myTitle);

            stbMain.AppendLine("-----------");

            stbMain.AppendLine("#&*!@$%*");

            stbMain.AppendLine("-----------");

            stbMain.AppendLine();

            stbMain.AppendLine("[START]");



            stbMain.AppendLine();

            stbMain.AppendLine("(window size = " + this.Size.ToString() + ")");

            stbMain.AppendLine("(pic size = " + picAnaglyph.Size.ToString() + ")");





            stbMain.AppendLine();

            stbMain.AppendLine("(myGeneralSize = " + myGeneralSize + ")");

            stbMain.AppendLine("(myViewAngle = " + myViewAngle + ")");

            //stbMain.AppendLine("(myStartingSize = " + myStartingSize + ")");

            stbMain.AppendLine("(myAltitude = " + myAltitude + ")");

            stbMain.AppendLine("(myGroundHeight = " + myGroundHeight + ")");

            stbMain.AppendLine("(myBackHeight = " + myBackHeight + ")");

            stbMain.AppendLine();



            stbMain.AppendLine();

            stbMain.AppendLine(rdoLandscapePersianGulf.Checked ? "( Persian Gulf )" : "( Golestan National Park )");

            stbMain.AppendLine("( Based On : " + mnuOut1.Text + ")");

            stbMain.AppendLine("( " + mnuOut2.Text + " )");

            stbMain.AppendLine("( Overall Size = " + trbGeneralSize.Value + " )");

            stbMain.AppendLine("( Initial Size = " + trbInitialSize.Value + " )");

            stbMain.AppendLine("( View Angle = " + trbViewAngle.Value + " )");

            stbMain.AppendLine("( Altitute = " + trbAltitude.Value + " )");

            stbMain.AppendLine("( Zoom = " + trbZoom.Value + " )");

            stbMain.AppendLine("( Digging = " + trbdigging.Value + " )");

            stbMain.AppendLine("( Depth Level= " + trbBaseDepth.Value + " , " + (chkDepthRandom.Checked ? "1" : "0") + " , " + updDepthRandom.Value + " )");

            stbMain.AppendLine();









            //if (chkCloudObjects.Checked)

            stbMain.AppendLine("(Cloud : " + (chkCloudObjects.Checked ? "1" : "0") + " , " + updCloudObjects.Value + " , " + trbSizeCloud.Value + " , " + trbInitialCloud.Value + " , " + trbZoomCloud.Value + " , " + trbDepthCloudsStart.Value + " , " + trbDepthCloudsMinimum.Value + " , " + trbDepthClouds.Value + " , " + trbDepthCloudsNoise.Value + " , " + cmbCloudEffect.SelectedIndex + ") ");



            //if (chkCloudObjects.Checked)

            stbMain.AppendLine("(Fog : " + (chkFogObjects.Checked ? "1" : "0") + " , " + updFogObjects.Value + " , " + trbSizeFog.Value + " , " + trbInitialFog.Value + " , " + trbZoomFog.Value + " , " + trbDepthFogStart.Value + " , " + trbDepthFogMinimum.Value + " , " + trbDepthFog.Value + " , " + trbDepthFogNoise.Value + " , " + cmbFogEffect.SelectedIndex + ") ");



            //if (chkRockObjects.Checked)

            stbMain.AppendLine("(Rock : " + (chkRockObjects.Checked ? "1" : "0") + " , " + updRockObjects.Value + " , " + trbSizeRock.Value + " , " + trbInitialRocks.Value + " , " + trbZoomRocks.Value + " , " + trbDepthRockStart.Value + " , " + trbDepthRocksMinimum.Value + " , " + trbDepthRocks.Value + " , " + trbDepthRocksNoise.Value + " , " + cmbRockEffect.SelectedIndex + ") ");



            //if (chkBirdObjects.Checked)

            stbMain.AppendLine("(Bird : " + (chkBirdObjects.Checked ? "1" : "0") + " , " + updBirdObjects.Value + " , " + trbSizeBird.Value + " , " + trbInitialBirds.Value + " , " + trbZoomBirds.Value + " , " + trbDepthBirdsStart.Value + " , " + trbDepthBirdsMinimum.Value + " , " + trbDepthBirds.Value + " , " + trbDepthBirdsNoise.Value + " , " + cmbBirdEffect.SelectedIndex + ") ");



            //if (chkShipObject.Checked)

            stbMain.AppendLine("(Ship : " + (chkShipObject.Checked ? "1" : "0") + " , " + updShipObjects.Value + " , " + trbSizeShip.Value + " , " + trbInitialShip.Value + " , " + trbZoomShips.Value + " , " + trbDepthShipStart.Value + " , " + trbDepthShipMinimum.Value + " , " + trbDepthShip.Value + " , " + trbDepthShipNoise.Value + " , " + cmbShipEffect.SelectedIndex + ") ");



            //if (chkAnimalObjects.Checked)

            stbMain.AppendLine("(Fish : " + (chkFishObject.Checked ? "1" : "0") + " , " + updFishesObjects.Value + " , " + trbSizeFish.Value + " , " + trbInitialFishes.Value + " , " + trbZoomFishes.Value + " , " + trbDepthFishesStart.Value + " , " + trbDepthFishesMinimum.Value + " , " + trbDepthFish.Value + " , " + trbDepthFishesNoise.Value + " , " + cmbFishEffect.SelectedIndex + ") ");



            //if (chkAnimalObjects.Checked)

            stbMain.AppendLine("(Human : " + (chkHumanObject.Checked ? "1" : "0") + " , " + updHumansObjects.Value + " , " + trbSizeHuman.Value + " , " + trbInitialHumans.Value + " , " + trbZoomHumans.Value + " , " + trbDepthHumansStart.Value + " , " + trbDepthHumansMinimum.Value + " , " + trbDepthHuman.Value + " , " + trbDepthHumansNoise.Value + " , " + cmbHumanEffect.SelectedIndex + ") ");



            //if (chkAnimalObjects.Checked)

            stbMain.AppendLine("(Animal : " + (chkAnimalObjects.Checked ? "1" : "0") + " , " + updAnimalObjects.Value + " , " + trbSizeAnimal.Value + " , " + trbInitialAnimal.Value + " , " + trbZoomAnimals.Value + " , " + trbDepthAnimalsStart.Value + " , " + trbDepthAnimalsMinimum.Value + " , " + trbDepthAnimals.Value + " , " + trbDepthAnimalsNoise.Value + " , " + cmbAnimalEffect.SelectedIndex + ") ");



            //if (chkFlowerObject.Checked)

            stbMain.AppendLine("(Flower : " + (chkFlowerObject.Checked ? "1" : "0") + " , " + updFlowerObject.Value + " , " + trbSizeFlower.Value + " , " + trbInitialFlowers.Value + " , " + trbZoomFlowers.Value + " , " + trbDepthFlowerStart.Value + " , " + trbDepthFlowerMinimum.Value + " , " + trbDepthFlower.Value + " , " + trbDepthFlowerNoise.Value + " , " + cmbFlowerEffect.SelectedIndex + ") ");



            //if (chkTreeObject.Checked)

            stbMain.AppendLine("(Tree : " + (chkTreeObject.Checked ? "1" : "0") + " , " + updTreeObjects.Value + " , " + trbSizeTree.Value + " , " + trbInitialTrees.Value + " , " + trbZoomTrees.Value + " , " + trbDepthTreetart.Value + " , " + trbDepthTreeMinimum.Value + " , " + trbDepthTree.Value + " , " + trbDepthTreeNoise.Value + " , " + cmbTreeEffect.SelectedIndex + ") ");



            stbMain.AppendLine();



            stbMain.AppendLine("(Sky Image =  " + picSkySelected + " , " + (chkRandomSky.Checked ? "1" : "0") + " , " + cmbSkyEffect.SelectedIndex + ") ");

            stbMain.AppendLine("(Ground Image =  " + picGroundSelected + " , " + (chkRandomGround.Checked ? "1" : "0") + " , " + cmbGroundEffect.SelectedIndex + ") ");

            stbMain.AppendLine("(Water Image =  " + picWaterSelected + " , " + (chkRandomWater.Checked ? "1" : "0") + " , " + cmbWaterEffect.SelectedIndex + ") ");

            stbMain.AppendLine();



            stbMain.AppendLine("( General Effect = " + cmbGeneralEffect.SelectedIndex + ")");

            stbMain.AppendLine();





            stbMain.AppendLine("Depth = " + (-baseDepth));

            stbMain.AppendLine("Min  Depth = " + minDepth);

            stbMain.AppendLine("Max  Depth = " + maxDepth);

            stbMain.AppendLine("Mean Depth = " + meanDepth / (float)myAllPicCollection.Count);

            stbMain.AppendLine();

            stbMain.AppendLine("Objects count = " + myAllPicCollection.Count);

            stbMain.AppendLine();



            stbMain.AppendLine("[Object]");

            stbMain.AppendLine();



            stbMain.Append(stbInfo.ToString()); // add string containing each object data



            stbMain.AppendLine();

            stbMain.AppendLine();

            stbMain.AppendLine("[END]");

            stbMain.AppendLine("-----------");

            stbMain.AppendLine("[Persian Gulf Anaglyph]");

            stbMain.AppendLine("[By: Mohammad Reza Khosravi]");

            stbMain.AppendLine("[www.toorang.com]");

            stbMain.AppendLine("[ver:  1.0.1]");

            stbMain.AppendLine("-----------");

            stbMain.AppendLine(myGeneralFileName);

            stbMain.AppendLine("-----------");

            stbMain.AppendLine("#&!*@$%*");

            stbMain.AppendLine("-----------");



            stbInfo = stbMain;

        }



        private void setTitle()

        {

            myTitle = (rdoLandscapePersianGulf.Checked ? " Persian Gulf " : " Golestan Park ");

            myTitle += ("[oS" + trbGeneralSize.Value);

            myTitle += (" iS" + trbInitialSize.Value);

            myTitle += (" V" + trbViewAngle.Value);

            myTitle += (" A" + trbAltitude.Value);

            myTitle += (" Z" + trbZoom.Value);

            myTitle += (" G" + trbdigging.Value);

            myTitle += (" D" + (-baseDepth).ToString());

            myTitle += "] ";



            if (chkCloudObjects.Checked)

                myTitle += ("(Cd:" + updCloudObjects.Value + "_" + trbSizeCloud.Value + "_" + trbInitialCloud.Value + "_" + trbZoomCloud.Value + "_" + trbDepthCloudsStart.Value + "_" + trbDepthCloudsMinimum.Value + "_" + trbDepthClouds.Value + "_" + trbDepthCloudsNoise.Value + "_" + cmbCloudEffect.SelectedIndex + ") ");



            if (chkFogObjects.Checked)

                myTitle += ("(Fg:" + updFogObjects.Value + "_" + trbSizeFog.Value + "_" + trbInitialFog.Value + "_" + trbZoomFog.Value + "_" + trbDepthFogStart.Value + "_" + trbDepthFogMinimum.Value + "_" + trbDepthFog.Value + "_" + trbDepthFogNoise.Value + "_" + cmbFogEffect.SelectedIndex + ") ");



            if (chkRockObjects.Checked)

                myTitle += ("(Rk:" + updRockObjects.Value + "_" + trbSizeRock.Value + "_" + trbInitialRocks.Value + "_" + trbZoomRocks.Value + "_" + trbDepthRockStart.Value + "_" + trbDepthRocksMinimum.Value + "_" + trbDepthRocks.Value + "_" + trbDepthRocksNoise.Value + "_" + cmbRockEffect.SelectedIndex + ") ");



            if (chkBirdObjects.Checked)

                myTitle += ("(Bd:" + updBirdObjects.Value + "_" + trbSizeBird.Value + "_" + trbInitialBirds.Value + "_" + trbZoomBirds.Value + "_" + trbDepthBirdsStart.Value + "_" + trbDepthBirdsMinimum.Value + "_" + trbDepthBirds.Value + "_" + trbDepthBirdsNoise.Value + "_" + cmbBirdEffect.SelectedIndex + ") ");



            if (chkShipObject.Checked)

                myTitle += ("(Sh:" + updShipObjects.Value + "_" + trbSizeShip.Value + "_" + trbInitialShip.Value + "_" + trbZoomShips.Value + "_" + trbDepthShipStart.Value + "_" + trbDepthShipMinimum.Value + "_" + trbDepthShip.Value + "_" + trbDepthShipNoise.Value + "_" + cmbShipEffect.SelectedIndex + ") ");



            if (chkFishObject.Checked)

                myTitle += ("(Fs:" + updFishesObjects.Value + "_" + trbSizeFish.Value + "_" + trbInitialFishes.Value + "_" + trbZoomFishes.Value + "_" + trbDepthFishesStart.Value + "_" + trbDepthFishesMinimum.Value + "_" + trbDepthFish.Value + "_" + trbDepthFishesNoise.Value + "_" + cmbFishEffect.SelectedIndex + ") ");



            if (chkHumanObject.Checked)

                myTitle += ("(Hm:" + updHumansObjects.Value + "_" + trbSizeHuman.Value + "_" + trbInitialHumans.Value + "_" + trbZoomHumans.Value + "_" + trbDepthHumansStart.Value + "_" + trbDepthHumansMinimum.Value + "_" + trbDepthHuman.Value + "_" + trbDepthHumansNoise.Value + "_" + cmbHumanEffect.SelectedIndex + ") ");



            if (chkAnimalObjects.Checked)

                myTitle += ("(An:" + updAnimalObjects.Value + "_" + trbSizeAnimal.Value + "_" + trbInitialAnimal.Value + "_" + trbZoomAnimals.Value + "_" + trbDepthAnimalsStart.Value + "_" + trbDepthAnimalsMinimum.Value + "_" + trbDepthAnimals.Value + "_" + trbDepthAnimalsNoise.Value + "_" + cmbAnimalEffect.SelectedIndex + ") ");



            if (chkFlowerObject.Checked)

                myTitle += ("(Fw:" + updFlowerObject.Value + "_" + trbSizeFlower.Value + "_" + trbInitialFlowers.Value + "_" + trbZoomFlowers.Value + "_" + trbDepthFlowerStart.Value + "_" + trbDepthFlowerMinimum.Value + "_" + trbDepthFlower.Value + "_" + trbDepthFlowerNoise.Value + "_" + cmbFlowerEffect.SelectedIndex + ") ");



            if (chkTreeObject.Checked)

                myTitle += ("(Tr:" + updTreeObjects.Value + "_" + trbSizeTree.Value + "_" + trbInitialTrees.Value + "_" + trbZoomTrees.Value + "_" + trbDepthTreetart.Value + "_" + trbDepthTreeMinimum.Value + "_" + trbDepthTree.Value + "_" + trbDepthTreeNoise.Value + "_" + cmbTreeEffect.SelectedIndex + ") ");



            myTitle += ("(S" + cmbSkyEffect.SelectedIndex + "_" + "G" + cmbGroundEffect.SelectedIndex + "_" + "W" + cmbWaterEffect.SelectedIndex + ")");



            this.Text = ("Anaglyph " + myTitle);

            Debug.Print(this.Text);

            Application.DoEvents();



        }









        private void saveData(StringBuilder stbData)

        {

            try

            {

                DirectoryInfo myFileDir = new DirectoryInfo(Application.StartupPath + "\\Save\\Data\\");

                if (myFileDir.Exists)

                {



                    string fullName = myFileDir.FullName + "Anaglyph_" + myGeneralFileName ;



                    fullName = (fullName.Length > 240 ? fullName.Substring(0, 240) : fullName) + ".pga";

                    using (StreamWriter outfile = new StreamWriter(fullName))

                    {

                        outfile.Write(stbData.ToString());

                    }



                }

            }

            catch (Exception ex)

            {

                Debug.WriteLine(ex.Message);

            }

        }



        private void mnuSave_Click(object sender, EventArgs e)

        {

            ImageSave();

        }



        private void ImageSave()

        {

            try

            {

                string fullName = Application.StartupPath + "\\Save\\" + "Anaglyph_" + myGeneralFileName ;

                fullName = (fullName.Length > 240 ? fullName.Substring(0, 240) : fullName) + (MyDefaultImageFormat == 1 ? ".png" : ".jpg");



                ImageSave2(fullName, MyDefaultImageFormat);

            }

            catch (Exception ex)

            {

                Debug.WriteLine(ex.Message);

            }



        }



        private void mnuSaveAs_Click(object sender, EventArgs e)

        {

            bool timerStatus = tmrNext.Enabled;

            tmrNext.Enabled = false;



            saveFileDialog1.FileName = "Anaglyph_" + myGeneralFileName;

            saveFileDialog1.Filter = "PNG|*.png|JPG|*.jpg";

            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)

            {

                try

                {

                    ImageSave2(saveFileDialog1.FileName, saveFileDialog1.FilterIndex);

                }

                catch (Exception ex)

                {

                    MessageBox.Show(ex.Message);

                }



            }

            tmrNext.Enabled = timerStatus;

        }



        private void ImageSave2(string fileName, int extension)

        {

            Bitmap fullImage = new Bitmap(picAnaglyph.Width - baseWidthCorrection, picAnaglyph.Height);

            Graphics g = Graphics.FromImage(fullImage);



            try

            {

                g.Clear(Color.White);

                g.DrawImage(bmpAnaglyph, new Rectangle(0, 0, fullImage.Width, fullImage.Height), new Rectangle(0, 0, fullImage.Width, fullImage.Height), GraphicsUnit.Pixel);

                fullImage.Save(fileName, (extension == 1 ? ImageFormat.Png : ImageFormat.Jpeg));



                if (mnuSaveLeftRightImages.Checked) // save also left and right images

                {

                    g.Clear(Color.White);

                    g.DrawImage(leftBitmap, new Rectangle(0, 0, fullImage.Width, fullImage.Height), new Rectangle(0, 0, fullImage.Width, fullImage.Height), GraphicsUnit.Pixel);

                    fullImage.Save(fileName + "_Left" + (extension == 1 ? ".png" : ".jpg"), (extension == 1 ? ImageFormat.Png : ImageFormat.Jpeg));



                    g.Clear(Color.White);

                    g.DrawImage(rightBitmap, new Rectangle(0, 0, fullImage.Width, fullImage.Height), new Rectangle(0, 0, fullImage.Width, fullImage.Height), GraphicsUnit.Pixel);

                    fullImage.Save(fileName + "_Right" + (extension == 1 ? ".png" : ".jpg"), (extension == 1 ? ImageFormat.Png : ImageFormat.Jpeg));



                }







                if (mnuSaveRedCyanImages.Checked) // save also red and cyan images

                {

                    g.Clear(Color.White);

                    g.DrawImage(redBitmap, new Rectangle(0, 0, fullImage.Width, fullImage.Height), new Rectangle(0, 0, fullImage.Width, fullImage.Height), GraphicsUnit.Pixel);

                    fullImage.Save(fileName + "__Red" + (extension == 1 ? ".png" : ".jpg"), (extension == 1 ? ImageFormat.Png : ImageFormat.Jpeg));



                    g.Clear(Color.White);

                    g.DrawImage(cyanBitmap, new Rectangle(0, 0, fullImage.Width, fullImage.Height), new Rectangle(0, 0, fullImage.Width, fullImage.Height), GraphicsUnit.Pixel);

                    fullImage.Save(fileName + "__Cyan" + (extension == 1 ? ".png" : ".jpg"), (extension == 1 ? ImageFormat.Png : ImageFormat.Jpeg));



                }







                mnuSaveFast.Enabled = false;

            }

            catch (Exception e)

            {

                MessageBox.Show(e.Message);

            }



        }



        #endregion





        #region Predefined Samples



        private void mnuItem_Click(object sender, EventArgs e)

        {

            try

            {

                myObjectsOrientation = 0;

                runMenuItem(((ToolStripItem)sender));

            }

            catch (Exception ex)

            { Debug.WriteLine(ex.Message); }

        }





        private void runMenuItem(ToolStripItem myMenuItemSelected)

        {



            mnuOut1.Text = " -- " + myMenuItemSelected.Text + " -- ";

            bool noRun = false;

            switch (myMenuItemSelected.Name)

            {



                case "mnuResetToZero":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        1, 0, 1, 10, 0,         //General Info

                        1, 1, 1,            //Depth Control

                        0,

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,      //Cloud

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,      //Fog

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,      //Rocks

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,     //Bird

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,     //Ships

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,       //Fishes

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,       //Humans

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,        //Animals

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,       //Flowers

                        1, 1, 1, 0, 0, 0, 0, 0, 0, 0,       //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 10,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    chkAutoRefresh.Checked = false;

                    chkAutoRun.Checked = false;

                    cmbGeneralEffect.SelectedIndex = 0;

                    noRun = true;

                    break;



                case "mnuResetToDefault":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        35, 10, 35, 50, 20,        //General Info

                        80, 1, 40,            //Depth Control

                        0,

                        1, 200, 20, 50, 0, 0, 0, 20, 90, 0,       //Clouds

                        1, 50, 20, 0, 0, 0, 0, 20, 90, 0,       //Fog

                        1, 100, 20, 0, 0, 0, 0, 20, 90, 0,       //Rocks

                        1, 30, 20, 0, 0, 0, 0, 20, 90, 0,       //Bird

                        1, 20, 20, 0, 0, 0, 0, 20, 90, 0,      //Ships

                        1, 5, 20, 0, 0, 0, 0, 20, 90, 0,      //Fihes

                        1, 5, 20, 0, 0, 0, 0, 20, 90, 0,          //Humans

                        1, 20, 20, 0, 0, 0, 0, 20, 90, 0,          //Animals

                        1, 100, 20, 0, 0, 0, 0, 20, 90, 0,         //Flowers

                        1, 10, 40, 0, 0, 0, 0, 20, 90, 0,         //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 50,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    chkAutoRun.Checked = false;

                    chkAutoRefresh.Checked = false;

                    cmbGeneralEffect.SelectedIndex = 0;

                    noRun = true;

                    break;



                ///////////////////////////////////////////////////////////////////////////////////////////////////

                ///////////////////////////////////////////////////////////////////////////////////////////////////

                case "mnuPersianGulfDefault":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        40, 10, 35, 50, 20,        //General Info

                        80, 1, 40,            //Depth Control

                         0,

                       1, 300, 25, 0, 0, 0, 0, 40, 50, 0,     //Clouds

                        1, 50, 20, 0, 0, 0, 0, 20, 90, 0,       //Fog

                        1, 100, 30, 0, 0, 0, 0, 20, 50, 0,     //Rocks

                        1, 30, 30, 0, 0, 0, 0, 20, 40, 0,     //Bird

                        1, 20, 30, 0, 0, 0, 0, 20, 50, 0,     //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 40,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfBinocular":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        20, 10, 45, 15, 20,        //General Info

                        20, 1, 5,            //Depth Control

                        0,

                        1, 100, 28, 65, 5, 0, 100, 45, 35, 0,     //Clouds

                        1, 10, 60, 15, 10, 30, 100, 55, 50, 88,       //Fog

                        1, 300, 25, 0, -40, 0, 60, 0, 0, 0,     //Rocks

                        1, 40, 32, 0, 0, 0, 10, 50, 40, 0,     //Bird

                        1, 10, 40, 45, -10, 10, 300, 100, 80, 0,     //Ships

                        1, 5, 20, 5, 0, 0, 50, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 70,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfBirdsView":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        15, 10, 50, 160, 0,        //General Info

                         160, 1, 20,            //Depth Control

                        0,

                        1, 80, 35, 35, 126, 0, 100, 30, 40, 0,     //Clouds

                        1, 70, 104, 25, 5, 0, 20, 10, 40, 0,       //Fog

                        1, 200, 50, 0, -80, 1, 30, 100, 50, 0,     //Rocks

                        1, 25, 55, 15, 0, 80, 30, 20, 20, 0,     //Bird

                        1, 20, 25, 5, 5, 0, 0, 23, 30, 0,     //Ships

                        1, 10, 20, 5, 5, 1, 0, 30, 55, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 30,              //Snow

                         0, 0, 0, 0, 0, 0, 0, 0,

                       0, 1,              //Sky image

                         0, 0, 0, 0, 0, 0, 0, 0,

                       0, 1,              //Ground image

                         0, 0, 0, 0, 0, 0, 0, 0,

                       0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfOnTheRoof":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        70, 5, 85, 95, 20,         //General Info

                         60, 1, 20,            //Depth Control

                        0,

                        1, 100, 18, 61, 35, 0, 0, 85, 55, 0,     //Clouds

                        1, 50, 65, 40, 10, 0, 10, 5, 8, 93,       //Fog

                        1, 300, 20, 5, -35, 3, 5, 8, 50, 0,     //Rocks

                        1, 25, 18, 0, 10, 0, 10, 30, 40, 0,     //Bird

                        1, 30, 60, 5, 60, 0, 10, 40, 75, 0,     //Ships

                        1, 10, 60, 5, 35, 0, 8, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 60,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfBottomView":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        40, 10, 80, 20, 20,        //General Info

                        50, 1, 30,            //Depth Control

                        0,

                        1, 70, 20, 59, -5, 0, 100, 40, 30, 0,     //Clouds

                        1, 40, 35, 70, -80, 0, 20, 10, 11, 88,       //Fog

                        1, 100, 30, 0, 0, 0, 0, 15, 50, 0,     //Rocks

                        1, 30, 25, 0, 0, 0, 10, 15, 60, 0,     //Bird

                       1, 35, 30, 0, 10, 0, 0, 60, 85, 0,     //Ships

                        1, 10, 20, 0, 0, 0, 8, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 50,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfBottomView2":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        15, 10, 60, 7, 20,         //General Info

                        70, 1, 30,            //Depth Control

                         0,

                        1, 200, 15, 60, 0, 0, 20, 70, 80, 0,     //Clouds

                        1, 60, 60, 40, -80, 0, 10, 0, 0, 88,       //Fog

                        1, 100, 10, 0, -10, 0, 0, 10, 50, 0,     //Rocks

                        1, 40, 20, 0, 0, 0, 10, 85, 40, 0,    //Bird

                        1, 15, 28, 5, 40, 0, 110, 165, 68, 0,     //Ships

                        1, 10, 30, 0, 10, 0, 8, 5, 5, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       //Trees

                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                       1, 60,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfOpenSea":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        30, 10, 100, 22, 20,         //General Info

                        50, 1, 20,            //Depth Control

                        0,

                        1, 150, 25, 60, 20, 0, 0, 45, 35, 0,     //Clouds

                        1, 10, 20, 10, -10, 90, 300, 162, 90, 93,       //Fog

                        1, 100, 10, 0, 0, 0, 0, 10, 50, 0,        //Rocks

                        1, 20, 15, 0, 0, 0, 20, 15, 60, 0,    //Bird

                        1, 15, 35, 0, 25, 0, 5, 24, 6, 0,     //Ships

                        1, 8, 40, 0, 25, 30, 100, 55, 35, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 40,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                         0, 0, 0, 0, 0, 0, 0, 0,

                       0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfOpenSea2":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        40, 10, 1, 10, 20,        //General Info

                        100, 1, 70,            //Depth Control

                        0,

                        1, 200, 25, 77, -5, 0, 30, 20, 30, 0,     //Clouds

                        1, 80, 25, 30, 0, 0, 5, 0, 5, 88,       //Fog

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Rocks

                        1, 50, 15, 0, 0, 0, 0, 25, 50, 0,     //Bird

                        1, 5, 40, 5, 20, 3, 35, 30, 0, 0,     //Ships

                        1, 20, 35, 0, 15, 0, 10, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 50,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    break;

                case "mnuPersianGulfSeaLine":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        35, 10, 70, 40, 20,         //General Info

                        35, 1, 5,            //Depth Control

                        0,

                        1, 100, 20, 64, -5, 0, 25, 0, 0, 0,    //Clouds

                         1, 40, 65, 20, -60, 80, 90, 15, 30, 93,       //Fog

                       1, 150, 10, 0, -70, 20, 120, 35, 25, 0,        //Rocks

                        1, 15, 25, 0, 10, 40, 2, 0, 0, 0,     //Bird

                        1, 10, 30, 5, 10, 3, 2, 0, 0, 0,    //Ships

                        1, 20, 35, 0, 15, 15, 3, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 40,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,              //Water image

                        0);

                    break;

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



                case "mnuGolestanParkDefault":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        40, 10, 35, 50, 20,        //General Info

                        80, 1, 40,            //Depth Control

                         0,

                       1, 300, 25, 0, 0, 0, 0, 20, 50, 0,    //Clouds

                        1, 50, 20, 0, 0, 0, 0, 20, 90, 0,       //Fog

                        1, 100, 30, 0, 0, 0, 0, 10, 50, 0,    //Rocks

                        1, 20, 30, 0, 0, 0, 0, 20, 50, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        1, 20, 30, 0, 0, 0, 0, 20, 50, 0,     //Animals

                        1, 100, 30, 0, 0, 0, 0, 20, 50, 0,    //Flowers

                        1, 30, 30, 0, 0, 0, 0, 15, 50, 0,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 50,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;



                case "mnuGolestanParkDangerZone":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        20, 10, 80, 20, 20,         //General Info

                        10, 1, 7,            //Depth Control

                         0,

                       1, 150, 30, 55, -5, 0, 50, 3, 65, 88,   //Clouds

                        1, 25, 60, 30, 0, 0, 50, 0, 0, 93,       //Fog

                        1, 100, 40, 0, 0, 0, 15, 15, 55, 0,   //Rocks

                        1, 20, 40, 0, 0, 0, 40, 5, 80, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        1, 20, 20, 0, 0, 0, 10, 80, 80, 0,     //Animals

                        1, 300, 16, 0, 0, 0, 5, 30, 90, 0,   //Flowers

                        1, 40, 55, 0, 0, 0, 10, 50, 50, 0,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 70,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;

                case "mnuGolestanParkOnTheTree":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        30, 5, 70, 245, 20,         //General Info

                        170, 1, 20,            //Depth Control

                        0,

                        1, 100, 30, 49, 0, 0, 5, 0, 0, 0,    //Clouds

                        1, 30, 75, 40, -10, 0, 0, 20, 40, 88,       //Fog

                        1, 100, 30, 0, 0, 0, 0, 10, 50, 0,    //Rocks

                        1, 20, 50, 0, 15, 0, 5, 95, 70, 0,    //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        1, 30, 15, 0, 15, 1, 2, 5, 20, 0,    //Human

                        1, 100, 15, 0, 15, 1, 1, 5, 20, 0,    //Animals

                        1, 100, 10, 0, 0, 0, 20, 10, 80, 0,   //Flowers

                        1, 310, 55, 7, 10, 0, 0, 25, 0, 0,     //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 60,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;

                case "mnuGolestanParkNoFear":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                       15, 5, 100, 115, 15,         //General Info

                        60, 1, 15,            //Depth Control

                        0,

                       1, 50, 45, 71, 15, 0, 10, 25, 8, 0,     //Clouds

                        1, 50, 75, 45, 20, 0, 10, 5, 10, 93,       //Fog

                       1, 20, 55, 10, -45, 2, 10, 10, 75, 0,    //Rocks

                       1, 30, 60, 0, 30, 0, 5, 40, 55, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        1, 20, 30, 0, 20, 0, 5, 50, 60, 0,    //Humans

                        1, 50, 30, 0, 20, 0, 5, 60, 100, 0,    //Animals

                        1, 200, 10, 0, 30, 0, 10, 90, 80, 0,    //Flowers

                        1, 100, 85, 0, 30, 0, 5, 15, 15, 0,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 50,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;

                case "mnuGolestanParkOnTheGround":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        20, 10, 5, 25, 20,         //General Info

                        50, 1, 25,            //Depth Control

                        0,

                        1, 200, 40, 50, 0, 0, 0, 20, 50, 0,    //Clouds

                        1, 50, 40, 35, 35, 0, 5, 5, 10, 93,       //Fog

                        1, 200, 30, 0, 0, 0, 0, 30, 50, 0,     //Rocks

                        1, 20, 55, 0, 0, 0, 5, 25, 50, 0,    //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 10, 20, 0, 0, 0, 0, 25, 50, 0,    //Humans

                       1, 40, 20, 0, 10, 0, 0, 25, 50, 0,    //Animals

                       1, 200, 15, 0, 15, 0, 30, 30, 60, 0,    //Flowers

                        1, 50, 55, 0, 10, 0, 0, 30, 50, 0,     //Trees

                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                       1, 40,              //Snow

                         0, 0, 0, 0, 0, 0, 0, 0,

                       0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;

                case "mnuGolestanParkLayDown":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        25, 10, 100, 15, 20,        //General Info

                        130, 1, 20,            //Depth Control

                         0,

                        1, 100, 30, 60, 20, 0, 5, 6, 50, 88,    //Clouds

                        1, 10, 25, 25, 0, 50, 120, 0, 0, 93,       //Fog

                        1, 100, 30, 0, 0, 0, 0, 5, 40, 0,   //Rocks

                        1, 10, 25, 0, 10, 0, 0, 15, 50, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        1, 5, 10, 0, 10, 0, 0, 35, 95, 0,     //Humans

                        1, 40, 10, 0, 10, 0, 0, 35, 95, 0,     //Animals

                        1, 150, 12, 0, 20, 0, 20, 60, 85, 0,   //Flowers

                         1, 50, 55, 0, 10, 0, 0, 30, 55, 0,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 40,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;

                case "mnuGolestanParkFlowerBouquet":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        25, 10, 95, 15, 20,        //General Info

                        15, 1, 2,            //Depth Control

                        0,

                        1, 60, 10, 60, 0, 0, 15, 1, 50, 88,     //Clouds

                        1, 15, 30, 20, 20, 0, 10, 10, 0, 88,       //Fog

                        1, 100, 30, 0, 0, 0, 5, 5, 30, 0,     //Rocks

                        1, 30, 25, 0, 0, 0, 25, 15, 50, 0,     //Bird

                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        1, 40, 20, 0, 3, 0, 0, 16, 30, 0,    //Animals

                        1, 400, 12, 0, 15, 0, 500, 65, 55, 0,    //Flowers

                        1, 30, 55, 0, 0, 0, 0, 30, 55, 0,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 80,              //Snow

                         0, 0, 0, 0, 0, 0, 0, 0,

                       0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;

                case "mnuGolestanParkToday":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        15, 5, 85, 30, 15,        //General Info

                        150, 1, 20,            //Depth Control

                         0,

                        1, 100, 40, 60, 0, 0, 15, 0, 0, 0,    //Clouds

                        1, 50, 40, 25, 5, 0, 5, 0, 0, 0,       //Fog

                        1, 100, 30, 20, 0, 0, 6, 0, 0, 0,   //Rocks

                        1, 30, 40, 0, 10, 0, 10, 20, 50, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        1, 10, 15, 0, 0, 25, 40, 70, 0, 0,     //Humans

                        1, 15, 15, 0, 10, 2, 15, 0, 0, 0,     //Animals

                        1, 300, 5, 0, 25, 5, 10, 100, 85, 0,   //Flowers

                        1, 2, 35, 0, 0, 8, 5, 0, 0, 0,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 30,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Sky image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        3, 0,               //Ground image

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1,               //Water image

                        0);

                    break;

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////

                /////////////////////////////////////////////////////////////////////////////////////////////////

                case "mnuSpecialEffectGolestanWinter":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        20, 10, 20, 50, 30,         //General Info

                        45, 1, 10,            //Depth Control

                         0,

                         1, 100, 45, 85, -16, 0, 10, 10, 20, 88,    //Clouds

                        1, 30, 60, 35, -10, 10, 10, 0, 3, 93,       //Fog

                        1, 300, 40, 20, -30, 0, 5, 35, 60, 23,   //Rocks

                        1, 20, 55, 0, 5, 0, 5, 25, 50, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,     //Humans

                        1, 40, 20, 0, 5, 0, 0, 35, 50, 14,     //Animals

                        1, 250, 20, 0, 0, 0, 10, 50, 60, 39,   //Flowers

                        1, 50, 55, 20, 10, 0, 0, 25, 30, 17,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 80,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 20,               //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 17,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 0,               //Water image

                        0);

                    break;

                case "mnuSpecialEffectColdWay":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        15, 10, 50, 20, 20,         //General Info

                        80, 1, 10,            //Depth Control

                         0,

                        1, 300, 40, 75, -45, 0, 0, 40, 60, 88,    //Clouds

                        1, 20, 95, 55, 40, 0, 5, 0, 0, 91,       //Fog

                        1, 100, 45, 0, 0, 0, 10, 30, 30, 23,   //Rocks

                        1, 20, 55, 0, 0, 0, 10, 5, 0, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        1, 5, 65, 0, -45, 15, 10, 40, 20, 14,     //Humans

                        0, 40, 20, 0, 0, 0, 0, 35, 50, 14,     //Animals

                        1, 350, 20, 0, 0, 0, 10, 90, 60, 39,   //Flowers

                        0, 30, 55, 0, 0, 0, 0, 25, 30, 17,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 50,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 20,               //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 17,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 0,               //Water image

                        0);

                    break;

                case "mnuSpecialEffectArctic":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        15, 10, 45, 30, 20,        //General Info

                        100, 1, 10,            //Depth Control

                         0,

                        1, 400, 50, 75, 0, 0, 70, 65, 45, 88,    //Clouds

                        1, 50, 35, 15, 0, 0, 10, 20, 0, 93,       //Fog

                        1, 100, 20, 10, -40, 0, 40, 60, 40, 22,   //Rocks

                        1, 25, 30, 0, 0, 0, 0, 40, 30, 18,     //Bird

                        1, 7, 55, 0, 40, 0, 5, 0, 0, 19,       //Ships

                        1, 7, 55, 10, 50, 5, 40, 24, 45, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 50,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 21,               //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 0,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 22,               //Water image

                        0);

                    break;

                case "mnuSpecialEffectGolestanEarlyMorning":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        25, 30, 21, 20, 25,        //General Info

                        20, 1, 5,            //Depth Control

                         0,

                       1, 100, 45, 74, 5, 0, 60, 10, 10, 93,    //Clouds

                        1, 10, 50, 35, 0, 63, 429, 0, 0, 93,       //Fog

                        1, 500, 60, 20, 0, 0, 40, 0, 0, 96,   //Rocks

                        1, 5, 110, 10, 30, 0, 10, 0, 0, 28,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        1, 2, 30, 0, -15, 40, 110, 60, 20, 30,     //Animals

                        1, 300, 10, 0, 0, 0, 20, 40, 70, 30,   //Flowers

                        1, 25, 90, 30, 0, 0, 40, 20, 0, 30,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 20,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 24,               //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 31,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 0,               //Water image

                        0);

                    break;

                case "mnuSpecialEffectDarkSea":

                    putInfo(0,              //0=Persian Gulf   1=Golestan Park

                        15, 10, 45, 35, 20,        //General Info

                        90, 1, 20,            //Depth Control

                         0,

                       1, 100, 60, 70, -20, 0, 20, 50, 70, 31,    //Clouds

                        1, 35, 95, 55, -67, 0, 0, 20, 60, 97,       //Fog

                        1, 100, 30, 5, 0, 0, 0, 10, 50, 30,   //Rocks

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,     //Bird

                        1, 10, 58, 5, 80, 0, 20, 105, 78, 30,        //Ships

                        1, 10, 35, 0, 20, 0, 8, 10, 10, 29,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,     //Animals

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   //Flowers

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 20,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 31,               //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 31,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 31,               //Water image

                        0);

                    break;

                case "mnuSpecialEffectNightHill":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        20, 5, 85, 190, -50,         //General Info

                        50, 1, 10,            //Depth Control

                         0,

                       1, 10, 50, 60, 5, 0, 5, 0, 0, 96,    //Clouds

                        1, 40, 90, 50, 0, 0, 10, 20, 0, 97,       //Fog

                        0, 100, 15, 1, 0, 3, 20, 40, 50, 81,   //Rocks

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        1, 20, 105, 5, 0, 0, 0, 60, 50, 28,        //Humans

                       1, 10, 130, 5, 0, 0, 0, 55, 60, 29,     //Animals

                        1, 100, 40, 0, -40, 0, 20, 20, 90, 30,   //Flowers

                        1, 70, 200, 60, -55, 0, 5, 65, 40, 43,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 30,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 32,              //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 31,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 0,              //Water image

                        0);

                    break;

                case "mnuSpecialEffectAvatarNights":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        20, 5, 5, 35, 15,         //General Info

                        50, 1, 10,            //Depth Control

                         0,

                       1, 50, 40, 0, 0, 0, 0, 11, 30, 96,    //Clouds

                        1, 15, 100, 35, 0, 0, 5, 16, 0, 97,       //Fog

                        1, 100, 15, 1, 0, 3, 20, 40, 50, 82,   //Rocks

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,     //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Humans

                       1, 25, 40, 0, 0, 0, 0, 65, 50, 30,     //Animals

                        1, 500, 55, 5, -5, 0, 15, 75, 85, 47,   //Flowers

                        1, 50, 60, 10, 0, 0, 0, 30, 10, 43,    //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 10,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 32,              //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 31,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 0,              //Water image

                        0);

                    break;

                case "mnuSpecialEffectLiliput":

                    putInfo(1,              //0=Persian Gulf   1=Golestan Park

                        65, 0, 75, 60, 10,        //General Info

                        120, 1, 10,            //Depth Control

                        0,

                       1, 100, 25, 60, 0, 0, 2, 0, 0, 0,    //Clouds

                        1, 25, 70, 23, 45, 0, 2, 0, 5, 88,       //Fog

                        1, 80, 80, 0, 0, 0, 3, 0, 0, 0,    //Rocks

                        1, 2, 155, 30, 0, 0, 10, 0, 0, 0,    //Bird

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Ships

                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        //Fishes

                       1, 10, 10, 1, -5, 2, 30, 5, 0, 0,     //Humans

                       1, 2, 80, 40, -15, 3, 10, 0, 0, 0,     //Animals

                        1, 180, 100, 15, -5, 0, 0, 55, 60, 35,   //Flowers

                        1, 5, 80, 5, 0, 1, 10, 5, 5, 36,     //Trees

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

                        1, 20,              //Snow

                        0, 0, 0, 0, 0, 0, 0, 0,

                        0, 1, 40,               //Sky image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 40,               //Ground image

                        0, 0, 0, 0, 0, 0, 0,

                        0, 1, 0,              //Water image

                        0);

                    break;

            }



            Application.DoEvents();

            if (!noRun) goRun(false);

        }













        private void putInfo(params int[] infoArray)

        {

            if (infoArray[0] == 0) rdoLandscapePersianGulf.Checked = true; else rdoLandscapeGolestanPark.Checked = true;

            trbGeneralSize.Value = infoArray[1];

            trbInitialSize.Value = infoArray[2];

            trbViewAngle.Value = infoArray[3];

            trbAltitude.Value = infoArray[4];

            trbZoom.Value = infoArray[5];







            trbBaseDepth.Value = infoArray[6];

            chkDepthRandom.Checked = Convert.ToBoolean(infoArray[7]);

            if (chkDepthRandom.Checked) updDepthRandom.Value = infoArray[8];





            chkCloudObjects.Checked = Convert.ToBoolean(infoArray[10]);

            if (chkCloudObjects.Checked)

            {

                updCloudObjects.Value = infoArray[11];

                trbSizeCloud.Value = infoArray[12];

                trbInitialCloud.Value = infoArray[13];

                trbZoomCloud.Value = infoArray[14];

                trbDepthCloudsStart.Value = infoArray[15];

                trbDepthCloudsMinimum.Value = infoArray[16];

                trbDepthClouds.Value = infoArray[17];

                trbDepthCloudsNoise.Value = infoArray[18];

                cmbCloudEffect.SelectedIndex = infoArray[19];



            }



            chkFogObjects.Checked = Convert.ToBoolean(infoArray[20]);

            if (chkFogObjects.Checked)

            {

                updFogObjects.Value = infoArray[21];

                trbSizeFog.Value = infoArray[22];

                trbInitialFog.Value = infoArray[23];

                trbZoomFog.Value = infoArray[24];

                trbDepthFogStart.Value = infoArray[25];

                trbDepthFogMinimum.Value = infoArray[26];

                trbDepthFog.Value = infoArray[27];

                trbDepthFogNoise.Value = infoArray[28];

                cmbFogEffect.SelectedIndex = infoArray[29];

            }



            chkRockObjects.Checked = Convert.ToBoolean(infoArray[30]);

            if (chkRockObjects.Checked)

            {

                updRockObjects.Value = infoArray[31];

                trbSizeRock.Value = infoArray[32];

                trbInitialRocks.Value = infoArray[33];

                trbZoomRocks.Value = infoArray[34];

                trbDepthRockStart.Value = infoArray[35];

                trbDepthRocksMinimum.Value = infoArray[36];

                trbDepthRocks.Value = infoArray[37];

                trbDepthRocksNoise.Value = infoArray[38];

                cmbRockEffect.SelectedIndex = infoArray[39];

            }



            chkBirdObjects.Checked = Convert.ToBoolean(infoArray[40]);

            if (chkBirdObjects.Checked)

            {

                updBirdObjects.Value = infoArray[41];

                trbSizeBird.Value = infoArray[42];

                trbInitialBirds.Value = infoArray[43];

                trbZoomBirds.Value = infoArray[44];

                trbDepthBirdsStart.Value = infoArray[45];

                trbDepthBirdsMinimum.Value = infoArray[46];

                trbDepthBirds.Value = infoArray[47];

                trbDepthBirdsNoise.Value = infoArray[48];

                cmbBirdEffect.SelectedIndex = infoArray[49];

            }



            chkShipObject.Checked = Convert.ToBoolean(infoArray[50]);

            if (chkShipObject.Checked)

            {

                updShipObjects.Value = infoArray[51];

                trbSizeShip.Value = infoArray[52];

                trbInitialShip.Value = infoArray[53];

                trbZoomShips.Value = infoArray[54];

                trbDepthShipStart.Value = infoArray[55];

                trbDepthShipMinimum.Value = infoArray[56];

                trbDepthShip.Value = infoArray[57];

                trbDepthShipNoise.Value = infoArray[58];

                cmbShipEffect.SelectedIndex = infoArray[59];

            }



            chkFishObject.Checked = Convert.ToBoolean(infoArray[60]);

            if (chkFishObject.Checked)

            {

                updFishesObjects.Value = infoArray[61];

                trbSizeFish.Value = infoArray[62];

                trbInitialFishes.Value = infoArray[63];

                trbZoomFishes.Value = infoArray[64];

                trbDepthFishesStart.Value = infoArray[65];

                trbDepthFishesMinimum.Value = infoArray[66];

                trbDepthFish.Value = infoArray[67];

                trbDepthFishesNoise.Value = infoArray[68];

                cmbFishEffect.SelectedIndex = infoArray[69];

            }



            chkHumanObject.Checked = Convert.ToBoolean(infoArray[70]);

            if (chkHumanObject.Checked)

            {

                updHumansObjects.Value = infoArray[71];

                trbSizeHuman.Value = infoArray[72];

                trbInitialHumans.Value = infoArray[73];

                trbZoomHumans.Value = infoArray[74];

                trbDepthHumansStart.Value = infoArray[75];

                trbDepthHumansMinimum.Value = infoArray[76];

                trbDepthHuman.Value = infoArray[77];

                trbDepthHumansNoise.Value = infoArray[78];

                cmbHumanEffect.SelectedIndex = infoArray[79];

            }



            chkAnimalObjects.Checked = Convert.ToBoolean(infoArray[80]);

            if (chkAnimalObjects.Checked)

            {

                updAnimalObjects.Value = infoArray[81];

                trbSizeAnimal.Value = infoArray[82];

                trbInitialAnimal.Value = infoArray[83];

                trbZoomAnimals.Value = infoArray[84];

                trbDepthAnimalsStart.Value = infoArray[85];

                trbDepthAnimalsMinimum.Value = infoArray[86];

                trbDepthAnimals.Value = infoArray[87];

                trbDepthAnimalsNoise.Value = infoArray[88];

                cmbAnimalEffect.SelectedIndex = infoArray[89];

            }



            chkFlowerObject.Checked = Convert.ToBoolean(infoArray[90]);

            if (chkFlowerObject.Checked)

            {

                updFlowerObject.Value = infoArray[91];

                trbSizeFlower.Value = infoArray[92];

                trbInitialFlowers.Value = infoArray[93];

                trbZoomFlowers.Value = infoArray[94];

                trbDepthFlowerStart.Value = infoArray[95];

                trbDepthFlowerMinimum.Value = infoArray[96];

                trbDepthFlower.Value = infoArray[97];

                trbDepthFlowerNoise.Value = infoArray[98];

                cmbFlowerEffect.SelectedIndex = infoArray[99];

            }



            chkTreeObject.Checked = Convert.ToBoolean(infoArray[100]);

            if (chkTreeObject.Checked)

            {

                updTreeObjects.Value = infoArray[101];

                trbSizeTree.Value = infoArray[102];

                trbInitialTrees.Value = infoArray[103];

                trbZoomTrees.Value = infoArray[104];

                trbDepthTreetart.Value = infoArray[105];

                trbDepthTreeMinimum.Value = infoArray[106];

                trbDepthTree.Value = infoArray[107];

                trbDepthTreeNoise.Value = infoArray[108];

                cmbTreeEffect.SelectedIndex = infoArray[109];

            }



            chkSnowObjects.Checked = Convert.ToBoolean(infoArray[130]);

            if (chkSnowObjects.Checked)

            {

                trbSnow.Value = infoArray[131];

            }



            if (infoArray[140] > 0)

            {

                picSkySelected = infoArray[140] - 1;

                picSky.BackgroundImage = picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected];

            }

            chkRandomSky.Checked = Convert.ToBoolean(infoArray[141]);

            cmbSkyEffect.SelectedIndex = infoArray[142];



            if (infoArray[150] > 0)

            {

                picGroundSelected = infoArray[150] - 1;

                picGround.BackgroundImage = picsAll[myObjectTypes.Ground.GetHashCode()][picGroundSelected];

            }

            chkRandomGround.Checked = Convert.ToBoolean(infoArray[151]);

            cmbGroundEffect.SelectedIndex = infoArray[152];



            if (infoArray[160] > 0)

            {

                picWaterSelected = infoArray[160] - 1;

                picWater.BackgroundImage = picsAll[myObjectTypes.Water.GetHashCode()][picWaterSelected];

            }

            chkRandomWater.Checked = Convert.ToBoolean(infoArray[161]);

            cmbWaterEffect.SelectedIndex = infoArray[162];



        }





        #endregion





        #region Sync controls and set sizes



        // when you resize the program's window, some scales must be changed.

        private void frmMain_SizeChanged(object sender, EventArgs e)

        {

            setControlsSize();

        }



        private void frmMain_ResizeEnd(object sender, EventArgs e)

        {

            // When you resize the main window, snow objects must  set to new position

            foreach (frmObject mySnow in mySnowCollection) mySnow.MyBaseSize = this.Size;



        }









        private void picLeft3D_BackgroundImageChanged(object sender, EventArgs e)

        {

            //picRight3D.BackgroundImage = picLeft3D.BackgroundImage;

        }



        private void chkBirdObjects_CheckedChanged(object sender, EventArgs e)

        {

            updBirdObjects.Enabled = chkBirdObjects.Checked;

        }



        private void chkAnimalObjects_CheckedChanged(object sender, EventArgs e)

        {

            updAnimalObjects.Enabled = chkAnimalObjects.Checked;

        }



        private void chkFlowerObject_CheckedChanged(object sender, EventArgs e)

        {

            updFlowerObject.Enabled = chkFlowerObject.Checked;

        }



        private void chkTreeObject_CheckedChanged(object sender, EventArgs e)

        {

            updTreeObjects.Enabled = chkTreeObject.Checked;

        }



        #endregion





        #region select background and colors





        // show all available backgrounds and skies and select one 

        private void picBack_Click(object sender, EventArgs e)

        {

            frmSelection myfrmBackgrounds = new frmSelection();

            myfrmBackgrounds.setBackgroundImage(picsAll[myObjectTypes.Sky.GetHashCode()]);

            myfrmBackgrounds.ShowDialog();

            if (myfrmBackgrounds.selectedItem >= 0) picSkySelected = myfrmBackgrounds.selectedItem;

            picSky.BackgroundImage = picsAll[myObjectTypes.Sky.GetHashCode()][picSkySelected];



            myfrmBackgrounds.Dispose();

        }



        // show all available ground textures and select one 

        private void picGround_Click(object sender, EventArgs e)

        {

            frmSelection myfrmBackgrounds = new frmSelection();

            myfrmBackgrounds.setBackgroundImage(picsAll[myObjectTypes.Ground.GetHashCode()]);

            myfrmBackgrounds.ShowDialog();

            if (myfrmBackgrounds.selectedItem >= 0) picGroundSelected = myfrmBackgrounds.selectedItem;

            picGround.BackgroundImage = picsAll[myObjectTypes.Ground.GetHashCode()][picGroundSelected];

            myfrmBackgrounds.Dispose();

        }



        private void picWater_Click(object sender, EventArgs e)

        {

            frmSelection myfrmBackgrounds = new frmSelection();

            myfrmBackgrounds.setBackgroundImage(picsAll[myObjectTypes.Water.GetHashCode()]);

            myfrmBackgrounds.ShowDialog();

            if (myfrmBackgrounds.selectedItem >= 0) picWaterSelected = myfrmBackgrounds.selectedItem;

            picWater.BackgroundImage = picsAll[myObjectTypes.Water.GetHashCode()][picWaterSelected];

            myfrmBackgrounds.Dispose();



        }



        // show the color dialog and set the color

        private void setColor(Label thisLabel)

        {

            colorDialog1.Color = thisLabel.BackColor;

            if (colorDialog1.ShowDialog() == DialogResult.OK)

            {

                thisLabel.BackColor = colorDialog1.Color;

            }

        }



        #endregion





        #region Timer



        private void tmrNext_Tick(object sender, EventArgs e)

        {

            startAutoRun();



        }



        private void startAutoRun()

        {

            mnuOut2.Text = "  [Working... ]  ";

            if (chkAutoRunItemFromMenu.Checked && chkAutoRun.Checked)

            {

                switch (cmbAutoRunItems.SelectedIndex)

                {

                    // Items= Persian Golf: 8   Golestan Park :7   Special Effect:8  total=23

                    case 0:

                        runMenuItem(myMenuItemCollection[myRandom.Next(23)]);

                        break;



                    case 1:

                        runMenuItem(myMenuItemCollection[myRandom.Next(0, 8)]);

                        break;



                    case 2:

                        runMenuItem(myMenuItemCollection[myRandom.Next(8, 15)]);

                        break;



                    case 3:

                        runMenuItem(myMenuItemCollection[myRandom.Next(15, 23)]);

                        break;

                }

            }

            else goRun(false);



            if (chkAutoRefresh.Checked)

            {

                myObjectsOrientation = 2; //  invers

                for (int jj = 0; jj < updRefreshTimes.Value; jj++)

                {

                    if (jj > 0) myObjectsOrientation = 3; // random



                    mnuOut2.Text = " Refresh " + (jj + 1) + " of " + updRefreshTimes.Value + "  Orient=" + myObjectsOrientation;

                    Application.DoEvents();

                    goRun(true);

                    Application.DoEvents();

                }



            }

            mnuOut2.Text = "";

        }





        private void chkAutoRun_CheckedChanged(object sender, EventArgs e)

        {

            mnuTimerNextIcon.Enabled = chkAutoRun.Checked;

            chkAutoRunItemFromMenu.Enabled = chkAutoRun.Checked; ;

            if (!chkAutoRunItemFromMenu.Enabled) cmbAutoRunItems.Enabled = false;

            chkAutoRun.ForeColor = chkAutoRun.Checked ? Color.Red : Color.FromKnownColor(KnownColor.ControlText);

            tmrNext.Enabled = chkAutoRun.Checked;



        }



        private void updTimerNext_ValueChanged(object sender, EventArgs e)

        {

            tmrNext.Interval = (int)updTimerNext.Value * 1000;



        }



        #endregion





        #region miscellaneous



        private void mnuAbout_Click(object sender, EventArgs e)

        {

            bool tmrStatus = tmrNext.Enabled;

            tmrNext.Enabled = false;

            frmAbout myAbout = new frmAbout();

            myAbout.ShowDialog();

            tmrNext.Enabled = tmrStatus;

        }







        private void mnuExit_Click(object sender, EventArgs e)

        {

            this.Close();

        }





        private void frmMain_LocationChanged(object sender, EventArgs e)

        {

            foreach (frmObject mySnow in mySnowCollection) mySnow.MyBasePosition = this.Location;

        }



        private void mnuStop_Click(object sender, EventArgs e)

        {

            if (isFullScreen) setFullScreen(false);



            if (pnlTop.Visible) setPanels(true);

            else setPanels(false);

            mnuFile.Select();

        }





        private void setPanels(bool myStatus)

        {

            pnlTop.Visible = !myStatus;

            mnuShowControls.Visible = myStatus;

            mnuHideControls.Visible = !myStatus;

            if (mnuShowSnow.Checked)

                foreach (frmObject mySnow in mySnowCollection) mySnow.tmrMain.Enabled = myStatus;

        }





        private void trbGeneral_Scroll(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, myTrb.Value.ToString());

        }



        private void trbObjectDepth_Scroll(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, "Overgrowth Distribution = " + myTrb.Value.ToString());



        }







        private void trbObjectSize_Scroll(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, "Size = " + myTrb.Value.ToString());



        }







        private void trbDeptStart_ValueChanged(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, "Starting Depth = " + myTrb.Value + " %");



        }



        private void trbDepthMinimum_ValueChanged(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, "Minimum Depth Growth = " + myTrb.Value + " %");



        }



        private void trbDepthNoise_ValueChanged(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, "Noise for Growth = " + myTrb.Value + " ");



        }



        private void showAnaglyphToolStripMenuItem_SelectedIndexChanged(object sender, EventArgs e)

        {

            int myItem = ((ToolStripComboBox)sender).SelectedIndex;



            showResult(myItem);

        }







        private void cmbGeneralEffectTop_SelectedIndexChanged(object sender, EventArgs e)

        {

            cmbGeneralEffect.SelectedIndex = cmbGeneralEffectTop.SelectedIndex;

            //if (!pnlTop.Visible) goRun(true);

        }



        private void frmMain_Load(object sender, EventArgs e)

        {

            borderTop = this.Height - pnlBase.Height;

            borderLeft = (this.Width - pnlBase.Width) / 2;



            goRun(false);

        }



        private void cmbGeneralEffect_SelectedIndexChanged(object sender, EventArgs e)

        {

            cmbGeneralEffectTop.Text = cmbGeneralEffect.Text;

        }



        private void mnuAutoSave_CheckedChanged(object sender, EventArgs e)

        {

            mnuAutoSaveIcon.Enabled = mnuAutoSave.Checked;

            chkAutoSave.Checked = mnuAutoSave.Checked;



        }



        private void mnuHideControls_Click(object sender, EventArgs e)

        {

            setPanels(true);

        }



        private void mnuSite_Click(object sender, EventArgs e)

        {



            switch (((ToolStripMenuItem)sender).Name)

            {

                case "mnuSiteToorang":

                    System.Diagnostics.Process.Start("www.toorang.com");

                    break;

                case "mnuSiteNoojum":

                    System.Diagnostics.Process.Start("www.noojum.com");

                    break;

                case "mnuSiteFacebook":

                    System.Diagnostics.Process.Start("https://www.facebook.com/anaglyph2500");

                    break;

                case "mnuSiteCodeproject":

                    System.Diagnostics.Process.Start("http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=3393649");

                    break;

            }





        }



        private void chkAutoRunItemFromMenu_EnabledChanged(object sender, EventArgs e)

        {

            cmbAutoRunItems.Enabled = chkAutoRunItemFromMenu.Checked;



        }



        private void chkAutoSave_CheckedChanged(object sender, EventArgs e)

        {

            mnuAutoSave.Checked = chkAutoSave.Checked;

        }



        private void chkAutoRefresh_CheckedChanged(object sender, EventArgs e)

        {

            updRefreshTimes.Enabled = chkAutoRefresh.Checked;

        }



        private void trbZoom_MouseEnter(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, "Zoom Level = " + myTrb.Value + "");



        }



        private void trbInitial_MouseEnter(object sender, EventArgs e)

        {

            TrackBar myTrb = (TrackBar)sender;

            toolTip1.SetToolTip(myTrb, "Initial Size = " + myTrb.Value + " %");





        }



        private void saveImageFormatToolStripMenuItem_Click(object sender, EventArgs e)

        {

            switch (((ToolStripMenuItem)sender).Tag.ToString())

            {

                case "jpg":

                    MyDefaultImageFormat = 0;

                    mnuSaveJPGFormat.Checked = true;

                    mnuSavePNGFormat.Checked = false;

                    mnuSaveFast.Text = " Save (jpg) ";

                    break;

                case "png":

                    MyDefaultImageFormat = 1;

                    mnuSavePNGFormat.Checked = true;

                    mnuSaveJPGFormat.Checked = false;

                    mnuSaveFast.Text = " Save (png) ";

                    break;

                //case "bmp":

                //    MyDefaultImageFormat = 2;

                //    break;

            }

            mnuSaveFast.Enabled = true;

        }



        private void mnuFullScreen_Click(object sender, EventArgs e)

        {

            setFullScreen(true);



        }



        private void setFullScreen(bool myStatus)

        {

            this.mainMenu.Visible = !myStatus;

            this.FormBorderStyle = myStatus ? FormBorderStyle.None : FormBorderStyle.Sizable;

            this.TopMost = myStatus;

            if (myStatus) this.WindowState = FormWindowState.Maximized;



            isFullScreen = myStatus;

        }



        private void mnuEdit_Click(object sender, EventArgs e)

        {

            frmEdit myEdit = new frmEdit();



            myEdit.picsAll = picsAll;

            myEdit.myFirstPicCollection.Clear();

            foreach (picCollection myP in myAllPicCollection) myEdit.myFirstPicCollection.Add(myP);

            myEdit.myFirstImage = new Bitmap(leftBitmap);

            myEdit.ShowDialog();

            if (myEdit.OK)

            {

                myAllPicCollection.Clear();

                foreach (picCollection myP in myEdit.myNewPicCollection) myAllPicCollection.Add(myP);

                myEdit.Dispose();

                myObjectsOrientation = 0;

                goRun(true);

            }

            else myEdit.Dispose();



        }



        private void mainMenu_VisibleChanged(object sender, EventArgs e)

        {

            foreach (frmObject mySnow in mySnowCollection) mySnow.isFullScreen = !mainMenu.Visible;



        }



        private void mnuAutoSaveIcon_Click(object sender, EventArgs e)

        {

            mnuAutoSave.Checked = false;

        }



        private void mnuTimerNextIcon_Click(object sender, EventArgs e)

        {

            chkAutoRun.Checked = false;

        }



        private void mnuSnowActive_Click(object sender, EventArgs e)

        {

            mnuShowSnow.Checked = false;

        }



        private void mnuShowSnow_CheckedChanged(object sender, EventArgs e)

        {

            mnuSnowActive.Enabled = mnuShowSnow.Checked;



            if (!mnuShowSnow.Checked)

                foreach (frmObject mySnow in mySnowCollection) mySnow.Hide();



        }



        private void chkFullScreen_CheckedChanged(object sender, EventArgs e)

        {

            mnuFullScreenActive.Enabled = chkFullScreen.Checked;

            mnuFullScreen.Checked = chkFullScreen.Checked;

        }



        private void mnuFullScreenActive_Click(object sender, EventArgs e)

        {

            chkFullScreen.Checked = false;

        }



        private void mnuFullScreen_Click_1(object sender, EventArgs e)

        {

            chkFullScreen.Checked = mnuFullScreen.Checked;

        }





        #endregion





    }





}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO
Iran (Islamic Republic of) Iran (Islamic Republic of)

Comments and Discussions