Click here to Skip to main content
Click here to Skip to main content

Irregular or non rectangular shaped bitmap

By , 4 Feb 2008
 

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

vikas.jpg

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

vikas maan
Software Developer (Senior)
India India
Member
Vikas Maan is a software developer for last 4 years working on windows platform with multiple programming languages mainly VC++, C#.net etc.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionConvert to bmpmemberquincy67927 Sep '10 - 0:01 
QuestionRe: Convert to bmpmemberMember 898179017 May '12 - 1:15 
GeneralSource Code pleasememberakuppach10 May '10 - 9:47 
Questionhow are your scan lines defined in the dib?membered5233 Mar '10 - 13:29 
Generalsource codememberivi hermanto7 Mar '09 - 0:46 
GeneralPixel buffersmemberRay Hayes23 Jan '08 - 23:49 
GeneralRe: Pixel buffersmembervikas maan24 Jan '08 - 17:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 4 Feb 2008
Article Copyright 2008 by vikas maan
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid