TW3Image
Represents class for image component. This component may be also used as standalone component, but it is used within other components too.
Unit: SmartCL.Controls.Image.pas
- Hierarchy
- TObject
Properties |
---|
Ready |
Url |
Methods |
LoadFromURL |
toDataUrl |
toImageData |
Events |
OnLoad |
Properties
Ready
Determine whether image is completely loaded.
property Ready: Boolean read getReady;
Url
Specifies address (path) of loaded image.
property Url: String read getSrc write setSrc;
If URL differ from currently loaded image, LoadFromURL method will be called in order to load new image.
Methods
LoadFromURL
Start loading image from address.
procedure LoadFromURL(aURL: String);
Parameters:
aURL
- String
- Remote or local path to image.
Example:
W3Image1.LoadFromURL('http://www.mysite.com/folder/my_image.jpg');
To load image from your local resources sub-folder, write:
W3Image1.LoadFromURL('res/my_image.jpg'); // notice res/ part.
If image is successfully loaded, OnLoad event will occur. At that point is safe to do further actions with your image.
toDataUrl
Returns a string representing the canvas image (by calling datatoDataURL DOM method).
function toDataUrl: String;
Example partial output:
url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARQAAAAfCAYAAAAmwDIOAAAGyklEQVR42u2da3NURRCGD1HIhktQEiEXbhFCDBcBQQRchBgiEMArKkQ+4P//EfjGaqpP5a1TT50drGRxPjw7PWf6Nt1zpli2Cpq3b98mzqS4JDbFlvh7j/KmXL88fsqsV563P69A3...
toImageData
Returns TW3ImageData representation of Image.
function ToImageData: TW3ImageData;
TW3ImageData object provide access to the individual pixels of image.
Events
OnLoad
Occurs after image set via LoadFromURL method is fully loaded (Handle is allocated and size is set).
property OnLoad: TNotifyEvent read FOnLoad write _setOnLoad;