Author Topic: Runtime 201 error in ImagingFormats.BuildMappingTable line 1611  (Read 769 times)

Offline cocopascal

  • Imaging User
  • *
  • Posts: 7
    • View Profile
Vampyre 0.26.4
FPC 2.4.1
WinXP sp3

Image.BoundsRect: 1920x1200
PaintBox.ClientRect: 682x633

CommonRect (103, 0, 682, 529)

Calling ImageCanvas.DrawStretchAlpha(Image.BoundsRect, ImageCanvas, CommonRect, rfBicubic)
results in a runtime error 201 in ImagingFormats.BuildMappingTable line 1611 SetLength(Result, DstWidth) because DstWidth has a negative value.

Do you have a quick fix please?


Offline Galfar

  • Administrator
  • Imaging User
  • *****
  • Posts: 312
    • View Profile
    • Galfar's Homepage
With this code ImageCanvas.DrawStretchAlpha(Image.BoundsRect, ImageCanvas, CommonRect, rfBicubic) you're drawing part of the image on itself. Where's that PaintBox used?
DstWidth in BuildMappingTable is calculated as CommonRect.Right-CommonRect.Left (and CommonRect.Bottom-CommonRect.Top), with CommonRect value you posted you can't get negative number.
Could you post a bigger part of your project?




Offline cocopascal

  • Imaging User
  • *
  • Posts: 7
    • View Profile
Graphics is not my cup of tea, obviously. Besides drawing the image on itself I forgot to call canvas.updatecanvasstate.
Of course the probability of me causing the error was high. Nevertheless I posted this report because in this case one would expect an exception handling the setting of a width or the mapping table to a negative length.