![]() |
Lindenmayer System
A Simple L-system Image Generator Featuring Turtle Graphics
|
Interface for some helpful Windows-specific functions. More...
#include "Includes.h"Go to the source code of this file.
Macros | |
| #define | IDM_FILE_GENERATE 1 |
| Menu id for Save. | |
| #define | IDM_FILE_SAVE 2 |
| Menu id for Save. | |
| #define | IDM_FILE_QUIT 3 |
| Menu id for Quit. | |
| #define | IDM_LSYS_BRANCHING 4 |
| Menu id for branching structure. | |
| #define | IDM_LSYS_PLANT_A 5 |
| Menu id for Fig. 1.24a. | |
| #define | IDM_LSYS_PLANT_B 6 |
| Menu id for Fig. 1.24b. | |
| #define | IDM_LSYS_PLANT_C 7 |
| Menu id for Fig. 1.24c. | |
| #define | IDM_LSYS_PLANT_D 8 |
| Menu id for Fig. 1.24d. | |
| #define | IDM_LSYS_PLANT_E 9 |
| Menu id for Fig. 1.24e. | |
| #define | IDM_LSYS_PLANT_F 10 |
| Menu id for Fig. 1.24f. | |
| #define | IDM_LSYS_HEXGOSPER 11 |
| Menu id for hexagonal Gosper curve. | |
| #define | IDM_VIEW_RULES 12 |
| Menu id for showing rules. | |
| #define | IDM_VIEW_THICKLINES 13 |
| Menu id for thick lines. | |
Functions | |
| void | InitWindow (HINSTANCE, INT, WNDPROC) |
| Initialize window. More... | |
| ULONG_PTR | InitGDIPlus () |
| Initialize GDI+. More... | |
| void | AddPointToRect (RECT &, Gdiplus::PointF) |
| Add point to rectangle. More... | |
| Gdiplus::RectF | GetClientRectF (HWND) |
| Get client rectangle as a RectF. More... | |
| void | MinDragRect (HWND, WPARAM, RECT *, int) |
| Enforce minimum drag rectangle. More... | |
| HRESULT | SaveBitmap (HWND, Gdiplus::Bitmap *) |
| Save bitmap to file. 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.
| void AddPointToRect | ( | RECT & | r, |
| Gdiplus::PointF | point | ||
| ) |
Add a point to a rectangle, that is, extend the rectangle to enclose the point. Note that the rectangle has integer coefficients whereas the point has floating-point coefficients, and therefore we must apply floor and ceil judiciously.
| r | [IN, OUT] Reference to a RECT structure. |
| point | A point. |
Definition at line 110 of file WindowsHelpers.cpp.
| Gdiplus::RectF GetClientRectF | ( | HWND | hwnd | ) |
Get client rectangle in Gdiplus::RectF format.
| hwnd | Window handle. |
Definition at line 122 of file WindowsHelpers.cpp.
| ULONG_PTR InitGDIPlus | ( | ) |
Initialize GDI+ and get a GDI+ token.
Definition at line 89 of file WindowsHelpers.cpp.
| void InitWindow | ( | HINSTANCE | hInst, |
| INT | nShow, | ||
| WNDPROC | WndProc | ||
| ) |
Create and initialize a window.
| hInst | Instance handle. |
| nShow | 1 to show window, 0 to hide. |
| WndProc | Window procedure. |
Definition at line 47 of file WindowsHelpers.cpp.
| void MinDragRect | ( | HWND | hwnd, |
| WPARAM | wParam, | ||
| RECT * | pRect, | ||
| int | n | ||
| ) |
Resize the drag rectangle provided by a WM_SIZING message to ensure a minimum client area width and height.
| hwnd | Window handle. |
| wParam | WMSZ message telling us which edge is being dragged on. |
| pRect | [IN, OUT] Pointer to drag rectangle. |
| n | Minimum width and height of client area. |
Definition at line 137 of file WindowsHelpers.cpp.
| HRESULT SaveBitmap | ( | HWND | hwnd, |
| 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. |
| pBitmap | Pointer to a bitmap. |
Definition at line 241 of file WindowsHelpers.cpp.
1.8.14