Thread View: comp.sys.mac.programmer.codewarrior
4 messages
4 total messages
Started by wall
Thu, 09 Oct 2003 09:25
How to crop image in powerplant
Author: wall
Date: Thu, 09 Oct 2003 09:25
Date: Thu, 09 Oct 2003 09:25
45 lines
2690 bytes
2690 bytes
I want to get the image part which I selected in the whole image.
this is the code i worte:
// create the selected rect's size GWorld - theSelectImageGWorld
// the orignal image GWorld - theImageGWorld
LGWorld* theSelectImageGWorld = NEW LGWorld( theSelectRect,32 );
ThrowIfNil_( theSelectImageGWorld );
PixMapHandle theOPixMapH = ::GetGWorldPixMap(
theImageGWorld->GetMacGWorld() );
PixMapHandle theSelectPixMapH = ::GetGWorldPixMap(
theSelectImageGWorld->GetMacGWorld() );
Ptr theOBaseAddr = ::GetPixBaseAddr( theOPixMapH );
Ptr theSelectBaseAddr = ::GetPixBaseAddr( theSelectPixMapH );
short theORowBytes = ::GetPixRowBytes( theOPixMapH );
short theSelectRowBytes = ::GetPixRowBytes( theSelectPixMapH );
::LockPixels( theOPixMapH );
::LockPixels( theSelectPixMapH );
{
Ptr theSrcPtr, theDstPtr;
for(short theY = mSelRectToImageOrignal.top; theY <=
mSelRectToImageOrignal.bottom; theY++)
{
theSrcPtr = theOBaseAddr + theORowBytes * theY;
theSrcPtr += mSelRectToImageOrignal.left << 2;
theDstPtr = theSelectBaseAddr + theSelectRowBytes * ( theY -
mSelRectToImageOrignal.top );
for (short theX = mSelRectToImageOrignal.left; theX <=
mSelRectToImageOrignal.right; theX++)
{
* ((long*) theDstPtr) = * ((long*) theSrcPtr);
theDstPtr += 4;
theSrcPtr += 4;
}
}
}
::UnlockPixels( theOPixMapH );
::UnlockPixels( theSelectPixMapH );
who know where is error in this code. because sometime when the code
perform here,project will crash.
sorry, my english is very poor.
Re: How to crop image in powerplant
Author: Jon Summers
Date: Thu, 09 Oct 2003 13:04
Date: Thu, 09 Oct 2003 13:04
23 lines
2318 bytes
2318 bytes
in article 7328a61a.0310090125.3fd8c2aa@posting.google.com, wall at heroin_c@hotmail.com wrote on 09/10/03 7:25 PM: > who know where is error in this code. because sometime when the code > perform here,project will crash. You code crashes writing passed the end of the destination GWorld off-by-one error /n./ Exceedingly common error induced in many ways, such as by writing <= N instead of < N. fencepost error /n./ A problem with the discrete equivalent of a boundary condition, often exhibited in programs by iterative loops. From the following problem: "If you build a fence 100 feet long with posts 10 feet apart, how many posts do you need?" (Either 9 or 11 is a better answer than the obvious 10.) Fencepost errors come from counting things rather than the spaces between them. -- jons(AT)vrtools(DOT)invalid
Re: How to crop image in powerplant
Author: wall
Date: Fri, 10 Oct 2003 06:56
Date: Fri, 10 Oct 2003 06:56
2 lines
1304 bytes
1304 bytes
if I want to remove red eyes of selected part in the image. how to do ?
Re: How to crop image in powerplant
Author: Steven Fisher
Date: Mon, 13 Oct 2003 10:59
Date: Mon, 13 Oct 2003 10:59
12 lines
2147 bytes
2147 bytes
Jon Summers wrote: > fencepost error /n./ > A problem with the discrete equivalent of a boundary condition, often > exhibited in programs by iterative loops. From the following problem: "If > you build a fence 100 feet long with posts 10 feet apart, how many posts do > you need?" (Either 9 or 11 is a better answer than the obvious 10.) > Fencepost errors come from counting things rather than the spaces between > them. That's a great term for it, Jon. Mind if I ask where you found that definition?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads