-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathGS.Pixel32.Service.Image32.pas
More file actions
95 lines (77 loc) · 1.92 KB
/
GS.Pixel32.Service.Image32.pas
File metadata and controls
95 lines (77 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//Bridge between Pixel32 and Angus Johnson's Image32 backend service.
unit GS.Pixel32.Service.Image32;
interface
uses classes,
sysutils,
GS.Geometry,
GS.Pixel32,
GS.Pixel32.Types,
GS.Pixel.Service,
GS.Stream,
GS.Pixel32.Service.Image32.Types;
Type
TPixel32CustomImage32Service = class(TPixelCustomService)
protected
furi : string;
public
Constructor Create; reintroduce;
end;
TPixel32Image32Service = Class(TPixel32CustomImage32Service)
protected
procedure InternalDecodeGetPath(data : TStream; out response : TGetPathData);
public
//RnD exemple....
procedure StarsPath(InnerRadius, OuterRadius, Edge : Uint32);
procedure Answer(content : TStream; success : boolean; report : TStream); override;
End;
implementation
{ TPixel32CustomImage32Service }
constructor TPixel32CustomImage32Service.Create;
begin
inherited create(CST_IMAGE32_URI);
furi := trim(lowercase(CST_IMAGE32_URI));
end;
{ TPixel32Image32Service }
procedure TPixel32Image32Service.InternalDecodeGetPath(data: TStream;
out response: TGetPathData);
begin
end;
procedure TPixel32Image32Service.StarsPath(InnerRadius, OuterRadius, Edge : Uint32);
const CST_LINE_OPCODE : byte = 200;
var l : TMemoryStream;
begin
l := TMemoryStream.Create;
try
// WriteBoolean(l,false); //retain mode, no bus return
WriteByte(l,CST_GETPATH_OPCODE);
WriteInteger(l,InnerRadius);
WriteInteger(l,OuterRadius);
WriteInteger(l,Edge);
Ask(l);
finally
FreeAndNil(l);
end;
end;
procedure TPixel32Image32Service.Answer(content: TStream;
success: boolean; report: TStream);
var Path : TGetPathData;
begin
if success then
begin
if content.Size>0 then
begin
//OpCode first
case ReadUint32(content) of
CST_GETPATH_OPCODE :
begin
InternalDecodeGetPath(content, path);
end;
end;
end;
end
else
begin
raise Exception.Create('TODO : DECODE REPORT ');
end;
end;
end.