Smooth 2D Noise Viewer
Perlin and Value Noise
|
Interface for some helpful Windows-specific functions. More...
Go to the source code of this file.
Macros | |
#define | IDM_FILE_SAVE 1 |
Menu id for Save. More... | |
#define | IDM_FILE_PROPS 2 |
Menu id for Properties. More... | |
#define | IDM_FILE_QUIT 3 |
Menu id for Quit. More... | |
#define | IDM_GENERATE_PERLINNOISE 4 |
Menu id for Perlin Noise. More... | |
#define | IDM_GENERATE_VALUENOISE 5 |
Menu id for Value Noise. More... | |
#define | IDM_GENERATE_RANDOMIZE 6 |
Menu id for regenerate Noise. More... | |
#define | IDM_GENERATE_JUMP 7 |
Menu id for jump. More... | |
#define | IDM_GENERATE_RESETORIGIN 8 |
Menu id for reset origin. More... | |
#define | IDM_VIEW_COORDS 9 |
Menu id for view coordinates. More... | |
#define | IDM_VIEW_GRID 10 |
Menu id for view grid. More... | |
#define | IDM_DISTRIBUTION_UNIFORM 11 |
Menu id for uniform distribution. More... | |
#define | IDM_DISTRIBUTION_COSINE 12 |
Menu id for cosine distribution. More... | |
#define | IDM_DISTRIBUTION_NORMAL 13 |
Menu id for normal distribution. More... | |
#define | IDM_DISTRIBUTION_EXPONENTIAL 14 |
Menu id for exponential distribution. More... | |
#define | IDM_DISTRIBUTION_MIDPOINT 15 |
Menu id for midpoint displacement. More... | |
#define | IDM_DISTRIBUTION_MAXIMAL 16 |
Menu id for midpoint displacement. More... | |
#define | IDM_HASH_PERM 17 |
Menu id for permutation hash. More... | |
#define | IDM_HASH_LCON 18 |
Menu id for linear congruential hash. More... | |
#define | IDM_HASH_STD 19 |
Menu id for std::hash. More... | |
#define | IDM_SPLINE_NONE 20 |
Menu id for cubic spline. More... | |
#define | IDM_SPLINE_CUBIC 21 |
Menu id for no spline. More... | |
#define | IDM_SPLINE_QUINTIC 22 |
Menu id for quintic spline. More... | |
#define | IDM_SETTINGS_OCTAVE_UP 23 |
Menu id for octave up. More... | |
#define | IDM_SETTINGS_OCTAVE_DN 24 |
Menu id for octave down. More... | |
#define | IDM_SETTINGS_SCALE_UP 25 |
Menu id for scale up. More... | |
#define | IDM_SETTINGS_SCALE_DN 26 |
Menu id for scale down. More... | |
#define | IDM_SETTINGS_TSIZE_UP 27 |
Menu id for table size up. More... | |
#define | IDM_SETTINGS_TSIZE_DN 28 |
Menu id for table size down. More... | |
#define | IDM_SETTINGS_RESET 29 |
Menu id for reset settings. More... | |
#define | IDM_HELP_HELP 30 |
Menu id for display help. More... | |
#define | IDM_HELP_ABOUT 31 |
Menu id for display About info. More... | |
Functions | |
ULONG_PTR | InitGDIPlus () |
Initialize GDI+. More... | |
HRESULT | SaveBitmap (HWND, const std::wstring &, Gdiplus::Bitmap *) |
Save bitmap to file. More... | |
HMENU | CreateFileMenu (HMENU) |
Create File menu. More... | |
HMENU | CreateGenerateMenu (HMENU) |
Create Generate menu. More... | |
HMENU | CreateViewMenu (HMENU) |
Create View menu. More... | |
HMENU | CreateDistributionMenu (HMENU) |
Create Distribution menu. More... | |
HMENU | CreateHashMenu (HMENU) |
Create Hash menu. More... | |
HMENU | CreateSplineMenu (HMENU) |
Create Spline menu. More... | |
HMENU | CreateSettingsMenu (HMENU) |
Create Settings menu. More... | |
void | CreateHelpMenu (HMENU) |
Create Help menu. More... | |
void | UpdateMenuItemGray (HMENU, UINT, eNoise, bool) |
Update menu item bool. More... | |
void | UpdateMenuItemCheck (HMENU, UINT, bool) |
Update menu item check. More... | |
void | UpdateFileMenu (HMENU, eNoise) |
Update File menu. More... | |
void | UpdateGenerateMenu (HMENU, eNoise) |
Update Generate menu. More... | |
void | UpdateViewMenu (HMENU, eNoise) |
Update View menu. More... | |
void | UpdateDistributionMenu (HMENU, eNoise, eDistribution) |
Update Distribution menu. More... | |
void | UpdateHashMenu (HMENU, eNoise, eHash) |
Update Hash menu. More... | |
void | UpdateSplineMenu (HMENU, eNoise, eSpline) |
Update Spline menu. More... | |
void | UpdateSettingsMenu (HMENU, eNoise) |
Update Settings menu. More... | |
template<typename t > | |
void | UpdateMenuItem (HMENU hMenu, UINT up, UINT dn, eNoise noise, t n, t nMin, t nMax) |
Update a numeric menu item. More... | |
These platform-dependent functions are hidden away so that the faint-of-heart don't have to see them if they're offended by them.
Definition in file WindowsHelpers.h.
#define IDM_DISTRIBUTION_COSINE 12 |
Definition at line 54 of file WindowsHelpers.h.
#define IDM_DISTRIBUTION_EXPONENTIAL 14 |
Definition at line 56 of file WindowsHelpers.h.
#define IDM_DISTRIBUTION_MAXIMAL 16 |
Definition at line 58 of file WindowsHelpers.h.
#define IDM_DISTRIBUTION_MIDPOINT 15 |
Definition at line 57 of file WindowsHelpers.h.
#define IDM_DISTRIBUTION_NORMAL 13 |
Definition at line 55 of file WindowsHelpers.h.
#define IDM_DISTRIBUTION_UNIFORM 11 |
Definition at line 53 of file WindowsHelpers.h.
#define IDM_FILE_PROPS 2 |
Definition at line 41 of file WindowsHelpers.h.
#define IDM_FILE_QUIT 3 |
Definition at line 42 of file WindowsHelpers.h.
#define IDM_FILE_SAVE 1 |
Definition at line 40 of file WindowsHelpers.h.
#define IDM_GENERATE_JUMP 7 |
Definition at line 47 of file WindowsHelpers.h.
#define IDM_GENERATE_PERLINNOISE 4 |
Definition at line 44 of file WindowsHelpers.h.
#define IDM_GENERATE_RANDOMIZE 6 |
Definition at line 46 of file WindowsHelpers.h.
#define IDM_GENERATE_RESETORIGIN 8 |
Definition at line 48 of file WindowsHelpers.h.
#define IDM_GENERATE_VALUENOISE 5 |
Definition at line 45 of file WindowsHelpers.h.
#define IDM_HASH_LCON 18 |
Definition at line 61 of file WindowsHelpers.h.
#define IDM_HASH_PERM 17 |
Definition at line 60 of file WindowsHelpers.h.
#define IDM_HASH_STD 19 |
Definition at line 62 of file WindowsHelpers.h.
#define IDM_HELP_ABOUT 31 |
Definition at line 77 of file WindowsHelpers.h.
#define IDM_HELP_HELP 30 |
Definition at line 76 of file WindowsHelpers.h.
#define IDM_SETTINGS_OCTAVE_DN 24 |
Definition at line 69 of file WindowsHelpers.h.
#define IDM_SETTINGS_OCTAVE_UP 23 |
Definition at line 68 of file WindowsHelpers.h.
#define IDM_SETTINGS_RESET 29 |
Definition at line 74 of file WindowsHelpers.h.
#define IDM_SETTINGS_SCALE_DN 26 |
Definition at line 71 of file WindowsHelpers.h.
#define IDM_SETTINGS_SCALE_UP 25 |
Definition at line 70 of file WindowsHelpers.h.
#define IDM_SETTINGS_TSIZE_DN 28 |
Definition at line 73 of file WindowsHelpers.h.
#define IDM_SETTINGS_TSIZE_UP 27 |
Definition at line 72 of file WindowsHelpers.h.
#define IDM_SPLINE_CUBIC 21 |
Definition at line 65 of file WindowsHelpers.h.
#define IDM_SPLINE_NONE 20 |
Definition at line 64 of file WindowsHelpers.h.
#define IDM_SPLINE_QUINTIC 22 |
Definition at line 66 of file WindowsHelpers.h.
#define IDM_VIEW_COORDS 9 |
Definition at line 50 of file WindowsHelpers.h.
#define IDM_VIEW_GRID 10 |
Definition at line 51 of file WindowsHelpers.h.
HMENU CreateDistributionMenu | ( | HMENU | hMenubar | ) |
Create the Distribution
menu.
hMenubar | Handle to menu bar. |
Distribution
menu. Definition at line 192 of file WindowsHelpers.cpp.
HMENU CreateFileMenu | ( | HMENU | hMenubar | ) |
Create the File
menu.
hMenubar | Handle to menu bar. |
File
menu. Definition at line 144 of file WindowsHelpers.cpp.
HMENU CreateGenerateMenu | ( | HMENU | hMenubar | ) |
Create the Generate
menu.
hMenubar | Handle to menu bar. |
Generate
menu. Definition at line 159 of file WindowsHelpers.cpp.
HMENU CreateHashMenu | ( | HMENU | hMenubar | ) |
Create the Hash
menu.
hMenubar | Handle to menu bar. |
Hash
menu. Definition at line 210 of file WindowsHelpers.cpp.
void CreateHelpMenu | ( | HMENU | hMenubar | ) |
Create the Help
menu.
hMenubar | Handle to menu bar. |
Definition at line 263 of file WindowsHelpers.cpp.
HMENU CreateSettingsMenu | ( | HMENU | hMenubar | ) |
Create the Settings
menu.
hMenubar | Handle to menu bar. |
Settings
menu. Definition at line 240 of file WindowsHelpers.cpp.
HMENU CreateSplineMenu | ( | HMENU | hMenubar | ) |
Create the Spline
menu.
hMenubar | Handle to menu bar. |
Spline
menu. Definition at line 225 of file WindowsHelpers.cpp.
HMENU CreateViewMenu | ( | HMENU | hMenubar | ) |
Create the View
menu.
hMenubar | Handle to menu bar. |
View
menu. Definition at line 178 of file WindowsHelpers.cpp.
ULONG_PTR InitGDIPlus | ( | ) |
Initialize GDI+ and get a GDI+ token.
Definition at line 43 of file WindowsHelpers.cpp.
HRESULT SaveBitmap | ( | HWND | hwnd, |
const std::wstring & | wstrName, | ||
Gdiplus::Bitmap * | pBitmap | ||
) |
Display a Save
dialog box for png files and save a bitmap to the file name that the user selects. Only files with a .png
extension are allowed. The default file name is "ImageN.png", where N is the number of images saved so far in the current instance of this program. This prevents any collisions with files already saved by this instance. If there is a collision with a file from a previous instance, then the user is prompted to overwrite or rename it in the normal fashion.
hwnd | Window handle. |
wstrName | File name without extension. |
pBitmap | Pointer to a bitmap. |
Definition at line 97 of file WindowsHelpers.cpp.
void UpdateDistributionMenu | ( | HMENU | hMenu, |
eNoise | noise, | ||
eDistribution | distr | ||
) |
Gray out and set the checkmarks in the Distribution
menu according to the current noise and distribution types.
hMenu | Menu handle. |
noise | Noise enumerated type. |
distr | Distribution enumerated type. |
Definition at line 356 of file WindowsHelpers.cpp.
void UpdateFileMenu | ( | HMENU | hMenu, |
eNoise | noise | ||
) |
Gray out the Properties
and Save
menu entries in the File
menu if there is no noise present, and ungray them otherwise.
hMenu | Menu handle. |
noise | Noise enumerated type. |
Definition at line 283 of file WindowsHelpers.cpp.
void UpdateGenerateMenu | ( | HMENU | hMenu, |
eNoise | noise | ||
) |
Gray out and set the checkmarks in the Generate
menu according to the current noise properties. Check or uncheck the menu entries for pixel, Perlin, and Value noise depending on the current noise type. Gray out the Randomize
menu entry if there is no noise generated, and ungray it otherwise.
hMenu | Menu handle. |
noise | Noise enumerated type. |
Definition at line 303 of file WindowsHelpers.cpp.
Gray out and set the checkmarks in the Hash
menu according to the current noise and hash function types.
hMenu | Menu handle. |
noise | Noise enumerated type. |
h | Hash function enumerated type. |
Definition at line 395 of file WindowsHelpers.cpp.
void UpdateMenuItem | ( | HMENU | hMenu, |
UINT | up, | ||
UINT | dn, | ||
eNoise | noise, | ||
t | n, | ||
t | nMin, | ||
t | nMax | ||
) |
Update a menu item that has an up and a down, with maximum and minimum values. Gray out the up item if the number is greater than the maximum allowed, and gray out the down item if the number is less than the minimum allowed. Gray out both if the noise type is eNoise::None
.
hMenu | Menu handle. |
up | Up menu item id. |
dn | Down menu item id. |
noise | Noise enumerated type. |
n | A number. |
nMin | Minimum value. |
nMax | Maximum value. |
Definition at line 137 of file WindowsHelpers.h.
void UpdateMenuItemCheck | ( | HMENU | hMenu, |
UINT | item, | ||
bool | bCheck | ||
) |
Update the check mark on a menu item.
hMenu | Menu handle. |
item | Menu item id. |
bCheck | True if entry is to be checked. |
Definition at line 346 of file WindowsHelpers.cpp.
void UpdateMenuItemGray | ( | HMENU | hMenu, |
UINT | item, | ||
eNoise | noise, | ||
bool | bGray | ||
) |
Gray or ungray a menu item depending on noise type and a boolean value.
hMenu | Menu handle. |
item | Menu item id. |
noise | Noise enumerated type. |
bGray | True if entry is to be grayed out. |
Definition at line 336 of file WindowsHelpers.cpp.
void UpdateSettingsMenu | ( | HMENU | hMenu, |
eNoise | noise | ||
) |
Gray out entries in the Settings
menu if they are not appropriate for the current noise type and parameters.
hMenu | Menu handle. |
noise | Noise enumerated type. |
Definition at line 454 of file WindowsHelpers.cpp.
Gray out and set the checkmarks in the Spline
menu according to the current noise and spline types.
hMenu | Menu handle. |
noise | Noise enumerated type. |
spline | Spline enumerated type. |
Definition at line 425 of file WindowsHelpers.cpp.
void UpdateViewMenu | ( | HMENU | hMenu, |
eNoise | noise | ||
) |
Gray out entries in the View
menu according to the current noise properties.
hMenu | Menu handle. |
noise | Noise enumerated type. |
Definition at line 323 of file WindowsHelpers.cpp.