ImagePro>Re: using IpBlbGet(GETPOINTS)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ImagePro>Re: using IpBlbGet(GETPOINTS)
- To: <imagepro-users[at]lists.mediacy.com> (Image-Pro Plus Users Email List)
- Subject: ImagePro>Re: using IpBlbGet(GETPOINTS)
- From: Stan Voynick <svoynick[at]selmar.com>
- Date: Fri, 30 Nov 2001 10:22:49 -0800
- List-Archive: <http://lists.mediacy.com:80/Lists/imagepro-users/List.html>
- List-Unsubscribe: <mailto:imagepro-users-off@lists.mediacy.com>
- Reply-To: <imagepro-users[at]lists.mediacy.com> (Image-Pro Plus Users Email List)
- Sender: <imagepro-users[at]lists.mediacy.com> (Image-Pro Plus Users Email List)
John:
Note that when the IpBlbGet() call puts the points into the array, you
are pointing it to put the first point into Outline(0), right? But then
when you print them out, you are starting your "For" loop at location
Outline(1), since your variable "i" starts at the value 1. What's
happening is that you are losing the *first* point by not printing it
out, and then you print an extra, uninitialized point from your array
that doesn't have any data in it - that's where the (0,0) at the end
comes from.
Try changing the following line:
For i = 1 To numPoints
to:
For i = 0 To (numPoints-1)
and see if that shows you all of the points you expect. This is a
common sticky point in programming - in a given situation, do you start
counting from zero or one?
Now, as far as drawing the outline on another image, you have to realize
that you need to "close" your polygon at the end. Here's an example of
what I mean. If I tell you that I have a square with four corners, A,
B, C, and D, and I tell you to draw it by putting your pencil down at
the first point in the list, and then moving it to each subsequent point
in the list like this:
A to B to C to D,
...then you'll find you've drawn three lines and left "open" the fourth
side of the square, right? You need to put point "A" again at the end
of the list, so that your drawing instructions look like this:
A to B to C to D to A
... and now you'll draw the full square.
To modify your code to accomplish this, I'd try:
##############################################################
ret = IpAppSelectDoc(0)
numPoints = IpBlbGet(GETPOINTS, i, 1000, Outline(0))
' at this point, the last point is in location (numPoints-1)
' so add the first point again to the end of the list
Outline(NumPoints) = Outline(0)
ret = IpAppSelectDoc(1)
ret = IpAnCreateObj(GO_OBJ_POLY)
' make sure you tell it to plot the extra point that we added
ret = IpAnPolyAddPtArray(Outline(0), numPoints+1)
ret = IpAnSet(GO_ATTR_PENWIDTH, 1)
ret = IpAnSet(GO_ATTR_PENCOLOR, 255)
##############################################################
I'll warn you that I haven't tested this code to see if I made any
mistakes here - I'm just tossing it off the top of my head - but this
gives you the basic idea...
Regards,
- Stan Voynick -
--
------------------------------------------------------------------
> John McLaughlin wrote:
>
> hi all,
>
> i've encountered a problem where if i try to take the outlines
> from one
> image and draw them on a different image the last point of each
> outline is
> always missing. this is the code i'm using.
>
>
> ret = IpAppSelectDoc(0)
> numPoints = IpBlbGet(GETPOINTS, i, 1000, Outline(0))
> ret = IpAppSelectDoc(1)
> ret = IpAnCreateObj(GO_OBJ_POLY)
> ret = IpAnPolyAddPtArray(Outline(0), numPoints)
> ret = IpAnSet(GO_ATTR_PENWIDTH, 1)
> ret = IpAnSet(GO_ATTR_PENCOLOR, 255)
>
> if i use some code to look at the points the last pair in each outline
> is always 0, 0.
>
> Debug.Print numpoints
> For i = 1 To numPoints
> Debug.Print Outline(i).x
> Debug.Print outline(i).y
> Next i
>
> Any suggestions?
>
> thanks,
> John McLaughlin
> Rigel, Inc.
> 240 East Grand Avenue
> South San Francisco, CA
> 94080
***********************************************************
Need an Image-Pro macro or driver? Find it at http://www.Solutions-Zone.com
Got an Image-Pro macro or driver? Add it to http://www.Solutions-Zone.com
***********************************************************
This message is sent to you because you are subscribed to <imagepro-users@lists.mediacy.com>.
To unsubscribe, email to: <imagepro-users-off@lists.mediacy.com>
To switch to the DIGEST mode, email to <imagepro-users-digest@lists.mediacy.com>
To switch to the INDEX mode, email to <imagepro-users-index@lists.mediacy.com>
Send administrative queries to <imagepro-users-request@lists.mediacy.com>
To subscribe or unsubscribe visit http://www.solutions-zone.com/ipednld/subscriber.asp