Mystique Program

Pretty Graphics Pattern Randomizer

C# .Net 3.5 (Windows 7)
Windows Forms Application
with source code

Version 1.0 Released 2015-01-04

/Home /Professional /Papers /Mystique

Description Revised 2015-01-09

In this description you may find items marked in GREEN that are recent changes. You may also find items marked in OLIVE that are not in the current version but are planned for a later version. You may also find items marked in RED that only apply to the current version and will be changed in a later version.

Download Program and source

Mystique.zip


Contents

Introduction

Mystique is a simple graphics pattern randomizer to create pretty patterns. I wrote the original simple program in 8080 assembly language about 1982 to develop my graphics programming skills using an MS-DOS based Heathkit Model H100. Others have written similar programs. I later rewrote the program in C and later for Windows expanding my graphics programming skills and expanding its function. It is a testimony to Microsft Windows skill in maintaining compatibility that my 20? year old C program still runs in Windows 7. I rewrote it in C# to continue adapting and expanding my graphics programming skills. It is a fun little entertaining program.

The patterns generated are based on the moiré pattern. Wikipedia says "In mathematics, physics, and art, a moiré pattern is a secondary and visually evident superimposed pattern created, for example, when two identical (usually transparent) patterns on a flat or curved surface (such as closely spaced straight lines drawn radiating from a point or taking the form of a grid) are overlaid while displaced or rotated a small amount from one another."

The Mystique pattern builds on the aliasing of pixellation in digital displays and mathematical effects created by drawing a series of XOR lines varying the endpoints by a small amount for each line. After a maximum number of lines is drawn, the oldest line will be erased by drawing a second XOR on the old line each time a new line is drawn. The program provides several techniques to vary the patterns.

A Mouse Click will toggle a stop in the pattern drawing. A Mouse Right-Click will remove the Window Title, the border, and menu. A second Right-Click will restore the Window Title, the border, and menu. When the menu is removed you cannot change any options with a menu shortcut key.

Installing the Program

An important feature of this program is that it does not require a blind install program or administrator permission. I am using the term "blind" to refer to the fact that the extent of the changes made by the typical install program are completely hidden from you. I don't like things that are hidden. The paranoid hacker knows just what I mean.

The Mystique program is completely stand-alone so a simple copy is the minimum needed to permanently "install" and use the program. You can carry it on a USB flash drive and use anywhere with Windows 7 or later. You can use it temporarily, anywhere, and immediately with no install, no permissions, and no problems directly from the USB flash drive.

At this point I should mention that the Mystique program uses standard .NET persistent settings. The persistent settings are things like Window Position. These settings are stored in a file named user.config, which is kept in a directory with a name similar to "%LOCALAPPDATA% (C:\Users\%USERNAME%\AppData\Local) \Frank_T_Clark_Software\Mystique.exe_Url_*\". These settings are kept in a separate unique directory ("Mystique.exe_Url_*") generated by Windows depending on the Mystique version and where the program is run from.

The permanent Mystique program "installation" location is recommended for a Mystique directory under the Documents directory for an individual operator. This would be a directory named "%USERPROFILE% (C:\Users\%USERNAME%) \Documents\Mystique". Just create the directory and copy the program into place. You could download the Mystique.ZIP file to the Documents folder and extract into this directory. The download provides a documentation/help file, and image file, which can also be placed in this directory. The help file is also available online and may contain later versions with additional updated information.

I do not provide a blind install program because I want you to know for absolute certain exactly what is required to use the program. Uninstall is very simple. Erase the program! Most Setup programs mysteriously make unknown changes to your computer.

Using the Code

I am providing the complete VS2013 C# project zip file with the executable, documentation, and the complete source code for Mystique for those who enjoy software code. You might be interested in adding your own special functionality. I have also included the most recent source I could find of the old C source code and a version of the old Win32 API C program compiled about 2006.

I hope you find the source code instructive for picking up some ideas. I have learned a lot by examining the code of others. I hope examining my code will be useful to you.

I provide the complete source so you can know for certain exactly what the Mystique program does. Compile it for yourself, if you want. Examining the code is not easy, unless you are already a C# programmer, but it is available, if it is a concern to you. By these methods, you can trust the software. There is so much out there that is not trustworthy. You don't have to trust me. Full disclosure is the best trust there is.

The Mystique program is a C# Windows Forms application compiled in VS2013 Express with the .NET framework version 3.5, which is included automatically with the Windows 7 OS. The program requires nothing but the supplied source and standard Windows functionality with VS2013 Express. There are no third-party libraries used. There is no separate DLL required or used. The program has only been well used and thoroughly tested with the Windows 7 OS.

I am having difficulty implementing the XOR line drawing function in C#. The simplest solution is ControlPaint DrawReversibleLine function but it is difficult to keep within the limits of the window under unusual conditions. An alternative is to attempt to use the SetROP2(hDC, R2_XORPEN) function of the Win32 API, which I used previously. Howver, this will require [System. Runtime. InteropServices. DllImportAttribute ("gdi32.dll")] that I prefer not to use, when I can avoid it. Another alternative is to use a bitmap, which will also be complex and awkward.

Release Notes

