Autor |
Beitrag |
Martok
      
Beiträge: 3661
Erhaltene Danke: 604
Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
|
Verfasst: Do 28.01.10 13:46
Hi!
Ich hätte da mal wieder ein Problem
Normalerweise kann man mit einem Pen (in GDI) ja die verschiedenen Line-Styles nur nutzen wenn man genau 1px Breite einstellt... sonst wirds eine Vollinie.
Wie könnte man trotzdem breitere Linien mit Style zeichnen? Irgendwie wird man das sicher von Hand zeichnen müssen, was gibts da so an schnellen Varianten?
Danke schonmal,
Martok
_________________ "The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
|
|
BenBE
      
Beiträge: 8721
Erhaltene Danke: 191
Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
|
Verfasst: Do 28.01.10 14:14
Such mal nach LineDDA, da solltest du fündig werden. Im zugehörigen Callback dann einfach mehr als einen Pixel gleichzeitig setzen ...
_________________ Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
|
|
ub60
      
Beiträge: 764
Erhaltene Danke: 127
|
Verfasst: Do 28.01.10 18:35
Da gabs mal was bei den Schweizern. Hier mal ein Schnipsel:
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:
| procedure TForm1.Button1Click(Sender: TObject); const NewPenStyle: array[1..4] of DWORD = (10, 3, 1, 3); var logBrush: TLogBrush; begin logBrush.lbStyle := BS_SOLID; logBrush.lbColor := Canvas.Pen.Color; Image1.Canvas.Pen.Handle := ExtCreatePen(PS_GEOMETRIC or PS_USERSTYLE, Image1.Canvas.Pen.Width, logBrush, Length(NewPenStyle), @NewPenStyle); with Image1.Canvas do begin MoveTo(10,10); LineTo(200,10); LineTo(10,200); end; end;
const SquarePenStyle = PS_GEOMETRIC or PS_ENDCAP_SQUARE or PS_JOIN_BEVEL;
procedure SetPen(Canvas: TCanvas; Color: TColor; Width: Integer; Style: TPenStyle); var LogBrush: TLogBrush; begin ZeroMemory(@LogBrush, SizeOf(LogBrush)); LogBrush.lbColor := ColorToRGB(Color); LogBrush.lbHatch := 0; Canvas.Pen.Handle := ExtCreatePen(SquarePenStyle or Ord(Style), Width, LogBrush, 0, nil); end;
procedure TForm1.Button2Click(Sender: TObject); begin SetPen(Image1.Canvas, clBlack, 5, psDashDotDot); Image1.Canvas.MoveTo(10, 10); Image1.Canvas.LineTo(200, 200); end; |
ub60
|
|
Martok 
      
Beiträge: 3661
Erhaltene Danke: 604
Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
|
Verfasst: Do 28.01.10 19:52
Das ist ja toll, der Teil zum Button2Click ist genau das was ich suche.
Danke!
_________________ "The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
|
|
|