EtheaDev / SVGIconImageList

Three engines to render SVG (Delphi Image32, Skia4Delphi, Direct2D wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)
Apache License 2.0
321 stars 93 forks source link

TSVGIconImage change class from TCustomControl to TGraphicControl for repeat paint issue #136

Closed amancini closed 3 years ago

amancini commented 3 years ago

Hello,

The TSVTIconImage is painted many times because during the drawing massage it is called the procedures TWinControl.PaintHandler (var Message: TWMPaint); that call the PaintWindow (DC)

Why use TCustomControl and not use the "Classic" TGraphicControl ?

By changing the class from which TCustomControl derives to TGraphicControl the problem is solved, ( the properties of doublebuffer and parentbuffered and paretBackground are lost )

I have attached a video with the effect produced and the fix on the SVGIconImage.pas

5Q0gX3UtSI.zip SVGIconImage.zip

best regards

carloBarazzetta commented 3 years ago

Originally the component inherits from TGraphicControl, but we changed from TGraphicControl to TCustomControl to implement doublebuffered, as explained in this discussion: https://github.com/EtheaDev/SVGIconImageList/issues/74

In your tests, are you using DoubleBuffered as True?

amancini commented 3 years ago

I try to set DoubleBuffered as true . but the repait issue was not resolved

carloBarazzetta commented 3 years ago

I'm thinking to revert the base class of TSVGIconImage from TCustomControl to TGraphicControl, because the DoubleBuffer option is provided automatically into Direct2D, Cairo and Image32 libraries. Do you agree @pyscripter or am I wrong?

pyscripter commented 3 years ago

I think Direct2D, Cairo and Image32 paint to a bitmap and then render the bitmap to the DC. TSvg draws directly to the DC. I am not using TSvgIconImage and don't have strong views on this.

carloBarazzetta commented 3 years ago

Now I've committed a new version of TSVGIconImage:

@amancini: can you make some test with the new version using also the new Image32 factory?

carloBarazzetta commented 3 years ago

No positive/negative feedback... I'm closing this issue.