* * *

Author Topic: Can't fill ellipse  (Read 2089 times)

molly

  • Hero Member
  • *****
  • Posts: 1806
Re: Can't fill ellipse
« Reply #15 on: May 05, 2017, 06:46:25 pm »
Did you recognize the nose ???
I did a surgical operation... now it's better I think:

Ok, so now we are even going to perform correctional surgery in our code !? Hasn't the world gone mad enough ? I like my 'birds' crooked ;-)

Code: Pascal  [Select]
  1. program chickenwings;
  2.  
  3. {$MODE OBJFPC}{$H+}
  4.  
  5. uses
  6.   Graph;
  7.  
  8. procedure Toxi(XPos, YPos: Word);
  9. const
  10.   h = 100;
  11.   w = 100;
  12. var
  13.   Hx, Hy : smallInt;
  14.   Fx, Fy : smallint;
  15.   LW : Array of PointType;
  16.   RW : Array of PointType;
  17.   Bk : Array of PointType;
  18. begin
  19.   Hx := Xpos + w div 2;
  20.   Hy := Ypos + h div 2;
  21.  
  22.   Fx := Hx;
  23.   Fy := Hy + 40;
  24.  
  25.   SetLength(LW, 3);
  26.   LW[0].x := Hx;         LW[0].y := Hy - 40;
  27.   LW[1].x := Hx - 70;    LW[1].y := Hy + 15;
  28.   LW[2].x := Hx;         LW[2].y := hy + 40;
  29.  
  30.   SetLength(RW, 3);
  31.   RW[0].x := Hx;         RW[0].y := hy - 40;
  32.   RW[1].x := Hx + 70;    RW[1].y := Hy + 10;
  33.   RW[2].x := Hx;         RW[2].y := hy + 50;
  34.  
  35.   Setlength(Bk, 3);
  36.   Bk[0].x := Hx;         Bk[0].y := hy + 25;
  37.   Bk[1].x := Hx - 17;    Bk[1].y := Hy - 5 +  2;
  38.   Bk[2].x := Hx + 17;    Bk[2].y := Hy - 5 -  2;
  39.  
  40.   // feet
  41.   setColor(yellow);
  42.   setBkColor(yellow);
  43.   setfillstyle(1, yellow);
  44.   FillEllipse(Fx - 20, Fy, w div 5, h div 6);
  45.   FillEllipse(Fx + 20, Fy, w div 5, h div 6);
  46.  
  47.   // body
  48.   setColor(black);
  49.   setBkColor(black);
  50.   setfillstyle(1, black);
  51.   FillEllipse(Hx, Hy, w div 2, h div 2);
  52.  
  53.   // wings
  54.   setColor(black);
  55.   setBkColor(black);
  56.   setfillstyle(1, black);
  57.   FillPoly(Length(LW), LW[0]);
  58.   FillPoly(Length(RW), RW[0]);
  59.  
  60.   // belly
  61.   setColor(white);
  62.   setBkColor(white);
  63.   setfillstyle(1, white);
  64.   FillEllipse(Hx, Hy + 30, w div 4, h div 7);
  65.  
  66.   // face
  67.   setColor(darkgray);
  68.   setBkColor(darkGray);
  69.   setfillstyle(1, Darkgray);
  70.   FillEllipse(Hx, Hy - 20, w div 3, h div 4);
  71.  
  72.   // eyes
  73.   setColor(white);
  74.   setBkColor(white);
  75.   setfillstyle(1, white);
  76.   FillEllipse(Hx - 10, Hy - 20, w div 8, h div 8);
  77.   FillEllipse(Hx + 15, Hy - 20, w div 10, h div 10);
  78.  
  79.   // pupils
  80.   setColor(black);
  81.   setBkColor(black);
  82.   setfillstyle(1, black);
  83.   FillEllipse(Hx - 10 + 4, Hy - 20 + 3, w div 15, h div 15);
  84.   FillEllipse(Hx + 15 - 3, Hy - 17 + 1, w div 18, h div 18);
  85.  
  86.   // beak
  87.   setColor(yellow);
  88.   setBkColor(yellow);
  89.   setfillstyle(1, yellow);
  90.   FillPoly(Length(Bk), Bk[0]);
  91. end;
  92.  
  93.  
  94. var
  95.   draiveris,x,y,r, tips: SmallInt;
  96.  
  97. begin
  98.   Draiveris:=detect;
  99.   initgraph(draiveris,tips,' ');
  100.   writeln(GetMaxX,' ',GetMaxY);
  101.  
  102.   SetBkColor(white);
  103.   ClearDevice;
  104.   Toxi(100,100);
  105.   readln;
  106.   closegraph;
  107. end.
  108.  

« Last Edit: May 05, 2017, 06:48:53 pm by molly »

RAW

  • Sr. Member
  • ****
  • Posts: 491
Re: Can't fill ellipse
« Reply #16 on: May 05, 2017, 06:52:55 pm »
Sweet... do you like Linux ?
molly killed the bird and spawned a penguin...  :D


Quote
I like my 'birds' crooked ;-)
I guess you mean "natural"...
« Last Edit: May 05, 2017, 07:04:15 pm by RAW »
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 1.8.0RC4 FPC 3.0.4

molly

  • Hero Member
  • *****
  • Posts: 1806
Re: Can't fill ellipse
« Reply #17 on: May 05, 2017, 07:05:08 pm »
Sweet... do you like Linux ?
A cryptic answer for you in return  :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus