ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Bezier curves
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
234 Posts

Posted - Oct 22 2013 :  02:23:02  Show Profile  Reply
Hi

Although I'm trying to do this using ImageEN it's more a generals graphics problem and more a plea for help!

I have a weather chart resplendent with all the isobars and on top of this I would like to draw weather fronts. I've seen the Painter demo and how you can draw polygon lines with it. What I would like to do is to pick a series of points to mark out a front and instead of straight lines joining the points up, I would like to produce a nice smooth Bezier curve. I have just started to trawl the internet for information on how to do this, and have already checked the ImageEN help on the subject but didn't find much.

Any help would be much appreciated.

Bruce.

w2m

USA
1990 Posts

Posted - Oct 22 2013 :  05:44:35  Show Profile  Reply
You might try using IEGDIPlus.pas.

It has quite a few ways to draw curves.
procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
procedure Polyline(Points: array of TPoint);

Here is how to use it:
procedure TForm1.Button2Click(Sender: TObject);
var
  iIECanvas: TIECanvas;
  iBrushWidth: integer;
  iBrushColor: TColor;
  iBrushAlpha: integer;
  iPoints: array of TPoint;
begin
  iIECanvas := TIECanvas.Create(ImageEnView1.Layers[ImageEnView1.LayersCurrent]
    .Bitmap.Canvas, AntiAlias1.Checked, UseGDIPlus1.Checked);
  iBrushWidth := StrToInt(BrushSize1.Text);
  iBrushColor := BrushColor1.Selected;
  iBrushAlpha := StrToInt(BrushAlpha1.Text);
  iIECanvas.Pen.Style := psSolid;
  iIECanvas.Brush.Color := iBrushcolor;
  iIECanvas.Brush.Style := bsClear;
  iIECanvas.Brush.Transparency := iBrushAlpha;
  iIECanvas.Brush.BackTransparency := iBrushAlpha;
  SetLength(iPoints, 5);
  iPoints[0] := Point(0, 0);
  iPoints[1] := Point(50, 75);
  iPoints[2] := Point(75, 50);
  iPoints[3] := Point(25, 70);
  iPoints[4] := Point(0, 0);
  iIECanvas.Polyline(iPoints);
  iIECanvas.Free();
end;

You can also draw on the alpha channel.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

bmesser

United Kingdom
234 Posts

Posted - Oct 22 2013 :  07:35:26  Show Profile  Reply
Thanks Bill - I'll have a look and let you know.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: