Error 1 GenericError on crop

Discussions about document viewing.
Post Reply
olglover
Posts: 2
Joined: Sat Dec 11, 2010 10:35 pm

Error 1 GenericError on crop

Post by olglover » Sat Dec 11, 2010 11:20 pm

I'm evaluating GDViewer Pro. It keeps returning a "1 GenericError" when on the following statement. Can someone tell me what I'm doing wrong?

THIS.oimaging.crop(THIS.ogdviewer.getrectx,THIS.ogdviewer.getrecty,THIS.ogdviewer.getrectwidth,THIS.ogdviewer.getrectheight)

An example of how to crop would be great!

Thanks in advance.

Tom Moran
Posts: 102
Joined: Thu May 24, 2007 9:41 am
Location: Phoenix, Arizona

Re: Error 1 GenericError on crop

Post by Tom Moran » Sun Dec 12, 2010 5:52 pm

You must first set/draw the rectangle you wish to crop and then crop to those rectangle coordinates.

Here is VB6 code that sets, gets a rectangle and then crops an image to that rectangle and then displays in the viewer:

Code: Select all

Dim nleft as Long, ntop as Long, nWidth as Long, nHeight as Long

'First set area to crop
  nleft = 0
  ntop = 0
  nWidth = 100
  nHeight = 100
  oGdViewerCnt.SetRectValues (nLeft, nTop, nWidth, nHeight)

'Now crop to that area
  If oGdViewerCnt.isRectDrawed Then
     Call oGdViewerCnt.GetRectValues(nleft, ntop, nWidth, nHeight)
     Call Imaging1.Crop(nleft, ntop, nWidth, nHeight)
     Call oGdViewerCnt.SetNativeImage(Imaging1.GetNativeImage)
 Else
     MsgBox "There is no selection made!", vbOKOnly, " Error Information"
 End If
Hope this helps you.

Edit: I just noticed you are using GdViewer Pro. To use the Crop Method you must use the GdPicture Pro package.

Tom

olglover
Posts: 2
Joined: Sat Dec 11, 2010 10:35 pm

Re: Error 1 GenericError on crop

Post by olglover » Sun Dec 12, 2010 10:04 pm

Thanks Tom.\

I am using the GdPicture Pro package in "Demo" mode.

Following your pattern I wrote the following code in VFP. The crop method is still returning a value of 1 "GenericError" when called. In addition, after the code below had run, nothing else on the form (zoom, rotate, etc...) works at all.


*First set area to crop
nleft = 0
ntop = 0
nwidth = 100
nheight = 100
THIS.ogdviewer.setrectvalues (nleft, ntop, nwidth, nheight)

*now crop to that area'
IF THIS.ogdviewer.isrectdrawed
THIS.ogdviewer.getrectvalues(nleft, ntop, nwidth, nheight)
IF THIS.oimaging.crop(nleft, ntop, nwidth, nheight) > 0
WAIT WINDOW "Error # "+STR(THIS.oimaging.crop(nleft, ntop, nwidth, nheight))
ENDIF
THIS.ogdviewer.setnativeimage(THIS.oimaging.getnativeimage)
ELSE
WAIT WINDOW "There is no selection made!"
ENDIF

BTW: I'm running Win7 64bit.

Tom Moran
Posts: 102
Joined: Thu May 24, 2007 9:41 am
Location: Phoenix, Arizona

Re: Error 1 GenericError on crop

Post by Tom Moran » Mon Dec 13, 2010 6:25 pm

Hi:

Sorry... I know nothing about VFP or what may be happening in that environment.

Perhaps Loic can better help you.

Tom

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest