Skip to content
pratapppv edited this page Dec 17, 2017 · 6 revisions

Welcome to the graphics wiki! over here I intend to add the documentation for the graphics library!!

TEXT!!!!

Okay so here is the documentation for the much awaited text class. So here you must create an object of the text class, lets just call it f; so this is how you do it:
text f(128,0,128); //set r,g,b values for font colour f.cfont("Arial",20,BOLD,UNDERLINE,ITALIC); // set the font,font size and the styling f.txt(50, 50, "yolo"); //set the x and y coordinates for printing the text and the actual text to print
NOTE: The font name must be an actual font installed in your system and accessible by cmd. If not, it will end up choosing any random font or the code might not work. So do keep that in mind.

GETPIXEL

So this is the second most awaited function, getPixel which you use like this:
rgb rk = getPixel(20, 20);
so over here the getPixel function take in 2 arguments that is the x and y coordinates where you want to find the colour and then it returns a struct called rgb which as the name suggests has 3 variables that keep track of the R,G,B values.

INTERSECTION

Okay guys so this is the function that sets this library apart from all the rest of the libraries-- behold the intersect function!!!!

NOTE: works only for objects of class circle, I need to work on the other classes but oh well whatever AND ALSO YOU MUST CALL THIS GUY AFTER CALLING DRAW FUNCTION.

So as the name states, this function is a member of the circle class and checks the intersection between itself and any other circle object present in an array. So all you need to do is pass an array and the length of the array and it will tell you if the two circles are intersecting or not. It returns a boolean value, true if it intersects and false if it does not. SO this should simplify all your work......... Before I forget this is how you should use it:

Clone this wiki locally