Copyright © Kambiz R. Khojasteh. All rights reserved.
Get future component updates from http://www.delphiarea.com.
DESCRIPTION
TPicShow is an image slider control with 176 transitional effects in pure Delphi code. The major characteristics of TPicShow are:
- Image transition can be controlled programmatically
- Image can be stretched or centered in the client area of the control
- Control can show a background image as centered, stretched, or tiled
- Transition process can use a separated thread
- New transitional effects can be easily implemented and added to the control
TDBPicShow is the data-aware version of TPicShow with ability to load bitmap, jpeg, metafile, and png (Delphi 2009 and later) images from a blob field.
DELPHI 3.0 USERS:
Two procedures in 'Graphics.pas' are missing a call to 'BitmapCanvasList.UnlockList'. This bug will cause VCL graphics functions, which have not been called from the main thread, to hang. They cannot lock 'BitmapCanvasList' because the main thread never unlocks it. Because of this bug, running PicShow in threaded mode will lead your application to deadlock.
HOW TO INSTALL
Add the following units into a new or existing package, and install the package:
- PicShow.pas
- PSEffect.pas
- PSReg.pas (for design-time package only)
The following packages must be added to the requires clause of your package:
- VCL
- VCLDB
- VCLJPG
- RTL (for Delphi 6 or higher only)
- DBRTL (for Delphi 6 or higher only)
- DesignIDE (for design-time package of Delphi 6 or higher only)
KEY PROPERTIES
- AutoDisplay: Boolean (TDBPicShow only)
Determines whether the control automatically displays the contents of a graphic BLOB in the database control.
- AutoSize: Boolean
If set to true, Automatically sizes the control to the size of the loaded image if any is loaded.
- BgMode: TBackgroundMode
TBackgroundMode = (bmNone, bmTiled, bmStretched, bmCentered)
Determines how the control displays the background image on its client area.
bmNone |
|
Ignores the background image. |
bmTiled |
|
Fills the client area of the control by the background image as tiled. |
bmStretched |
|
Fills the client area of the control by stretching (or shrinking) the background image. |
bmCentered |
|
Draws the background image on the center of the control's client area. |
- BgPicture: TPicture
Contains the background image of the control.
- Busy: Boolean (Read-only)
Determines whether the control is performing an image transition.
- Center: Boolean
If set to true and control's client area is larger than the loaded image, the image will be centered within the control's boundaries.
- Color: TColor
Determines the background color of the control.
- DataField: String (TDBPicShow only)
Specifies the field of dataset, which contains the image data.
- DataSource: TDataSource (TDBPicShow only)
Links the control to a dataset.
- Delay: Word
Determines the amount of delay in milliseconds before showing the next frame of the transition.
- Empty : Boolean (Read-only)
Determines whether any image is loaded into the control.
- ExactTiming: Boolean
When set to true, the transition of the image will take almost (0.01 * Step * Delay) milliseconds to complete. Otherwise, it may take more time for large images or slow machines.
- FrameColor: Color
Determines the color of the image's border.
- FrameWidth: TBorderWidth
Determines the width of the image's border.
- Manual: Boolean
Determines whether the transition will be advanced manually. When this property is true, the control does not advance the transition automatically and setting the value of the Progress property will define the current frame of the transition. When this property is false, the control automatically advances the transition.
- OverDraw: Boolean
Determines whether the control draws a new transition on the last ones. When this property is True, and current image and previous image has same dimensions, the control draws the new transition over the last one. Otherwise before starting a new transition, the control clears its screen to background.
- Picture: TPicture (Published in TPicShow only)
Contains the image that the next call to Execute will show it.
- Progress: TPercent
TPercent = 0..100
Determines the current state of the running transition. When Busy property is false, changing this property has no effect.
- Proportional: Boolean
Indicates whether the image should be changed, without distortion, so that it fits the bounds of the control. When Proportional is True, images that are too large to fit in the control are scaled down (while maintaining the same aspect ratio) until they fit in the control. Images that are too small are displayed normally.
- Reverse: Boolean
If set to true, automatic transitions plays in reverse.
- Step: Word
Determines the amount of change in Progress in automatic transition.
- Stretch: Boolean
If set to true, when the control's client area is larger than the loaded image, the image it will be stretched (or shrinked) to fit within the control's boundaries.
- Style: TShowStyle
TShowStyle = 0..172
Specifies the index of the transition effect that will be used. By setting this property to zero, an OnCustomDraw event will be fired just before showing a new frame.
- StyleName: String
Specifies the name of the transition effect that will be used.
- Threaded: Boolean
If set to true, the control use a separated thread for the transition process.
KEY METHODS
- procedure Clear;
Clears the client area of the control. Notice that calling this method does not clear the image loaded in to the Picture property.
- procedure Execute;
Initials the transition and if Manual property is set false, starts it. If Manual property is set to true, after calling this method you can change the value of Progress property.
- function GetStyleNames(Names: TStrings): Integer ;
Adds the name of built-in transition effects to the list specified by the Names parameter. The function returns the number of entries added to the list.
- procedure Stop;
Stops the running transition.
KEY EVENTS
- OnAfterNewFrame: TCustomDrawEvent
TCustomDrawEvent = procedure(Sender: TObject; Picture, Screen: TBitmap) of object
This event is triggered just after creating a new frame of the transition and before drawing it on the control's client area. The Picture parameter is the original image and the Screen parameter is the content of the control's client area after the new transition frame.
When PicShow is running in threaded mode, this event occurs in the control's thread.
- OnBeforeNewFrame: TCustomDrawEvent
TCustomDrawEvent = procedure(Sender: TObject; Picture, Screen: TBitmap) of object
This event is triggered just before creating a new frame of the transition. The Picture parameter is the original image and the Screen parameter is the content of the control's client area before the new transition frame.
When PicShow is running in Threaded mode, this event occurs in control's thread.
- OnChange: TNotifyEvent (TPicShow only)
Occurs when content of Picture property is changed.
- OnStart: TCustomDrawEvent
TCustomDrawEvent = procedure(Sender: TObject; Picture, Screen: TBitmap) of object
Occurs before beginning of the transition. After calling Execute Method, the control copies the loaded image into a bitmap and use it for transition purpose. The Picture parameter is the original image and the Screen parameter is the content of the control's client area just before any transition.When this event is triggered, you can load another image into the component for the next transition.
- OnStop: TNotifyEvent
Occurs when transition is completed or aborted.
- OnComplete: TNotifyEvent
Occurs when the transition effect has compeleted normally. If transition stops by calling Stop method, this event does not occur.
- OnProgress: TNotifyEvent
Occurs just after drawing a frame of the transition on the client area of the control.
- OnCustomDraw: TCustomDrawEvent
TCustomDrawEvent = procedure(Sender: TObject; Picture, Screen: TBitmap) of object
If Style property set to 0, this event is triggered when the control needs to create a new frame of the transition. The Picture parameter is the original image and the Screen parameter is the content of the control's client area, which should be updated.
When PicShow is running in Threaded mode, this event occurs in control's thread.
- OnMouseEnter: TNotifyEvent
Occurs when the mouse pointer moves over the control.
- OnMouseLeave: TNotifyEvent
Occurs when the mouse pointer moves off from over the control.
- OnAfterLoadPicture: TNotifyEvent (TDBPicShow only)
Occurs when a new picture is loaded into the control.
- OnBeforeLoadPicture: TNotifyEvent (TDBPicShow only)
Occurs when a new picture is being load into the control.
- OnGetCraphicClass: TGetGraphicClassEvent (TDBPicShow only)
TGetGraphicClassEvent = procedure(Sender: TObject; var GraphicClass: TGraphicClass) of object;
Occurs when a new picture is about to load into the control. TDBPicShow can recognize bitmap, jpeg, metafile, and png (Delphi 2009 and later) images stored in the blob field, however it raises an exception on other graphic formats. This event gives the application an opportunity to specify the graphic class type of the data in the blob field.
LIMITATION
The control does not support image transparency. The transparent area of the images with transparency fills with the control's color.
HISTORY
- Version 4.20 (July 19, 2010)
- 4 new slide out effects added (Thanks to DProgs).
- Version 4.10 (March 5, 2009)
- In threaded mode the component uses multimedia timer instead of a separate thread, which makes having much smoother transitions. Because of that the ThreadPriority is no more present.
- Version 4.07 (January 15, 2009)
- Improved updating display in threaded mode.
- Version 4.06 (November 19, 2008)
- Support for Delphi 2009 added. As the result, TDBPicShow can natively recognize PNG images stored in the blob fields.
- Version 4.05 (January 27, 2007)
- The Channel Mix effect is added.
- The effects are slightly reordered.
- Some other minor tweaks.
- Version 4.04 (July 1, 2006)
- Added detection of Exif JPEG format to TDBPicShow (Thanks to Nest King).
- Fixed AV Exception of TDBPicShow occured by assigning JPEG images to the field.
- Version 4.03 (April 28, 2006)
- Four new transition effects are added.
- Version 4.02 (April 24, 2006)
- Some minor optimizations are applied.
- By adding light reflaction effect, unroll transitions are improved.
- Fifteen new transition effects are added.
- Version 4.01 (April 16, 2006)
- Some more optimizations are applied.
- The new GetStyleNames method is added.
- The provided demo program is improved.
- Version 4.00 (April 14, 2006)
- The code is entirely reviewed and optimized. The new code is much faster than before, so that slide show of large images is possible now.
- The visual effect of some transition styles are improved.
- Two new transition effects are added.
- For compatibility with Delphi's TImage control, StretchFile property is renamed to Proportional. Also, its behavior is adapted to the proportional property the TImage control.
- New FrameColor and FrameWidth properties are added.
- For Delphi 4 and higher, all the Delphi controls' standard properties and events are added (New Properties: BevelEdges, BevelInner, BevelOuter, BevelKind, BevelWidth, BorderWidth, Constraints, DocSite, DragKind; New Events: OnCanResize, OnConstrainedResize, OnDockDrop, OnDockOver, OnEndDock, OnStartDock, OnUnDock).
- Version 3.10 (November 25, 2004)
- The new property ExactTiming added (Thanks to Hertwig van Zwietering).
- Version 3.09 (August 12, 2004)
- The wrong signature of bitmap files fixed (Thanks to Stefano P.).
- Version 3.08 (December 6, 2003)
- Native support for Windows Metafile (WMF) and Enhanced Metafile (EMF) image formats added to TDPicShow.
- Version 3.07 (November 17, 2003)
- The pivot effects are optimized.
- Version 3.06 (September 8, 2003)
- The bug in setting StyleName property fixed (Thanks to Terry Bogard).
- Version 3.05 (July 26, 2003)
- The definition of the OnStart event changed. Now the event passes the original image and its underlying screen as two bitmaps to the handler.
- The new property OverDraw is added. When this property is True, the control draws the new transition over the last one, otherwise before starting a new transition it clears the screen to the background.
- Version 3.04 (July 12, 2003)
- The bug on uninitialized off-screen bitmap fixed (Thanks to Miguel Gastelumendi Dargent).
- Version 3.03 (July 6, 2003)
- The bug of corrupted image after loading it to TDBPicShow fixed.
- Version 3.02 (May 29, 2003)
- The bad result on rendering stretched images on Windows 2000 and XP fixed.
- Version 3.01 (May 8, 2003)
- The code related to thread's termination optimized (Thanks to Viatcheslav V. Vassiliev).
- Version 3.00 (February 16, 2003)
- Transition effects moved to a separate unit.
- The number effects increased to 150 effects.
- Version 2.81.3 (January 11, 2003)
- Known bugs of TDBPicShow fixed (Thanks to Vicente Santamaría Vázquez).
- Version 2.81.2 (October 25, 2002)
- The components prevented Windows for being shutdown. This bug fixed.
- Version 2.81.1 (September 28, 2002)
- Bug on proportional scaling of the image fixed.
- Version 2.81 (September 26, 2002)
- There was a memory leak on loading large images (more than 1MB) to the control, which is fixed.
- Race condition problem of the thread in TDBPicShow fixed.
- New event OnGetGraphicClass added to TDBPicShow.
- Algorithm of image rotation optimized.
- Version 2.80 (September 10, 2002)
- Control's thread optimized. In threaded mode, control does not call Delphi Synchronize function anymore to synchronize itself with the main VCL thread. As the result, no more deadlock, faster thread termination, lower CPU usage, and smoother transitions. However, because of this change, the control cannot be compiled as non-windowed control anymore.
- Now changing the value of Manual, Progress, and Reverse properties at the last step of transition takes effect.
- New method OnStop added.
- Version 2.68 (Julay 9, 2002)
- Minor bug fix.
- Version 2.67 (June 5, 2002)
- Bug on releaseing the thread fixed.
- Version 2.66 (May 9, 2002)
- Memory leak bug fixed.
- Version 2.65 (March 8, 2002)
- A minor bug on fade effect is fixed.
- Version 2.64 (February 9, 2002)
- A little improvement in performance.
- Version 2.63 (January 14, 2002)
- Bug raised on thread during the previous upgrade, fixed.
- New event OnStart added.
- Version 2.62 (December 29, 2001)
- Support for Delphi 6.0 Added.
- Now both controls as default are windowed control. To change them from windowed control to non-windowed control, edit PicShow.pas and remove definition of WINCONTROL_PICSHOW compiler symbol.
- Version 2.61 (April 18, 2001)
- New property StyleName added. This property is as same as Style property but uses name of the transition instead of its index (Thanks to Gary Bond).
- Version 2.60 (February 21, 2001)
- Native JPEG support added to TDBPicShow (Thanks to Ken Otto)
- OnAfterLoadPicture and OnBeforeLoadPicture added events added to TDBPicShow (Thanks to Ken Otto)
- A memory leak bug fixed (Thanks to Ken Otto)
- Version 2.50 (September 7, 2000)
- 5 new effects added; now 127 effects (Thanks to Elliott Shevin for 4 of these effects).
- Component editor improved.
- Version 2.40 (June 16, 2000)
- TDBPicShow is data-aware version of TPicShow that added to this version of the component set.
- Version 2.32 (June 14, 2000)
- Since to this version, TPicShow only was a windowed control. Now, TPicShow can be a windowed or non-windowed control depending to definition of WINCONTROL_PICSHOW compiler directive.
- Version 2.31 (June 12, 2000)
- OnBeforeNewFrame and OnAfterNewFrame events added.
- Version 2.30 (February 27, 2000)
- Memory leak bug fixed.
- Version 2.20 (February 6, 2000)
- Now, all styles can be played as reverse.
- Reverse property added.
- Now the value of Progress property can be manually decremented for all styles.
- OnMouseEnter and OnMouseLeave events added
- the parameters of OnCustomDraw event changed.
- Some comments added to the source of demo application.
- Version 2.11 (February 1, 2000)
- A minor bug fixed.
- Version 2.10 (January 31, 2000)
- 5 new effects added; now 122 effects.
- Property editors placed in a separate unit (Delphi 5 consideration).
- Known bugs fixed.
- Version 2.00 (December 12, 1999)
- Manual animation control added (Thanks to Jerry McLain for the idea).
- Now all styles, play the image with an equal speed.
- Stretch can keep the image aspect ratio.
- Delay, Manual, Progress, StretchFine, and ThreadPriority properties added.
- OnCustomDraw and OnProgress events added.
- Version 1.50 (November 17, 1999)
- now Delphi 3.0 is supported.
- Icon support added.
- Version 1.40 (November 16, 1999)
- 8 new effects added; now 117 effects (Thanks to M. R. Zamani for these effects).
- All reported bugs fixed.
- Version 1.30 (November 11, 1999)
- BgMode and BgPicture properties added.
- 32 new effects added; now 109 effects.
- Thread management improved.
- Version 1.20 (November 9, 1999)
- Empty property added.
- OnChange event added.
- Stop method added.
- 30 new effects added; now 77 effects.
- all known bugs fixed.
- Version 1.10 (November 6, 1999)
- Busy property added.
- Some bugs fixed.
- Version 1.00 (November 5, 1999)
- Initial release with 47 effects.
ACKNOWLEDGMENT
Special thanks to:
LICENSE
TPicShow & TDBPicShow components are freeware. You may copy components' files AS LONG AS YOU COPY ALL OF THEM. If you want to change the source code in order to improve the components' features, performance, etc. please send me the new source code so that I can have a look at it. The changed source code should contain descriptions what you have changed, and of course your name. The only thing you MAY NOT CHANGE is the ORIGINAL COPYRIGHT INFORMATION.
DISCLAIMER
TPicShow & TDBPicShow components are provided "AS IS" without any warranty of any kind, either express or implied. The entire risk as to the quality and performance of the software is with you. The author is NOT liable for any DAMAGES resulting from the use and misuse of the components, especially he is NOT liable for DAMAGES that were caused BY ANY VERSION WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF.