Smooth 2D Noise Viewer
Perlin and Value Noise
|
Code for some helpful Windows-specific functions. More...
Go to the source code of this file.
Functions | |
ULONG_PTR | InitGDIPlus () |
Initialize GDI+. More... | |
HRESULT | GetEncoderClsid (const WCHAR *format, CLSID *pClsid) |
HRESULT | SaveBitmap (HWND hwnd, const std::wstring &wstrName, Gdiplus::Bitmap *pBitmap) |
Save bitmap to file. More... | |
HMENU | CreateFileMenu (HMENU hMenubar) |
Create File menu. More... | |
HMENU | CreateGenerateMenu (HMENU hMenubar) |
Create Generate menu. More... | |
HMENU | CreateViewMenu (HMENU hMenubar) |
Create View menu. More... | |
HMENU | CreateDistributionMenu (HMENU hMenubar) |
Create Distribution menu. More... | |
HMENU | CreateHashMenu (HMENU hMenubar) |
Create Hash menu. More... | |
HMENU | CreateSplineMenu (HMENU hMenubar) |
Create Spline menu. More... | |
HMENU | CreateSettingsMenu (HMENU hMenubar) |
Create Settings menu. More... | |
void | CreateHelpMenu (HMENU hMenubar) |
Create Help menu. More... | |
void | UpdateFileMenu (HMENU hMenu, eNoise noise) |
Update File menu. More... | |
void | UpdateGenerateMenu (HMENU hMenu, eNoise noise) |
Update Generate menu. More... | |
void | UpdateViewMenu (HMENU hMenu, eNoise noise) |
Update View menu. More... | |
void | UpdateMenuItemGray (HMENU hMenu, UINT item, eNoise noise, bool bGray) |
Update menu item bool. More... | |
void | UpdateMenuItemCheck (HMENU hMenu, UINT item, bool bCheck) |
Update menu item check. More... | |
void | UpdateDistributionMenu (HMENU hMenu, eNoise noise, eDistribution distr) |
Update Distribution menu. More... | |
void | UpdateHashMenu (HMENU hMenu, eNoise noise, eHash h) |
Update Hash menu. More... | |
void | UpdateSplineMenu (HMENU hMenu, eNoise noise, eSpline spline) |
Update Spline menu. More... | |
void | UpdateSettingsMenu (HMENU hMenu, eNoise noise) |
Update Settings menu. More... | |
These platform-dependent functions are hidden away so that the faint-of-heart don't have to see them if they can't handle it.
Definition in file WindowsHelpers.cpp.
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.
HRESULT GetEncoderClsid | ( | const WCHAR * | format, |
CLSID * | pClsid | ||
) |
Get an encoder clsid for an image file format.
format | File format using wide characters. |
pClsid | [OUT] Pointer to clsid. |
Definition at line 62 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 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.