access violation when resizing large images

  • Hi,

    I get an Access Violation when trying to resize an image I inserted into my document. Apparently this happens with images larger than the document's page width.

    To reproduce :
    - run the test projet : ..\Demos\Ver6Demos\D2009\WPT2009Project1.exe
    - load a document, open the editor ('DefEditor' button)
    - insert a LARGE image (e.g. 1920 x 1200 pixels) (menu : 'Insert' / 'Graphic')
    - try to resize the inserted image
    => access violation

    Remarks :
    - happens with WPTools 6.03, 6.02
    - does not happen when the inserted image is small (narrower than the page width ?)

    Thanks,
    Attila Krüzsely

  • Hello,

    Yes, I also get access violations when graphics are painted in WPTools 6.03 and 6.02 (6.01 and 5.x are OK).
    I think the problem occurs whenever the image has been scaled. Please try to load these RTF files:

    http://www.moregroup.de/files/GraphOrig.rtf
    (no scaling, no problem)

    http://www.moregroup.de/files/GraphScaled.rtf
    (access violation, image not painted in 6.03)

    It means I am not able to convert from WPTools 5 to 6.03, because my customers have scaled images in their documents.
    Any help is appreciated!

    Delphi 2009 Prof, Win XP Prof

    Best regards,

    Fredrik Fundin
    MOREgroup GmbH

  • Hello Julian,

    That is strange. I got the access violation in unit WPObj_Image, function TWPOImage.PaintEx, at line 590.

    But anyway, thank you for the suggestion! Using the file WPObj_Image.pas from version 6.01 solved the problem.

    Fredrik Fundin
    MOREgroup GmbH

    • Offizieller Beitrag

    Hi,

    Please comment this line in WPObj_Image.PAS

    FPaintOptions := [wpPaintObj_AutoScreenOptimation];

    Code
    procedure TWPOImage.PaintEx(toCanvas: TCanvas; BoundCanvas: TRect;
      ParentTxtObj: TWPTextObj; PaintMode: TWPTextObjectPaintModes;
      xres, yres: Integer);
      begin
     //   FPaintOptions := [wpPaintObj_AutoScreenOptimation];
        if not Transparent then include(FPaintOptions,wpPaintObj_AutoAntialias);
        inherited PaintEx(toCanvas,BoundCanvas,ParentTxtObj,PaintMode,xres, yres);
      end;

    This problem appears to be Delphi 2009 specific.