- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
var
DPen: TGPPen;
Drawer: TGPGraphics;
DBrush: TGPSolidBrush;
DFntFam: TGPFontFamily;
DPath: TGPGraphicsPath;
IC,BC:Integer;
ICL, BCL:TGPColor;
W:WideString;
si:TGPRectF;
rt:TGPRectF;
GP:TGPPoint;
begin
W:=FWaterMark.Text;
IC:=ColortoRGB(FWaterMark.Font.Color);
BC:=ColorToRGB(FWaterMark.CircuitColor);
ICl:=MakeColor(GetRValue(IC), GetGValue(IC), GetBValue(IC));
BCL:=MakeColor(GetRValue(BC), GetGValue(BC), GetBValue(BC));
Drawer:=TGPGraphics.Create(FBitMap.Canvas.Handle);
Drawer.SetCompositingQuality(CompositingQualityHighQuality);
Drawer.SetSmoothingMode(SmoothingModeAntiAlias);
Drawer.SetTextRenderingHint(TextRenderingHintAntiAlias);
DPath:=TGPGraphicsPath.Create;
DPen:=TGPPen.Create(BCL, FWaterMark.FCircuitWidth);
DBrush:=TGPSolidBrush.Create(ICL);
DFntFam:=TGPFontFamily.Create(FWaterMark.Font.Name);
RT.X:=0;
RT.Y:=0;
RT.Width:=FBitMap.Width;
RT.Height:=FBitMap.Height;
DPath.AddString(W, Length(W), DFntFam, FontStyleBold, FWaterMark.Font.Size, GP, TGPStringFormat.Create());
DPath.GetBounds(RT, nil, DPen);
DPath.Reset;
//В общем, хз, как узнать ширину и высоту нарисованного.
//MeasureString/MeasureCharacterRanges не подходят,а в доке такая муть, что я чуть не спился.