Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Draw Triangle  RSS feed

 
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The function fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) is not available in MIDP 1.0.
Could you advice me a way to implement a equivalent function in MIDP.
Thank you in advance.
OULD NADIF
 
wrangler
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can use method drawLine to draw three lines {x1, y1} to {x2, y2},
{x2, y2} to {x3, y3}, and {x3, y3} to {x1, y1}.
jim
 
Ould Nadif
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James for your reply.
It's not a triangle I wanted draw, but a triangle full.
I could've tanks to drawLine:
Example:

for (int i = 0 ; i < SizeBaseTriangle ; i++) {
iX1--;
iY1--;
iX2++;
iY2--;
gc.drawLine(iX1,iY1,iX2, iY2);
}
It works very well.
OULD NADIF
 
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!