Pictures and speed

Ralf Sander ralf at end-if.de
Sat Nov 6 14:14:34 CST 2004


> Ralf Sander wrote:
>
> > Function CellBackgroundPaint(g As Graphics, row As Integer, column As
> > Integer) As Boolean
> > dim p as Picture
> > dim b as Boolean
> >
> > if column=0 then
> > p=NewPicture(30,30,32)
> > b=mDataBase.mPerson.GoToRecID(row)
> > p.graphics.DrawPicture mDataBase.mPerson.PictFld.GetPicture,0,0
> > g.DrawPicture p,0,0,30,30
> > end
> > return true
> >
> > End Function
>
>
> You should cache your pictures. You load everytime a new picture when
> the row is repainted, even if the picture is already loaded. This is
> unnecessary.
> And there are even niftier possibilities. I think iPhoto is
> using different sized preview-pictures, so in the first step you can
> load all lo-res previews, so scrolling speed is fast, when the user
> stops scrolling, you check the currently visible pictures and load the
> higher res previews and display them, and cache them also. If the cache
> hits a specified size, you clear the oldest images in the cache, if 
> they
> are not visible.

Ah, I thought, the row is redrawing only if it becomes visible the 
first time. Silly. Now speed is acceptable.
And the lo-res picture thing will help too, I think.
>
> This had worked for my imagedatabase (which i stopped to develop after 
> I
> checked iView MediaPro)
>
unfortunately, I am not as clever as you ;-)


Thanks a lot,
Ralf


More information about the Valentina mailing list