A history of changes to the Mystique program.
  • Version 2.0 Not Yet Released
    • Continuing to add drawing control features.
  • Version 1.0 Released 2015-01-04
    • Made sure color changes had a higher contrast.
    • Made sure deltas covered more of the screen.
  • Version 0.3 Released 2015-01-01
    • Box wipe is implemented.
    • Improved the ability to prevent problems with the ControlPaint DrawReversibleLine drawing outside of the window such as on overlapping windows.
  • Version 0.2 Released 2014-12-30
    • All Mirror options are implemented.
  • Version 0.1 Released 2014-12-29
    • Initial Release.

Known errors to be fixed:
  • I need to correct problems with the ControlPaint DrawReversibleLine function drawing outside of the window such as on overlapping windows or a hidden Start menu.
  • There may be other problems or errors that I don't have a clear understanding or description of yet.

Future changes being considered:
  • There are additional drawing pattern features I could implement.

Mystique Keyboard Shortcuts

This is an alphabetical list of the Mystique function keys and keyboard shortcuts. When the menu is removed during Max Screen, the menu shortcut keys are disabled.
Alt-F4 (System shortcut)
File, Exit
Ctrl-1 through 9
Speed,
Ctrl-A
View, Auto Pattern
Ctrl-B
Wipe, Box
Ctrl-C
View, Cycle Color
Ctrl-E
Mirror, Eight
Ctrl-F
Mirror, Four
Ctrl-I
View, Initialize
Ctrl-M
View, Max Screen
Ctrl-N
Wipe, None
Ctrl-O
Mirror, One
Ctrl-P
View, Pause
Ctrl-S
View, Stop
Ctrl-T
Mirror, Two
Ctrl-V
Mirror, Variable
Ctrl-F1
Help, Online Contents
F1
Help, Local Contents

Main Menu Functions

The Main Menu contains the menu groupings for all the functions performed by the Mystique program.

File Menu

The file menu contains the typical function for exiting the program. I am planning to add the ability to read configuration commands from a script file to control the display.

Exit (Alt-F4)

Exit the program. This is the only shortcut that works with Max Screen because it is a system shortcut and not a menu shortcut.

View Menu

This menu allows you to control various functions of the pattern display. The term "cycle time" is used several times in this description. A cycle is the number of lines drawn on the display before the oldest line is erased. The cycle time is when two cycles of display and erase are completed and changes are made in the drawing pattern.

Initialize (Ctrl-I)

Initialize a new screen with a new randomized drawing pattern. The screen will immediately fill with a new color background and a new color pattern that will begin varying according to the current configuration. Any time the window is moved, sized or otherwise changed an initialize will be triggered.

Auto Pattern (Ctrl-A)

Automatically vary the delta for the endpoints to vary the pattern at the cycle time. This is a configuration setting that will be remembered for the next time the program is started.

Cycle Color (Ctrl-C)

Automatically cycle the drawing color to a new random value at the cycle time. This is a configuration setting that will be remembered for the next time the program is started.

Pause (Ctrl-P)

Toggle an automatic pause of the drawing at the cycle time. When paused, the drawing will resume to the next cycle time with a Mouse Click.

Max Screen (Ctrl-M)

Toggle a maximum screen display of the drawing. The maximum is also toggled with a Mouse Right-Click. A maximum screen display does not mean maximize but remove the Window Title, the border, and menu. This function is most effective with a maximize. When the menu is removed you cannot change any options with a menu shortcut key. A Mouse Right-Click is the only way to end Max Screen unless you exit the program.

Stop (Ctrl-S)

Toggle a stop of the drawing. The drawing is also toggled with a Mouse Click.

Speed Menu

The Speed Menu contains 10 options for changing the speed of the pattern drawing from 1 (Ctrl-1) Slowest to 9 (Ctrl-9) Fastest. The fastest setting is designed to be moderate rather than blindingly fast. This is a configuration setting that will be remembered for the next time the program is started.

Mirror Menu

The Mirror Menu contains options for controlling the number of mirror images to draw of each line in the pattern. This is a configuration setting that will be remembered for the next time the program is started.

Variable (Ctrl-V)

This option will randomly change the mirror option at the cycle time.

One (Ctrl-O)

This option selects a single line to be drawn.

Two (Ctrl-T)

This option selects two lines to be drawn. One is a miror image of the other.

Four (Ctrl-F)

This option selects four lines to be drawn in mirror images.

Eight (Ctrl-E)

This option selects eight lines to be drawn in mirror images.

Wipe Menu

The Wipe Menu contains options for changing the direction and style of a continuous wipe of the drawing area. The color change is randomly selected. This is a configuration setting that will be remembered for the next time the program is started.

None (Ctrl-N)

This option will not do any wipe of the drawing area.

Box

This option will do a box wipe from the outside to the inside of the drawing area.

Help Menu

The Help Menu contains options for viewing help and program information.

Online Contents

This option will open the web site "http://www.FrankTClark.us/Professional/Papers/Mystique/Mystique.html" which contains the online version of the documentation for the current version of the program. This may not match the version you are using. The website is often updated with additional documentation and versions.

This web page may be saved to the "Mystique.html" file in the directory with the program. This updates the Local Contents. Links from the page may fail unless additional pages and images are copied to the directory from the website.

Local Contents

This option will open the local web file "Mystique.html" which contains the local version of the documentation for the program. The file is expected to be in the same directory as the program file. Links from the page may fail unless additional pages and images are copied to the directory from the website.

This is useful for when you are not connected to the Internet. This help file and the minimum graphic file are included in the download zip file.

About

This option displays the program version number and other information.