ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Stop Layers from redrawing if cache is on
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

zerob

151 Posts

Posted - Aug 27 2024 :  04:22:39  Show Profile  Reply
Hi Nigel
I've enabled LayerCaching (LayersCaching := -1;) and fastdrawing (LayersFastDrawing := iefDelayed;) and created some alpha bitmap layers.
Each time i click on a layer, an empty space or move a layer or resize one of the layers and so on, all layers start to look jaggy again and need redrawing.
Is there a way to use the pretty layers from cache instead of resmoothing them over and over until i actually alter a particulary layer and then just that layer needs to resmoothe to look pretty again?
If i not touch other layers, or even the actual layer only gets moved, resmoothing isn't needed if a cached version already exists and also other layers don't need to be repainted at all if they don't overlap (or repainted from cache).

This would be really nice and maybe even speed up non iefDelayed drawing / moving a lot.

Regards

xequte

38529 Posts

Posted - Aug 28 2024 :  00:33:12  Show Profile  Reply
Hi

Why not just use:

ImageEnView1.LayersFastDrawing := iefNormal;

http://www.imageen.com/help/TImageEnView.LayersFastDrawing.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

zerob

151 Posts

Posted - Aug 28 2024 :  03:33:09  Show Profile  Reply
Hmm, it seems, the whole thing isn't comming from the FastDrawing, but from the ZoomFilter.
Even if i didn't change the ImageEnView1.Zoom and it is still at 100.
If i set DelayZoomFilter to False, then all movement etc stutters because i've set the ZoomFilter to rfLanczos3.
If i set it to rfNone then the Layers look jaggy.
Is it also considered Zooming when i resize a Layer with "Layers[0].SetBounds(0,0,343,343);" when the image that i loaded with "LayersAdd('...');" was initially larger than 343?
Can this smoothing be cached somehow? Would be nice if i didn't have to resample the images to a low quality and back and forth.
Go to Top of Page

xequte

38529 Posts

Posted - Aug 28 2024 :  23:58:43  Show Profile  Reply
Hi

Please email me for the latest beta that supports this.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

zerob

151 Posts

Posted - Aug 31 2024 :  09:11:05  Show Profile  Reply
After installing the latest Beta, the Layers stopped smoothing at all and seem to always look jaggy, no matter what i do.

ImageEnView1.LayersCaching := -1;
ImageEnView1.LayersRotationFilter := TIEAntialiasMode.ierBicubic;
ImageEnView1.LayersRotationUseFilterOnPreview := True;
ImageEnView1.LayersRotationAntialias := True;
ImageEnView1.LayersFastDrawing := TIEFastDrawing.iefDelayed; // also tried normal
ImageEnView1.ZoomFilter := TResampleFilter.rfLanczos3;
ImageEnView1.DelayZoomFilter := True; // also tried False
ImageEnView1.Zoom := 100;
Go to Top of Page

xequte

38529 Posts

Posted - Sep 01 2024 :  16:16:32  Show Profile  Reply
Hi

I've created a simple demo using your code above, but cannot reproduce the issue. Can you please test it and let me know what changes I need to make to reproduce it.

www.ImageEn.com/temp/Zerobtest.zip

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

zerob

151 Posts

Posted - Sep 02 2024 :  02:18:54  Show Profile  Reply
I've found the culprid.
I wanted to see the Chessboard background (because i load alpha layers) and if i do hide your 0 layer, then it won't smooth the layers anymore and also in your demo, moving the layer gets painfully slow after hiding the background (even without adding chessboards).

Backgroundstyle = iebsChessboard // not required, also happens without
ImageEnView1.Layers[0].Visible := False;
ImageEnView1.Layers[0].SetBounds(0,0,ImageEnView1.Width,ImageEnView1.Height); // this was a leftover before i tried to hide the background... see below comment.

While digging deeper, i've found that i still had left some resizing code of the Layer 0 in the form creation and the form resize.

ImageEnView1.Layers[0].SetBounds(0,0,ImageEnView1.Width,ImageEnView1.Height);
It seems that resizing that hidden background layer or even doing a FormResize with

ImageEnView1.Layers[0].Bitmap.Resize(ImageEnView1.Width,ImageEnView1.Height,clRed);
ImageEnView1.Layers[0].Width := ImageEnView1.Width;
ImageEnView1.Layers[0].Height := ImageEnView1.Height;

Causes this.
I can uncomment either or both and get this result.
It seems the caching algorythm doesn't like a resized, hidden layer 0.

But when i remove this, the result of your changes are impressive.
This does make ImageEn so much better in many situations.
Really good work!
Go to Top of Page

xequte

38529 Posts

Posted - Sep 02 2024 :  19:20:38  Show Profile  Reply
Thank you for the concise steps to reproduce. I have emailed you the latest beta which should resolve it.

Please email us directly if you encounter beta related issues.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: