Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 764
Erhaltene Danke: 127



BeitragVerfasst: Do 28.01.10 18:35 
Da gabs mal was bei den Schweizern. Hier mal ein Schnipsel:

ausblenden volle Höhe Delphi-Quelltext
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);
// http://www.swissdelphicenter.ch/de/showcode.php?id=2332 (Benjamin van Eck)
const NewPenStyle: array[1..4of DWORD = (10313);
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, 0nil);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  SetPen(Image1.Canvas, clBlack, 5, psDashDotDot);
  Image1.Canvas.MoveTo(1010);
  Image1.Canvas.LineTo(200200);
end;

ub60
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: 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."