C function for plotting a pixel in Linux ( like putpixel of bgi)?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
C function for plotting a pixel in Linux ( like putpixel of bgi)?
I have to develop a graphics package as part of my curriculum by implementing various algorithms.
I started of in dos using the bgi library of borland C.
I am using putpixel to plot a point on the screen.
Now i want to code in Linux, but not able to get an equivalent of putpixel in Linux.
Please suggest me the library and the function to do the same.
I am coding in C++.
There's lots of different ways to do graphics in Linux. You can either use a GUI toolkit like Qt, which you can use to open a window and draw stuff in it (as well as create buttons, menus, etc.), or you can use a more low level library like SDL, which just allows you to draw in a single window or full screen.
I don't want to develop any GUI application using Qt library.
I want a basic function to just put a pixel on the screen.
Is there a function equivalent to the putpixel function available in bgi library of borland C which takes the coordinates of the point and the color and puts it on the screen.
I basically want to use this to draw lines , circles etc using various graphics algorithms
the SDL library should do fine but you'll have to write your own pixel plotting function(quite easy - SDL gives you a pointer to the pixel data), although there are lots of addons for SDL one of which might contain a pixel plotting function.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.