- Timestamp:
- Feb 3, 2020, 12:26:46 AM (5 years ago)
- Location:
- Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Common.lpk
r540 r542 40 40 <License Value="GNU/GPL"/> 41 41 <Version Minor="7"/> 42 <Files Count="2 4">42 <Files Count="26"> 43 43 <Item1> 44 44 <Filename Value="StopWatch.pas"/> … … 147 147 <UnitName Value="UGeometric"/> 148 148 </Item24> 149 <Item25> 150 <Filename Value="UTranslator.pas"/> 151 <HasRegisterProc Value="True"/> 152 <UnitName Value="UTranslator"/> 153 </Item25> 154 <Item26> 155 <Filename Value="ULanguages.pas"/> 156 <UnitName Value="ULanguages"/> 157 </Item26> 149 158 </Files> 150 159 <i18n> -
Common/UMetaCanvas.pas
r540 r542 39 39 Brush: TBrush; 40 40 BoundingRect: TRect; 41 Rounded: TPoint; 41 42 procedure Paint(Canvas: TCanvas); override; 42 43 procedure Zoom(Factor: Double); override; … … 133 134 public 134 135 Objects: TObjectList; 136 procedure FillRect(const ARect: TRect); overload; override; 137 procedure FillRect(X1,Y1,X2,Y2: Integer); overload; 138 procedure RoundRect(X1, Y1, X2, Y2: Integer; RX,RY: Integer); overload; override; 139 procedure RoundRect(const Rect: TRect; RX,RY: Integer); overload; 135 140 procedure TextOut(X,Y: Integer; const Text: String); override; 136 141 procedure Polygon(Points: PPoint; NumPts: Integer; Winding: boolean = False); override; … … 152 157 153 158 uses 154 UGeometric ;159 UGeometric, LCLIntf; 155 160 156 161 { TCanvasPie } … … 340 345 Canvas.Pen.Assign(Pen); 341 346 Canvas.Brush.Assign(Brush); 342 Canvas.Rectangle(BoundingRect); 347 348 if Rounded <> Point(0, 0) then Canvas.RoundRect(BoundingRect, Rounded.X, Rounded.Y) 349 else Canvas.Rectangle(BoundingRect); 343 350 end; 344 351 … … 354 361 procedure TCanvasRectangle.Move(Delta: TPoint); 355 362 begin 356 ShiftRect(BoundingRect, Delta);363 BoundingRect := ShiftRect(BoundingRect, Delta); 357 364 end; 358 365 … … 361 368 Pen := TPen.Create; 362 369 Brush := TBrush.Create; 370 Rounded := Point(0, 0); 363 371 end; 364 372 … … 547 555 548 556 function TMetaCanvas.TextExtent(const Text: string): TSize; 549 begin 550 Result := Size(0, 0); 557 var 558 Canvas: TCanvas; 559 begin 560 Canvas := TCanvas.Create; 561 Canvas.Handle := CreateCompatibleDC(0); 562 Canvas.Font.Assign(Font); 563 Result := Canvas.TextExtent(Text); 564 DeleteDC(Canvas.Handle); 565 Canvas.Free; 551 566 end; 552 567 … … 560 575 DoLine(FPenPos.X, FPenPos.Y, X, Y); 561 576 DoMoveTo(X, Y); 577 end; 578 579 procedure TMetaCanvas.FillRect(const ARect: TRect); 580 begin 581 DoRectangleFill(ARect); 582 end; 583 584 procedure TMetaCanvas.FillRect(X1, Y1, X2, Y2: Integer); 585 begin 586 FillRect(Rect(X1, Y1, X2, Y2)); 587 end; 588 589 procedure TMetaCanvas.RoundRect(X1, Y1, X2, Y2: Integer; RX, RY: Integer); 590 begin 591 RoundRect(Rect(X1, Y1, X2, Y2), RX, RY); 592 end; 593 594 procedure TMetaCanvas.RoundRect(const Rect: TRect; RX, RY: Integer); 595 var 596 NewObj: TCanvasRectangle; 597 begin 598 NewObj := TCanvasRectangle.Create; 599 NewObj.Brush.Assign(Brush); 600 NewObj.Pen.Assign(Pen); 601 NewObj.BoundingRect := Rect; 602 NewObj.Rounded := Point(RX, RY); 603 Objects.Add(NewObj); 562 604 end; 563 605
Note:
See TracChangeset
for help on using the changeset viewer.