Forum Replies Created
-
AuthorPosts
-
SzakiLaciParticipant'TAZ' wrote:
I am having to go through each of my sVirtualImageList controls and uncheck “UseCache”.
I am using the sVirtualImageList for the the sToolBar ImageList.
If “UseCache” is checked the images do not appear.
Is this a bug ? Please educate me about its use if this is not a bug.
Thanks.
Hi,
I've asked the programmer (Serge) to rewrite the sVirtualImageList component, so it's NOT cashing each and every picture at the beginning immediately , but should wait until any of the pictures being accessed. This way it speeds up program loading, and using less memory. (Storing ONLY those being used.)
But it should automatically appear, and it should render those, you wish to show! So it is probably a small bug.
I will test it today with the newest stable relase and report back.
If you want a fast solution, you can try to render each picture at the beginning by using this new procedure:
myVirtList.RenderCacheNow(-1); // parameter -1 means it should render ALL
Turning OFF the cache is using less memory, but slowing down paint process, because it has to calculate stretching and softening each time.
Cheers
PS: anyway … what do you mean by “each of my sVirtualImageList controls” ? Do you have more than 1-2 ? Why?
June 17, 2014 at 11:24 am in reply to: TsAlphaImageList delete or Clear does not work at runtime #51879SzakiLaciParticipantHi again,
I've just found an other error:
Tried to recompile the “VirtualImageList DEMO” you've sent me in 2012.dec. with the newest component pack …
and the .dfm file suddenly increased from 2927 Kbyte > to 9461 Kbyte. Also the compiled EXE increased 3x bigger.
Looked into it, and realized it saves a HUGE BMP file :
Code:…
object sVirtualImageList1: TsVirtualImageList
Height = 128
Width = 128
AlphaImageList = sAlphaImageList1
UseCache = False
Left = 368
Top = 136
Bitmap = {
494C010128002C00040080008000FFFFFFFF2100FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000000200008005000001002000000000000000
2C00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
…SzakiLaciParticipant'Support' wrote:Hello!
This procedure will be added in the v9.02:
procedure RenderCacheNow(ItemIndex: integer = -1);
If ItemIndex is not defined then all items will be cached.
Perfect ! 🙂 THANKS !!
SzakiLaciParticipantSo basically your cache Array will “look like this” in memory :
Code:CachedImages[0] = nil;
CachedImages[1] = BMP32; // this has been called at startup, because the main screen is using it already.
CachedImages[2] = nil;
CachedImages[3] = nil;… Than I'll call directly from a timer:
Code:RenderCacheNow(2); // because I now, sooner or later that image will be needed, and want to short down showing the new window that's using that image.… if I would call :
Code:RenderCacheNow(1); // >> nothing would happen, because it's ALREADY cached! So it's skipping
(if Assigned(CachedImages[1]) then Exit;)SzakiLaciParticipant'Support' wrote:…But, what is purpose of the RenderCacheNow procedure? Users will not use it, I think..
It is the MOST important part of my idea, because programmers (like me) could either:
1. render each picture 1 by 1 at startup and show the progress (Caching pictures… 47 of 147 done.)
or
2. load it in background with a timer, so the app does not frees, but slowly sooner or later all pictures would be cashed.
3. you can call it from your procedures, if needed but is not cached yet. (and should be, because [UseCache = True])
4. users can pre-cache particular (mostly used) pictures, and not ALL.
SzakiLaciParticipant.. And if you want to have backward compatibility >> you can make property like
CashALLatStartup:Boolean = True;
and for that an “OnCaching” event.
THANKS A LOT in forward!
I could write it myself, but do not want to mess up your code, and rewrite/search for difference each time I want to install a new version of AC.
I need this behavior badly, because my program startup is already TOO SLOW, and my clients are complaining that the “old version” was better 🙁
Also I would like to change my old 32x32px ugly menu pictures to new 128x128px alpha-channel ones. And those are ca. +80 icons additionally to the current 40. :a1:
PS: Donated some cash for the cache :a8:
SzakiLaciParticipant… I've looked into the code and I think it's very easy to do.
1.) CUT out from
Code:procedure TsVirtualImageList.GenerateStdList;
…
CachedImages := CreateBmp32(Width, Height)
…part. Leave it NIL. (You can also use a boolean flag, but I think checking =nil later is fine too.
2.) Paste it to a new procedure. Name it like:
Code:RenderCacheNow(Index:integer);3.) Put a “caller” for it into:
Code:function TsVirtualImageList.GetBitmap32(Index: Integer; Image: TBitmap): Boolean;
…
if FUseCache then begin
if CachedImages[Index] = nil then
RenderCashNow(Index);SzakiLaciParticipant'CheshireCat' wrote:I use the following simple procedure for storing bitmaps in files:
uses
PNGImage;
procedure SaveToPNG(Source: TBitmap; FileName: String);
var
Dest: TPNGImage;
…
Maybe you are looking for something?
[/quote]Thanks, but this is only possible up from Delphi2009+
… if it would be so easy, I wouldn't ask 😀
Sadly I'm still using Delphi 7 ! There is no PNGImage unit in that old version.
I've found this:
PNGdelphi
… will test it tomorrow 😉Cheers[code]
uses
PNGImage;
procedure SaveToPNG(Source: TBitmap; FileName: String);
var
Dest: TPNGImage;
…
Maybe you are looking for something?
Thanks, but this is only possible up from Delphi2009+
… if it would be so easy, I wouldn't ask 😀
Sadly I'm still using Delphi 7 ! There is no PNGImage unit in that old version.
I've found this:
… will test it tomorrow 😉
Cheers
SzakiLaciParticipant'Support' wrote:… Saving from Bmp to Png is not implemented in the AlphaControls (only reading).
Thanks for the quick response 🙂
YES, I know it's not directly implemented, that's why I'm trying to get some help please.
Because previously I had many problems about importing PNG images of different types, (auto-alpha converted by Irfanview) I'm afraid if I find a wrong code, it won't work.
How do YOU convert JPG/BMP to PNG dynamically? ^_^
SzakiLaciParticipantI would gladly donate more money, if AC would work under Lazarus.
(Win+Linux+ later Android … do not care about iOS).
Currently I'm considering to transfer my whole PizzaProgram to FreePascal, because Delphi updates have horrible prices.
The new Delphi XEx versions have already some kind of choosable skin-kontrol, but Lazarus controls look lame > So there is a big market for them I think.
PS: Lazarus components (.LPK) have to be written only ONCE ! Because they're designed to be compatible with all (earlier and future) Lazarus versions! (Not like at Delphi)
And the forum is great and fast responsive too !
I'm sure they would help you immediately, if you need.
Cheers
Laci
PS: Christmas time is coming = PLENTY of free free time ! 😀 😀 😀
SzakiLaciParticipant'Support' wrote:I think, it's a standard behaviour?
I'll check it.
You can help me if send a test-app
I was able to finally analyze the problem, and I think I've found what is causing the error ! 😉
It's the integer-width rounding. About 1 pixel too small after ScaleBy. That's why it's breaking into 2 lines, when it shouldn't.
Like sCheckBox1.width=77 >> ScaleBy(172,100); >> 132.44 = >> 132px.
An easy way to test and prevent it, to change ALL TsCheckBox Captions by adding a ' ' space after it. And voala.
Of course it would be better, if it would calc the correct width 😀
SzakiLaciParticipantThanks for fixing it (half way…) 🙂
… just checked in 8.31b — works fine now. Both Autosize True/False !IF! Skinned is Active.
But problem still exists in non-skinned state. (Realized and Edited apr.10)
SzakiLaciParticipant'Support' wrote:I can't reproduce it, can you help me?
I'm testing and testing and it's doing at me ALWAYS.
attached a simple project. Just select the image and click the Autosize property to become TRUE.
it will shrink the image size to 0-0 !
SzakiLaciParticipant'Support' wrote:Hello!
I think, such component may be useful, added in ToDo 🙂
Hi,
I've tested yesterday 8.30 beta (yet, only on XE3 32bit)
Also tested with TsVirtualImageList.
TsImage seems to work nice !! 😀
only found 3 small glitches:
1. if a TsButton is placed OVER it, the button flickers (even at design time) [maybe sButton related…] [TsBitBtn works fine.]
2. if setting .AutoSize := True >> Height and Width will change to 0 !! >> not possible to change those to any other value except turning AutoSize OFF.
3. ImageIndex is normally at all other AC components a drop-down list with images showed. Here only a number.
… and I've found an other abnormality: when changing the AlphaImageList 's Width and Height >> pictures are not showing any more, only in the pic-manager window. (See attached pic.)
Cheers
PS: this topic should now being moved to Troubleshootings.
SzakiLaciParticipant'Support' wrote:Hello!
I think, such component may be useful, added in ToDo 🙂
Thanks Mate !
I'll be thankful for that 😉
You may just make a copy from the TsBitBtn component,
– rename to TsImage
– delete all unnecessary stuff (Caption, borders, etc) and
– add Proportional property.
I think that's all. :a3:
SzakiLaciParticipantHi Serge !
It's new year and (hopefully) we are all sober again 😀
It would be hard for me to list ALL advantages a TsImage component would offer but here are some:
– OnClick, MouseUp … events on a picture
– Proportional property
– UseCash property (like at TsVirtualImageList)
– no need to calculate ScaleBy- and Anchors-modified coordinates for placement of a picture
– component order
– probably more repaint-refresh compatibility with other AlphaSkin controls (like TsPanel)
– maybe it could hold standard picture types too, like a normal TImage (.jpg, tif..)
– would increase development work for scaled touch-screen application ca. 20x times
– …
So it would be simply logical to have such a component, basically like the sBitBtn, without [focus, borders, onKeyDown, …] and such events.
Cheers ^_^
I've just started to develop a new module for my program where I wanted to place pictures for different payment types (cash, credit card, ticket, …) on a TScrollBox under each other. Than I've realized it's complicated without TsImage to use pictures already saved into a TsAlphaImageList.
SzakiLaciParticipantMan, seriously … you are my “PROGRAMMER OF THE YEAR” ! :a7:
You have done it again.
The example to test the difference between cached and non-cashed appearance is PERFECT. (And also looks cool…)
You've made my Christmas gift.
_______________
You forced me to “revenge” it by sending you a tiny Christmas donation… see my Private message 😉
SzakiLaciParticipant… if that's not possible, is it maybe a solution to create and convert only THOSE really needed and accessed? (And free after nothing is pointed to it…)
SzakiLaciParticipantVersion 8.12 is out, (since 2012. dec. 14.) and since 8.11 (2012. dec. 12) there's a new component: TsVirtualImageList
COOL ! 🙂 .. I was very happy about it. (first)
Today I've finished implementing the new package to my program and figured out the following:
Seems to Re-Create every each picture >>
– consuming huge amount of memory
– making Delphi7 running at 100% process time for half minute after clicking SAVE each time
– does not FREE the pictures at program ending >> making to drop Access Violation at the end.
To Test it:
ADD 50 pictures to a TsAlphImageList (ca. 100Kb each), than Drop a TsVirtualImageList to the Form too, and SET width=256, Height=256.
So this way it isn't going to work properly 🙁 because the basic idea was to Re-introducing a FEW pictures here and there from ONE BIG package in different sizes, without need of extra memory and space.
My question/recommendation would be :
– Isn't it possible to convert those pictures on the fly? I mean it would only show VIRTUALLY as if there would be any real picture, but not holding every each of them in memory pre-converted?
___________
Anyway every other component fixes in the last 4 month seems to be PERFECT ! Great Job, Thank you and Marry Christmas !!! 🙂
SzakiLaciParticipantAny progress? 😉
Thanks !
-
AuthorPosts