-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
zint_render_bmp.pas
63 lines (46 loc) · 1.18 KB
/
zint_render_bmp.pas
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
unit zint_render_bmp;
{
Based on Zint (done by Robin Stuart and the Zint team)
http://github.com/zint/zint
Translation by TheUnknownOnes
http://theunknownones.net
License: Apache License 2.0
}
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$ENDIF}
interface
uses
zint, zint_render_canvas, Graphics;
type
{ TZintRenderTargetBMP }
TZintRenderTargetBMP = class(TZintRenderTargetCanvas)
protected
FBitmap : TBitmap;
procedure SetBitmap(const Value: TBitmap); virtual;
procedure Inflate(const ANewWidth, ANewHeight : Single); override;
public
procedure Render(ASymbol : TZintSymbol); override;
property Bitmap : TBitmap read FBitmap write SetBitmap;
end;
implementation
{ TZintRenderTargetBMP }
procedure TZintRenderTargetBMP.Inflate(const ANewWidth, ANewHeight: Single);
begin
FBitmap.SetSize(Round(ANewWidth), Round(ANewHeight));
end;
procedure TZintRenderTargetBMP.Render(ASymbol: TZintSymbol);
begin
FCanvas := FBitmap.Canvas;
inherited;
end;
procedure TZintRenderTargetBMP.SetBitmap(const Value: TBitmap);
begin
if Assigned(Value) then
begin
FWidthDesired := Value.Width;
FHeightDesired := Value.Height
end;
FBitmap := Value;
end;
end.