Forum > BGRABitmap and LazPaint

Drawing a curved 'Arrow'

(1/3) > >>

J-G:
Now I can use the EllipseAntialias() proc. I've been looking at what other options might be available - specifically to draw just a part of the Ellipse (Circle) - something like 'from 0° to 90°' - with an arrow-head at one (specified) end. I don't see anything in the BGRA Tutorial covering 'Arrow' or for that matter 'Ellipse' so I know that isn't exhaustive but looking at the BGRADefaultBitmap Unit I noticed a reference to ArrowStart..... and ArrowEnd......  but can't see a means by which I can draw a curved arrow by specifying (say)  Center X&Y, Radius, Start(Angle), Length(Angle), LineWidth, HeadSize . . . . .  It may well be that I need to create such using primitives but that seems beyond my wit at the moment.

I'm sure that elements of BGRA.... are capable - regrettably I can't see how  :-[

paweld:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormPaint(Sender: TObject);var  bmp: TBGRABitmap;begin  bmp := TBGRABitmap.Create(ClientWidth, ClientHeight, clWhite);  bmp.ArrowStartAsTriangle();  bmp.ArrowStartSize := PointF(10, 4);  bmp.ArrowStartOffset:= 0;  bmp.Arc(160, 120, 100, 100, 0, pi/2, clBlack, 1, False, clNone);  bmp.Draw(Canvas, 0, 0);  bmp.Free;end;  

J-G:
Thanks paweld, I knew there ought to be a (fairly) simple method :)   I hadn't thought to look for 'Arc' !

I'm just acknowledging your response as I have a busy schedule for the rest of today so won't be in a position to test the solution properly 'til tomorrow at best.

winni:
Hi!

If you don't like arc you can do the same with 3 points and a spline:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);const offset = 15;       sin45= 7.01; var bmp: TBGRABitmap;     poly, spline: ArrayOfTPointF;begin  setLength(poly,3);  poly[0] := PointF(offset+60,offset);  poly[1] := PointF (offset+60-6*sin45,offset+60-6*sin45);  poly[2] := PointF (offset,offset+60);  bmp := TBGRABitmap.create (100,100,cssWhite);  bmp.ArrowStartAsTriangle();  spline := bmp.ComputeOpenedSpline(poly, ssVertexToSide);  bmp.DrawPolyLineAntialias(spline,cssRed,2);  bmp.draw(canvas,0,0);  bmp.free;end;   
Winni

J-G:
Thanks Winni but that does look somewhat more complex.  It isn't that I don't like (or dislike) ARC  - I didn't think to look for it !   

I suspect that I might find it preferable but I'll create a test project using both to determine the way forward - though not 'til tomorrow (I'm between appointments at the moment).

Navigation

[0] Message Index

[#] Next page

Go to full version