| 1 |
{%MainUnit castleinternalcompositeimage.pas} |
| 2 |
{ |
| 3 |
Copyright 2017-2022 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{ TCompositeFormatHandler ---------------------------------------------------- } |
| 18 |
|
| 19 |
type |
| 20 |
{ Helper class to load / save particular TCompositeImage file format. } |
| 21 |
TCompositeFormatHandler = class |
| 22 |
strict private |
| 23 |
FComposite: TCompositeImage; |
| 24 |
|
| 25 |
function GetWidth: Cardinal; |
| 26 |
function GetHeight: Cardinal; |
| 27 |
function GetDepth: Cardinal; |
| 28 |
procedure SetWidth(const Value: Cardinal); |
| 29 |
procedure SetHeight(const Value: Cardinal); |
| 30 |
procedure SetDepth(const Value: Cardinal); |
| 31 |
public |
| 32 |
{ Read / write the appropriate property of |
| 33 |
the connected TCompositeImage instance. } |
| 34 |
property Width: Cardinal read GetWidth write SetWidth; |
| 35 |
property Height: Cardinal read GetHeight write SetHeight; |
| 36 |
property Depth: Cardinal read GetDepth write SetDepth; |
| 37 |
|
| 38 |
property Composite: TCompositeImage read FComposite; |
| 39 |
|
| 40 |
function Images: TEncodedImageList; |
| 41 |
|
| 42 |
constructor Create(const AComposite: TCompositeImage); |
| 43 |
procedure LoadFromStream(const Stream: TStream; const Url: String); virtual; |
| 44 |
procedure SaveToStream(const Stream: TStream); virtual; |
| 45 |
end; |
| 46 |
|
| 47 |
constructor TCompositeFormatHandler.Create(const AComposite: TCompositeImage); |
| 48 |
begin |
| 49 |
inherited Create; |
| 50 |
FComposite := AComposite; |
| 51 |
end; |
| 52 |
|
| 53 |
function TCompositeFormatHandler.GetWidth: Cardinal; |
| 54 |
begin |
| 55 |
Result := FComposite.Width; |
| 56 |
end; |
| 57 |
|
| 58 |
function TCompositeFormatHandler.GetHeight: Cardinal; |
| 59 |
begin |
| 60 |
Result := FComposite.Height; |
| 61 |
end; |
| 62 |
|
| 63 |
function TCompositeFormatHandler.GetDepth: Cardinal; |
| 64 |
begin |
| 65 |
Result := FComposite.Depth; |
| 66 |
end; |
| 67 |
|
| 68 |
procedure TCompositeFormatHandler.SetWidth(const Value: Cardinal); |
| 69 |
begin |
| 70 |
FComposite.Width := Value; |
| 71 |
end; |
| 72 |
|
| 73 |
procedure TCompositeFormatHandler.SetHeight(const Value: Cardinal); |
| 74 |
begin |
| 75 |
FComposite.Height := Value; |
| 76 |
end; |
| 77 |
|
| 78 |
function TCompositeFormatHandler.Images: TEncodedImageList; |
| 79 |
begin |
| 80 |
Result := FComposite.Images; |
| 81 |
end; |
| 82 |
|
| 83 |
procedure TCompositeFormatHandler.SetDepth(const Value: Cardinal); |
| 84 |
begin |
| 85 |
FComposite.Depth := Value; |
| 86 |
end; |
| 87 |
|
| 88 |
procedure TCompositeFormatHandler.LoadFromStream(const Stream: TStream; const Url: String); |
| 89 |
begin |
| 90 |
end; |
| 91 |
|
| 92 |
procedure TCompositeFormatHandler.SaveToStream(const Stream: TStream); |
| 93 |
begin |
| 94 |
end; |