I see that in examples there are many cases:
Image := TDrawableImage.Create('castle-data:/my_image.png');
But I need to load the image from TStream.
For example, from from TStringStream or TMemoryStream.
How can I do it effectively?
I see that TDrawableImage has Load method.
procedure **Load** (const AImage: [TEncodedImage](https://castle-engine.io/apidoc-unstable/html/CastleImages.TEncodedImage.html)); virtual;
Then there is the note:
Do not call this method too often. This methos copies the image contents from TEncodedImage to GPU, which is not something you want to do every frame. Doing this occasionally, or during the loading/preparation stage, is OK. Doing this often, e.g. during every TCastleWindowBase.OnRender or TCastleWindowBase.OnUpdate, will hurt your performance. During the game, it’s most efficient to treat the TDrawableImage instances as “constant” – avoid changing their contents, avoid creating new ones.
Another question:
For example, I have TBitmap. How can I load it effectively to TDrawableImage?
In CastleImages unit I found:
function LoadEncodedImage(Stream: TStream; const MimeType: string;
const AllowedImageClasses: array of TEncodedImageClass;
const Options: TLoadImageOptions = )
Thus probably it should be used somehow?