Join two bitmaps

Hi, I’m new to programming in C/Photon AND to QNX; I feel like I could use a little advice. I’m trying to write a function that accepts two paths, and outputs a third path. The function must load the bitmaps at those two paths, join them vertically, and save the merged bitmaps to the third paths. I believe I’ve loaded them properly:

PhDim_t dim = {0,0};
PhImage_t finalImage;
PhImage_t bitmapA;
PhImage_t bitmapB;
bitmapA = *PxLoadImage(pathA.c_str(),NULL);
bitmapB = *PxLoadImage(pathB.c_str(),NULL);

//Set final image size to be the wider of the two widths, and the sum of the heights
if (bitmapA.size.w < bitmapB.size.w)
{
dim.w += bitmapB.size.w;
} else {
dim.w += bitmapA.size.w;
}
dim.h += bitmapA.size.h;
dim.h += bitmapB.size.h;

//Create final image of the correct dimensions to hold the two inputs - is this the right route to take?
finalImage = *PhCreateImage(NULL,dim.w,dim.h,Pg_IMAGE_DIRECT_888,NULL,0,1);

//Join the two bitmaps here

//Save the final image to disk
PxWriteImage(pathFinal.c_str(),&finalImage,NULL,Px_IMAGE_BMP,0);

I’m throwing myself on your mercy here; by my code, my inexperience should be fairly obvious. I’ve run a few forum searches and battled with Google for hours trying to find a simple way to do this; if anyone can point me in the right direction I’d be extremely grateful. :slight_smile:

I’m not sure what help you are asking for. Your code looks ok so far. How to join the bitmaps? The only tricky part I can think of is that there is a part of the image structure that tells you how wide a line is. The line might be greater than the width. You have to copy line by line leaving any extra line data empty. If you don’t do this you get the affect of an old TV that has lost sync.

Look for Intel Performance Primitives - IPP on Intel site. Their static libraries for Linux are working under QNX.

IPP is quite a complicated for such a simple task.

and quite simple for complicated tasks.

What version are you using. How much does it cost?

I started with IPP 5.1, and now I use 6.1.3
There is no royalty fees, and one time cost is less than 200USD. Check it on intel web site. I guess QSSL are using it for Aviage package.

Thanks, Wasn’t there some kind of wierd trick that is required to make it link. Does it work with 6.3.2, 6.4.1 and upcomming 6.5.0 which are all using different version of gcc?

Yes and uh, and what does it do?

I use IPP under 6.3.2 and 6.4.1. Have not tested with 6.5.0.