Introduction
So many times we feel need of non rectangular bitmap, bitmap which store only the required
portion of the picture leaving outside area. You just do it by defining the desired area and call
a function to store the picture inside the selected area. Then just by calling another function
to make a bitmap of stored pixels and use it anywhere. The pixels outside the selected area
in bitmap will not be visible in bitmap because it uses alpha value 0.
Detail
This application provides the capability to user to transform rectangular bitmap or picture to non
rectangular picture by clipping areas outside the boundaries. User can separate out the desired part and undesirable part of picture just by drawing polygon using mouse cursor.
Background
Whenever we store some image on secondary device we store the image in outbound rectangular area. In that case rectangular area which is not part of image has to be filled with some color and consumes unwanted memory. Instead if only the desired area of image is stored then it gives a lot of advantage in saving secondary memory. Loading and saving image will be more cpu intensive compared to rectangular bitmap but more space effective.
Points of Interest
This algorithm stores only the pixels color inside the polygon boundary and saves a lot of extra
space that was wasted by outside area. For example take case of a "cross" picture actually need only 10% part of total storage and wastes 90% of storage. So our algorithm will save 90% of space in this case.
How to use
Steps to perform.
1. Open normal bitmap.
2. Define outbound area polygon by free polygon/ bounded polygon.
3. Save irregular shaped bitmap as ppg picture.
4. Close current picture.
5. Open last saved ppg picture.
6. If more do steps 2 to 5.
7. Look at the size of original bitmap and ppg picture. Ya It does....
History
I would like to listen users review/comments on this article. It stores picture pixels in ARGB format, if further compression like jpeg or gif is provided it may prove better than them also.
Thanks
Vikas Maan, Tek