ImagePro>Re: using IpBlbGet(GETPOINTS)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ImagePro>Re: using IpBlbGet(GETPOINTS)
I believe I see the problem - you have declared an Outline() array
somewhere, with dimension of (apparently) 1000. Since you did not include
your declaration of the array, I don't know if you have declared it as:
Dim Outline(1000) As POINTAPI
Dim Outline(0 to 999) As POINTAPI
Dim Outline(1 to 1000) As POINTAPI
The first two are equivalent declarations. As you are sending Outline(0) to
the IpBlbGet() function, one of these two declarations is appropriate.
However, when you examine the outlines, you are indexing from 1-1000, not
0-999, and therefore the last point is incorrect.
The fact that you can _get_ the last value indicates that there is a value
at Outline(1000), and that you may be using the third declaration. Either
that, or Outline is considerably larger than 1000.
I would suggest the following:
Dim sizeList As Integer, numPoints As Integer
' ReDim the array to the size of the outline
ret = IpBlbGet(GETNUMPTS, i, 0, sizeList)
' Zero-based point list
ReDim Outlines(0 to sizeList-1) As POINTAPI
' Now get the points into the array
numPoints = IpBlbGet(GETPOINTS, i, sizeList, Outline(0))
' Do something with the points
...
' Print out values. Note that indexing starts at 0!!!
For i=0 to numPoints-1
Debug.Print Outline(i).x
Debug.Print outline(i).y
Next i
This kind of error in indexing is common in any programming environment, and
is something to watch for in your macros.
-- Kevin Ryan
Sr. Project Manager
kevin@mediacy.com
-----Original Message-----
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
***********************************************************
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