View topic - Join two bitmaps

Join two bitmaps

anything that doesn't fit to other groups.

Join two bitmaps

Postby theshepherd » Mon Jun 28, 2010 4:56 pm

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. :)
theshepherd
New Member
 
Posts: 1
Joined: Mon Jun 28, 2010 4:55 pm
Location: Rochester, NY

RE: Join two bitmaps

Postby maschoen » Wed Jun 30, 2010 4:11 pm

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.
maschoen
QNX Master
 
Posts: 2715
Joined: Wed Jun 25, 2003 5:18 pm

RE: Join two bitmaps

Postby koko » Wed Jun 30, 2010 4:38 pm

Look for Intel Performance Primitives - IPP on Intel site. Their static libraries for Linux are working under QNX.
koko
Senior Member
 
Posts: 100
Joined: Wed Aug 20, 2003 1:31 am

RE: Join two bitmaps

Postby mario » Wed Jun 30, 2010 7:21 pm

IPP is quite a complicated for such a simple task.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Join two bitmaps

Postby koko » Wed Jun 30, 2010 8:03 pm

and quite simple for complicated tasks.
koko
Senior Member
 
Posts: 100
Joined: Wed Aug 20, 2003 1:31 am

RE: Join two bitmaps

Postby mario » Wed Jun 30, 2010 9:18 pm

What version are you using. How much does it cost?
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Join two bitmaps

Postby koko » Thu Jul 01, 2010 12:08 am

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.
koko
Senior Member
 
Posts: 100
Joined: Wed Aug 20, 2003 1:31 am

RE: Join two bitmaps

Postby mario » Thu Jul 01, 2010 2:11 am

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?
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Join two bitmaps

Postby maschoen » Thu Jul 01, 2010 3:04 am

Yes and uh, and what does it do?
maschoen
QNX Master
 
Posts: 2715
Joined: Wed Jun 25, 2003 5:18 pm

RE: Join two bitmaps

Postby koko » Thu Jul 01, 2010 3:50 pm

I use IPP under 6.3.2 and 6.4.1. Have not tested with 6.5.0.
koko
Senior Member
 
Posts: 100
Joined: Wed Aug 20, 2003 1:31 am


Return to General Programming

Who is online

Users browsing this forum: No registered users and 2 guests