How to use borland C for drawing

  • Thread starter freedom927
  • Start date
  • Tags
    Drawing
In summary, the conversation discusses using Borland C to construct a finite elements L-shape structure and color it. The suggestion is to use graphics.h or Opengl with Glut or SDL libraries, or to code it in Matlab or Maple for testing. It is mentioned that there may be open source libraries available for vector and matrix structs.
  • #1
freedom927
2
0
hello, i would like ask something about the borland C. The question is how to use borland C to construct a finite elements L-shape structure in borland C:confused: ? And how to colour the structure by using borland C:confused: ?
Help, this urgent...:cry:
Thanks.
 
Technology news on Phys.org
  • #2
i don't think borland has imbedded grpahics libraries...

You could always try to find good old graphics.h (with its other libraries)
though Opengl with{Glut or SDL,the rendering windows} is open source.
Personally I prefer Opengl/sdl but with glut its pretty easy to learn.

With finite elements- I assume you also need to code some vector/matrix structs. Not sure if there are any open source libraries for those, but numerical recipes( nr.com) has its libraries for use.
If in doubt code it in Matlab/Maple
 
  • #3


Hello,

Thank you for reaching out with your question about using Borland C for drawing. I am happy to assist you.

To construct a finite elements L-shape structure in Borland C, you will need to use the graphics.h library. This library contains functions for drawing basic shapes such as lines, rectangles, and circles. You can use these functions to construct the L-shape structure by specifying the coordinates of each point and connecting them with lines.

To color the structure, you can use the setcolor() function from the graphics.h library. This function allows you to specify a color code or name to fill in the shape with. You can also use the setfillstyle() function to specify a pattern or texture for the color.

Here is an example code for constructing a simple L-shape structure and coloring it red:

#include <graphics.h> // include graphics.h library

int main()
{
int gd = DETECT, gm; // initialize graphics driver and mode
initgraph(&gd, &gm, ""); // initialize graphics mode

// draw L-shape structure using line function
line(100, 100, 100, 200); // line from (100,100) to (100,200)
line(100, 200, 200, 200); // line from (100,200) to (200,200)

// color the structure red
setcolor(RED); // set color to red
setfillstyle(SOLID_FILL, RED); // set fill style to solid with red color
floodfill(101, 101, RED); // fill the structure with red color

getch(); // wait for user input
closegraph(); // close graphics mode
return 0;
}

I hope this helps you with your project. If you have any further questions, please feel free to ask. Best of luck!
 

1. How do I start drawing with Borland C?

To start drawing with Borland C, you need to open the graphics library by including the graphics.h header file in your program. Then, you can use the various graphics functions provided by the library to draw shapes and images on the screen.

2. What are some basic drawing functions in Borland C?

Some basic drawing functions in Borland C include line(), rectangle(), circle(), ellipse(), arc(), floodfill(), and putpixel(). These functions can be used to draw simple shapes and fill them with colors.

3. How can I change the color and thickness of the lines in Borland C?

You can change the color and thickness of lines in Borland C by using the setcolor() and setlinestyle() functions. The setcolor() function takes an integer as an argument, which corresponds to a specific color. The setlinestyle() function allows you to change the thickness and pattern of the lines drawn.

4. Can I draw images and text in Borland C?

Yes, you can draw images and text in Borland C. The library provides functions such as putimage() and outtextxy() to draw images and text on the screen. You can also use functions like readimage() and writeimage() to load and save images from/to files.

5. How can I create animations using Borland C?

To create animations using Borland C, you can use a combination of graphics functions and programming techniques. You can use functions like delay() to create a delay between frames, and then use a loop to draw each frame of the animation. You can also use user input or random numbers to create dynamic animations.

Similar threads

Replies
9
Views
1K
  • Programming and Computer Science
Replies
3
Views
5K
  • Programming and Computer Science
Replies
3
Views
26K
Replies
2
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
8
Views
856
  • Programming and Computer Science
Replies
2
Views
930
  • Programming and Computer Science
Replies
22
Views
2K
  • Programming and Computer Science
Replies
1
Views
726
  • Programming and Computer Science
Replies
16
Views
2K
Back
Top