August 18th, 2010, 06:02 PM
[RESOLVED] Loading and altering a BMP
Hi there, I'm a reasonably experienced programmer but I'm new to C++. I currently have a fairly simple task in front of me, but I keep getting bogged down in fiddly details. I've done numerous searches on the web, which turn up all sorts of promising code... which never quite works, and being new to C++ I have difficulty figuring out why.
I'm currently using the trial version of Professional Visual Studio 2010 (we'll buy it, assuming I can get this working). In a nutshell what I need to do is load a bitmap from a file, display it, copy it, alter the copy somehow, then display the copy. For altering the copy I need to be able to get and set arbitrary pixels. I've got some of this kind of working, but really I'd rather just throw it out and use something better programmed.
What I've got working is a bit ugly, but it loads the bmp from a file, puts it into a picture control, copies it, makes some edits, then puts it into another picture control. The real problem is that I don't understand the format I'm being given... there seems to be unused portions at the end of each scanline (padding for some structure I guess) but I can't seem to predict how much there will be from one bmp to the next.
Today I tried to install ImageMagick, but it wouldn't work... just using the InitializeMagick function would give me unresolved symbol errors, and I've tried telling it where to look for header and library files. I've also tried copying the libraries into various directories in my visual studio install. So that isn't really working for me.
I would think someone would have come up with a decent and simple interface to this sort of thing by now, but so far my searches have only turned up incomplete code that usually needs modifications to even compile (and I'm not confident my modifications are correct, being a newbie). What I really need is a simple class that implements an interface that would flow something like:
pixelwidth = bmp.getpixelwidth();
pixelheight = bmp.getpixelheight();
rgbvalues = bmp.getpixel(x,y);
You know, a simple straight forward interface that a newb like me can grok. Most importantly though, I need something that will compile on visual studio 2010 without me having to make major modifications.
Would anyone know where I could find some code that would fit the bill for me?
I'd appreciate any help people could give me.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.