Author: Stefaan Casier
Author’s WebSite: http://home.planetinternet.be/~scasier
This excellent example from Stefaan Casier shows the basics of creating a professional paint program and how to implement many of the features that users expect for granted. Be sure to study this code well and learn from it.
Standard Screen :
Zoomed Image :
10/07/99 – translated 18/03/2000
The program has to be run in a 256 colors-screen modus state, since it concentrates on making bitmaps with a 256 colors pallet, containing gradient or fluent colors. Besides using fluent colors, the program also has a feature adding shade to all drawings. The fact, to apply fluent colors and shade is made so easy, makes this program special. It is at least a good addition to other painting programs.
Most functions work in such an obvious way, they need no explanation. So I provide you here with those things that are not so obvious.
Absolute maximum = 1024 x 1024 pixels.
Each scale- or zoom factor has it’s own maximum (XY):
x1 1024 – maybe higher with more RAM? (here 48M)
This a mathematic maximum that would produce an Overflow if passed over (prevented by the program). If you have less available RAM memory on your PC, those maximum values will be lower. Then you’ll have to judge it yourself. The moment Windows virtual memory (hard disc) is addressed, everything slows down, sometimes to a point it isn’t workable anymore. What you learn from this: it is a program more for making smaller pictures than opposite.
– get to know the program using a small size like 100*100
– without using the grid, everything works faster
THE COLOR PALLET
You change or set it, F I R S T , because it alters the existing pallet/content.
There are some different ways to set a new pallet:
- Make or load a Paint256 pallet (*.BKL). Using max. 16 base colors, 240 fluent colors are generated. The pallet is completed with 16 Quick Basic Colors.
- Load a JASC-PAL pallet (*.PAL) : originates from Paint Shop Pro (and others?).
- Extract a pallet from an existing bitmap (*.BMP), so you can edit a bitmap with its own pallet (only necessary when the picture uses more than 16 or 20 colors (see pictures).
One of the powers of Paint256 is working with fluent colors. When they are unavailable, a number of functions become useless.
THE UPPER TOOLBAR
Many functions react differently depending on whether selection-modus is on or not. If the selection-modus is on, most functions will act on the current delimited selection, otherwise it will be on the whole image. This is the case with: Save, Copy, Pallet-Rotation, Move, Mirror, Delete, Replace (click the mouse with the mouse – nice no?) … Open en Paste have something similar.
Moving over a button with the mouse causes a tip to popup, with the button’s name or description.
KEYS (in main-window)
S Shades dialog
V Fill modes dialog
space Repeat previous action (<> filling)
shift+ M Pattern-Mask (to use with small sizes – testing)
K Show real size image
- Selection box
- Normal Enlarge
- +shift Smaller
- +control Move
You can move, copy/paste a selection with the mouse combined with the shift- or control-keys. Without any key, you only move the rubber box.
Clicking in the image combined with the Alt-key, will change the current (left/right) mouse color into the color under the mouse pointer.
You select the background-color in the pallet, holding the Alt-key down.
This is a browser looking for bitmaps on disk. You can check the saved results. Delete doubles… You can copy bitmaps to the clipboard to paste them later…
If you want to mix different bmp’s you will have to check their pallet for compatibility. In most cases the pallets have to be identical.
– Always load & select the pallet of a bmp-file, before you paste the bmp itself.
FUNCTIONS 10 in a row, from top to bottom:
- Rectangle-ellipse *
- Filled rectangle-ellipse *
- Filling (doesn’t work on black surfaces !)
- Formula *
- Text *
- Shade Frames *
- Arrows *
* = click them with the right mouse button to set their parameters by means of a dialog.
In most cases you can repeat the last action with new left/right color settings. You can Undo before, or not. This way you can try things out until you find the best setting.
STYLE (three buttons bottom-right side of the pallet)
- Pen Width
—-> do experiment, you will see, it’s easy
A multi-line text you can align (left/right/center). A single line of text you can tilt or turn over. To place it in your image you can think of it as a stamp. Click in the image, without releasing the mouse button. A ‘rubber box’ you can move around, will appear showing the size of the stamp. The stamp is made the moment you release the mouse button.
A condition to use this is of course there has to be a pallet with gradient fluent colors. Pallets extracted from a bitmap, will probably not have such a pallet…
Select in the pallet on the left, the Start color with the left mouse button and the End color with the right mouse button. Then you choose in the Fill-modus dialog, the preferred color pattern. Each following drawing action will use these selected settings and produce fluent colors.
Download Zipped Source Code (97k)