MLV_shape.h(3)

📦
version 3.1.0 · 2 versions
, in ubuntu jammy

🌸 MLV_shape.h 🌸

okay bestie, welcome to the MLV_shape.h page 💖 this is the section 3 of the library functions manual (Library Functions Manual, iykyk), and it's literally the shape-drawing bible. Everything you need to make circles, triangles, lines and all that gorgeous geometry go brrr on your screen ✨


✨ NAME ✨

MLV_shape.h — this file (ce fichier) defines all the prototypes of the functions that let you draw shapes. That's it, that's the whole job: figures, shapes, geometry, slay 💅


✨ SYNOPSIS ✨

🦋 Fonctions 🦋

  • void MLV_draw_circle (int x, int y, int radius, MLV_Color color) — draws a circle at a position and radius you pass in the parameters, periodt.
  • void MLV_draw_filled_circle (int x, int y, int radius, MLV_Color color) — draws a filled disc (a whole solid circle, no hole) where the center and radius are handed in as parameters.
  • void MLV_draw_ellipse (int x, int y, int radius_x, int radius_y, MLV_Color color) — draws an ellipse.
  • void MLV_draw_filled_ellipse (int x, int y, int radius_x, int radius_y, MLV_Color color) — draws a filled ellipse (solid, no empty middle).
  • void MLV_draw_polygon (const int *vx, const int *vy, int nb_points, MLV_Color color) — draws a polygon from a list of vertices.
  • void MLV_draw_triangle (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color) — draws a triangle (outline only, it's empty inside bestie).
  • void MLV_draw_filled_polygon (const int *vx, const int *vy, int nb_points, MLV_Color color) — draws a filled polygon from a list of vertices.
  • void MLV_draw_filled_triangle (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color) — draws a filled triangle, solid, all the way through.
  • void MLV_draw_bezier_curve (const int *vx, const int *vy, int nb_points, MLV_Color color) — draws a Bézier curve from a list of vertices. Fancy curve energy 🎀
  • void MLV_draw_rectangle (int x, int y, int width, int height, MLV_Color color) — draws a rectangle where the size, the color and the position of the North-West corner are given in the parameters.
  • void MLV_draw_filled_rectangle (int x, int y, int width, int height, MLV_Color color) — draws a filled rectangle where the size, the color and the position of the North-West corner are given in the parameters.
  • void MLV_draw_line (int x1, int y1, int x2, int y2, MLV_Color color) — draws a line. yes queen, a straight one 🫶
  • void MLV_draw_pixel (int x, int y, MLV_Color color) — draws a pixel whose coordinates are passed in the parameters.
  • void MLV_draw_point (int x, int y, MLV_Color color) — draws a point whose coordinates are passed in the parameters. This function is identical to MLV_draw_pixel.
  • void MLV_draw_circle_on_image (int x, int y, int radius, MLV_Color color, MLV_Image *image) — draws a circle at a position and radius given in the parameters, but inside an image.
  • void MLV_draw_filled_circle_on_image (int x, int y, int radius, MLV_Color color, MLV_Image *image) — draws a filled disc where the center and radius are passed as parameters, inside an image.
  • void MLV_draw_ellipse_on_image (int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image *image) — draws an ellipse inside an image.
  • void MLV_draw_filled_ellipse_on_image (int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image *image) — draws a filled ellipse inside an image.
  • void MLV_draw_polygon_on_image (const int *vx, const int *vy, int nb_points, MLV_Color color, MLV_Image *image) — draws a polygon from a list of vertices, inside an image.
  • void MLV_draw_triangle_on_image (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color, MLV_Image *image) — draws a triangle (empty) onto an image passed in the parameters.
  • void MLV_draw_filled_polygon_on_image (const int *vx, const int *vy, int nb_points, MLV_Color color, MLV_Image *image) — draws a filled polygon from a list of vertices, inside an image.
  • void MLV_draw_filled_triangle_on_image (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color, MLV_Image *image) — draws a filled triangle onto an image passed in the parameters.
  • void MLV_draw_bezier_curve_on_image (const int *vx, const int *vy, int nb_points, MLV_Color color, MLV_Image *image) — draws a Bézier curve from a list of vertices, inside an image.
  • void MLV_draw_rectangle_on_image (int x, int y, int width, int height, MLV_Color color, MLV_Image *image) — draws a rectangle where the size, the color and the position of the North-West corner are given in the parameters, inside an image.
  • void MLV_draw_filled_rectangle_on_image (int x, int y, int width, int height, MLV_Color color, MLV_Image *image) — draws a filled rectangle where the size, the color and the position of the North-West corner are given in the parameters, inside an image.
  • void MLV_draw_line_on_image (int x1, int y1, int x2, int y2, MLV_Color color, MLV_Image *image) — draws a line inside an image.
  • void MLV_draw_pixel_on_image (int x, int y, MLV_Color color, MLV_Image *image) — draws a pixel whose coordinates are passed in the parameters, inside an image.
  • void MLV_draw_point_on_image (int x, int y, MLV_Color color, MLV_Image *image) — draws a point whose coordinates are passed in the parameters. This function is identical to MLV_draw_pixel, but inside an image.

💖 Description détaillée 💖

This file defines every single prototype of the functions that let you draw shapes. All of them. The whole roster. No gatekeeping 💅

🌟 Auteur 🌟

  • Adrien Boussicault
  • Marc Zipstein

look at them, the icons who built the shape toolkit 👑


🎀 Documentation des fonctions 🎀

🦋 void MLV_draw_bezier_curve (const int * vx, const int * vy, int nb_points, MLV_Color color) 🦋

Draws a Bézier curve from a list of vertices. It's giving smooth, it's giving elegant, it's giving math ✨

Paramètres

  • vx — the list of X coordinates of the different vertices of the curve.
  • vy — the list of Y coordinates of the different vertices of the curve.
  • nb_points — the number of vertices available for drawing the Bézier curve.
  • color — the color of the drawing (le tracé, the stroke bestie).

Exemples

  • beginner/02_shapes.c

🦋 void MLV_draw_bezier_curve_on_image (const int * vx, const int * vy, int nb_points, MLV_Color color, MLV_Image * image) 🦋

Draws a Bézier curve from a list of vertices, but this time it lands inside an image.

Paramètres

  • vx — the list of X coordinates of the different vertices of the curve.
  • vy — the list of Y coordinates of the different vertices of the curve.
  • nb_points — the number of vertices available for drawing the Bézier curve.
  • color — the color of the drawing.
  • image — the image in which the shape is drawn.

🦋 void MLV_draw_circle (int x, int y, int radius, MLV_Color color) 🦋

Draws a circle at a position and with a radius specified in the parameters. Round. Perfect. Iconic 🫶

Paramètres

  • x — the X coordinate of the center.
  • y — the Y coordinate of the center.
  • radius — the radius of the circle.
  • color — the color of the drawing.

Exemples

  • beginner/02_shapes.c, et beginner/05_mouse.c

🦋 void MLV_draw_circle_on_image (int x, int y, int radius, MLV_Color color, MLV_Image * image) 🦋

Draws a circle at a position and with a radius specified in the parameters, straight into an image.

Paramètres

  • x — the X coordinate of the center.
  • y — the Y coordinate of the center.
  • radius — the radius of the circle.
  • color — the color of the drawing.
  • image — the image in which the shape is drawn.

🦋 void MLV_draw_ellipse (int x, int y, int radius_x, int radius_y, MLV_Color color) 🦋

Draws an ellipse. A circle that woke up and chose vibes 🌸

Paramètres

  • x — the X coordinate of the center of the ellipse.
  • y — the Y coordinate of the center of the ellipse.
  • radius_x — the X radius of the ellipse.
  • radius_y — the Y radius of the ellipse.
  • color — the color of the drawing.

Exemples

  • beginner/02_shapes.c

🦋 void MLV_draw_ellipse_on_image (int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image * image) 🦋

Draws an ellipse inside an image.

Paramètres

  • x — the X coordinate of the center of the ellipse.
  • y — the Y coordinate of the center of the ellipse.
  • radius_x — the X radius of the ellipse.
  • radius_y — the Y radius of the ellipse.
  • color — the color of the drawing.
  • image — the image in which the shape is drawn.

🦋 void MLV_draw_filled_circle (int x, int y, int radius, MLV_Color color) 🦋

Draws a filled disc where the center and the radius are passed in the parameters. Solid. Chunky. No hollow middle, no crumbs 💖

Paramètres

  • x — the X coordinate of the center.
  • y — the Y coordinate of the center.
  • radius — the radius of the circle.
  • color — the color of the drawing.

Exemples

  • beginner/02_shapes.c

🦋 void MLV_draw_filled_circle_on_image (int x, int y, int radius, MLV_Color color, MLV_Image * image) 🦋

Draws a filled disc where the center and the radius are passed as parameters, and it goes inside an image.

Paramètres

  • x — the X coordinate of the center.
  • y — the Y coordinate of the center.
  • radius — the radius of the circle.
  • color — the color of the drawing.
  • image — the image in which the shape is drawn.

🦋 void MLV_draw_filled_ellipse (int x, int y, int radius_x, int radius_y, MLV_Color color) 🦋

Draws a filled ellipse. All the ellipse, none of the emptiness 🔥

Paramètres

  • x — the X coordinate of the center of the ellipse.
  • y — the Y coordinate of the center of the ellipse.
  • radius_x — the X radius of the ellipse.
  • radius_y — the Y radius of the ellipse.
  • color — the color of the drawing.

Exemples

  • beginner/02_shapes.c

🦋 void MLV_draw_filled_ellipse_on_image (int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image * image) 🦋

Draws a filled ellipse inside an image.

Paramètres

  • x — the X coordinate of the center of the ellipse.
  • y — the Y coordinate of the center of the ellipse.
  • radius_x — the X radius of the ellipse.
  • radius_y — the Y radius of the ellipse.
  • color — the color of the drawing.
  • image — the image in which the shape is drawn.

🦋 void MLV_draw_filled_polygon (const int * vx, const int * vy, int nb_points, MLV_Color color) 🦋

Draws a filled polygon from a list of vertices.

Paramètres

  • vx — the list of X coordinates of the different vertices of the polygon.
  • vy — the list of Y coordinates of the different vertices of the polygon.
  • nb_points — the number of vertices of the polygon.
  • color — the color of the drawing.

Exemples

  • beginner/02_shapes.c

🦋 void MLV_draw_filled_polygon_on_image (const int * vx, const int * vy, int nb_points, MLV_Color color, MLV_Image * image) 🦋

Draws a filled polygon from a list of vertices, inside an image.


to be continued bestie, part 2 is coming 💜

🎀 Paramètres

  • vx — la liste des coordonnées en X des différents sommets du polygone (all the x-coords of the polygon's vertices).
  • vy — la liste des coordonnées en Y des différents sommets du polygone.
  • nb_points — le nombre de sommets du polygone, aka how many points you're actually passing.
  • color — la couleur du tracé, the color it gets drawn in.
  • image — l'image dans laquelle la figure est dessinée, the image the shape lands in.

and then — not me 😭 — the doc lists the exact same five parameters a second time. Like, the identical list, again. So here it is again, because nothing gets skipped on my watch 💅:

  • vx — la liste des coordonnées en X des différents sommets du polygone.
  • vy — la liste des coordonnées en Y des différents sommets du polygone.
  • nb_points — le nombre de sommets du polygone.
  • color — la couleur du tracé.
  • image — l'image dans laquelle la figure est dessinée

🌸 void MLV_draw_filled_rectangle (int x, int y, int width, int height, MLV_Color color)

Draws a filled rectangle, and you hand it the size, the color, and where the North-West corner (sommet Nord-Ouest) goes. full rectangle, all filled in, no hollow vibes ✨

💖 Paramètres

  • x — la coordonnée en X du sommet Nord-Ouest du rectangle (x of the NW corner).
  • y — la coordonnée en Y du sommet Nord-Ouest du rectangle.
  • width — la largeur du rectangle (width).
  • height — la hauteur du rectangle (height).
  • color — la couleur du tracé.

🦋 Exemples

advanced/09_animation.c, beginner/02_shapes.c, beginner/09_colors.c, medium/06_colors.c, et medium/09_keyboard_accents.c.


🌸 void MLV_draw_filled_rectangle_on_image (int x, int y, int width, int height, MLV_Color color, MLV_Image * image)

Same filled-rectangle deal, same size/color/North-West-corner params — except it draws into an image. 🖼️

💖 Paramètres

  • x — la coordonnée en X du sommet Nord-Ouest du rectangle.
  • y — la coordonnée en Y du sommet Nord-Ouest du rectangle.
  • width — la largeur du rectangle.
  • height — la hauteur du rectangle.
  • color — la couleur du rectangle.
  • image — l'image dans laquelle la figure est dessinée.

🦋 Exemples

advanced/08_zone_click.c.


🌸 void MLV_draw_filled_triangle (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color)

Draws a filled triangle. Three points, all the way filled. 🔺

ngl the original doc spells it "traingle" like four times and I am obsessed, it's giving typo royalty 👑 keeping the energy, but yes bestie — it's a triangle.

💖 Paramètres

  • ax — la coordonnée en X du premier point du triangle.
  • ay — la coordonnée en Y dy premier point du traingle.
  • bx — la coordonnée en X du deuxième point du triangle.
  • by — la coordonnée en Y dy deuxième point du traingle.
  • cx — la coordonnée en X du troisième point du triangle.
  • cy — la coordonnée en Y dy troisième point du traingle.
  • color — la couleur du triangle.

🦋 Exemples

beginner/02_shapes.c.


🌸 void MLV_draw_filled_triangle_on_image (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color, MLV_Image * image)

Filled triangle, but it gets drawn onto an image you pass in. 🎨

💖 Paramètres

  • ax — la coordonnée en X du premier point du triangle.
  • ay — la coordonnée en Y dy premier point du traingle.
  • bx — la coordonnée en X du deuxième point du triangle.
  • by — la coordonnée en Y dy deuxième point du traingle.
  • cx — la coordonnée en X du troisième point du triangle.
  • cy — la coordonnée en Y dy troisième point du traingle.
  • color — la couleur du triangle.
  • image — l'image dans laquelle la figure est dessinée.

🌸 void MLV_draw_line (int x1, int y1, int x2, int y2, MLV_Color color)

Draws a line. Two ends, one color, that's the whole vibe. 📏

💖 Paramètres

  • x1 — la coordonnée en X de la première extrémité de la ligne (first end).
  • y1 — la coordonnée en Y de la première extrémité de la ligne.
  • x2 — la coordonnée en X de la deuxième extrémité de la ligne (second end).
  • y2 — la coordonnée en Y de la deuxième extrémité de la ligne.
  • color — la couleur du tracé.

🦋 Exemples

advanced/01_texts_and_boxes.c, beginner/02_shapes.c, et medium/06_colors.c.


🌸 void MLV_draw_line_on_image (int x1, int y1, int x2, int y2, MLV_Color color, MLV_Image * image)

Draws a line into an image. Same two ends, same color, but on your image instead of the window. 🖌️

💖 Paramètres

  • x1 — la coordonnée en X de la première extrémité de la ligne.
  • y1 — la coordonnée en Y de la première extrémité de la ligne.
  • x2 — la coordonnée en X de la deuxième extrémité de la ligne.
  • y2 — la coordonnée en Y de la deuxième extrémité de la ligne.
  • color — la couleur du tracé.
  • image — l'image dans laquelle la figure est dessinée.

🌸 void MLV_draw_pixel (int x, int y, MLV_Color color)

Draws a single pixel at the coordinates you pass in. One pixel. That's it. That's the whole function. micro-scale main character energy ⭐

💖 Paramètres

  • x — la coordonnée en X du pixel.
  • y — la coordonnée en Y du pixel.
  • color — la couleur du tracé.

🌸 void MLV_draw_pixel_on_image (int x, int y, MLV_Color color, MLV_Image * image)

Same single-pixel moment, except the coordinates you pass in are drawn into an image. 🫶

💖 Paramètres

  • x — Coordonnée en X du pixel
  • y — Coordonnée en Y du pixel
  • color — Couleur du tracé
  • image — image dans laquelle la figure est dessinée

🌸 void MLV_draw_point (int x, int y, MLV_Color color)

Draws a point at the coordinates you pass in. And fr fr: cette fonction est identique à MLV_draw_pixel — it's literally the same function. Same behavior, different name, no cap. 💀

💖 Paramètres

  • x — La coordonnée en X du point.
  • y — La coordonnée en Y du point.
  • color — La couleur du tracé.

🦋 Exemples

beginner/02_shapes.c, et medium/06_colors.c.


🌸 void MLV_draw_point_on_image (int x, int y, MLV_Color color, MLV_Image * image)

Draws a point at the coordinates you pass in. Cette fonction est identique à MLV_draw_pixel dans une image — yep, the image version is the same twin situation. 🪞

💖 Paramètres

  • x — La coordonnée en X du point.
  • y — La coordonnée en Y du point.
  • color — La couleur du tracé.
  • image — L'image dans laquelle la figure est dessinée.

🌸 void MLV_draw_polygon (const int * vx, const int * vy, int nb_points, MLV_Color color)

Draws a polygon from a list of vertices. You bring the vertex list, it brings the shape. 🔷

💖 Paramètres

  • vx — La liste des coordonnées en X des différents sommets du polygone.
  • vy — La liste des coordonnées en Y des différents sommets du polygone.
  • nb_points — Le nombre de sommets du polygone.
  • color — La couleur du tracé.

🦋 Exemples

beginner/02_shapes.c.


🌸 void MLV_draw_polygon_on_image (const int * vx, const int * vy, int nb_points, MLV_Color color, MLV_Image * image)

Draws a polygon from a list of vertices, but inside an image. ✨

💖 Paramètres

  • vx — La liste des coordonnées en X des différents sommets du polygone.
  • vy — La liste des coordonnées en Y des différents sommets du polygone.
  • nb_points — Le nombre de sommets du polygone.
  • color — La couleur du tracé.
  • image — L'image dans laquelle la figure est dessinée.

🌸 void MLV_draw_rectangle (int x, int y, int width, int height, MLV_Color color)

Draws a rectangle — you give it the size, the color, and the position of the North-West corner. (This one's not the filled version, jsyk 👀)

💖 Paramètres

  • x — La coordonnée en X du sommet Nord-Ouest du rectangle.
  • y — La coordonnée en Y du sommet Nord-Ouest du rectangle.
  • width — La largeur du rectangle.
  • height — La hauteur du rectangle.
  • color — La couleur du tracé.

🦋 Exemples

beginner/02_shapes.c, et medium/08_full_screen.c.


🌸 void MLV_draw_rectangle_on_image (int x, int y, int width, int height, MLV_Color color, MLV_Image * image)

Draws a rectangle with the size, color and North-West corner position you pass in, inside an image. 🖼️

💖 Paramètres

  • x — La coordonnée en X du sommet Nord-Ouest du rectangle.
  • y — La coordonnée en Y du sommet Nord-Ouest du rectangle.
  • width — La largeur du rectangle.
  • height — La hauteur du rectangle.
  • color — La couleur du rectangle.
  • image — L'image dans laquelle la figure est dessinée .

and — once again, for the people in the back — the doc repeats the whole list right after. Not me double-checking, the source really did that 🙈 so here's round two:

  • x — La coordonnée en X du sommet Nord-Ouest du rectangle.
  • y — La coordonnée en Y du sommet Nord-Ouest du rectangle.
  • width — La largeur du rectangle.
  • height — La hauteur du rectangle.
  • color — La couleur du rectangle.
  • image — L'image dans laquelle la figure est dessinée.

🌸 void MLV_draw_triangle (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color)

Draws a triangle (vide) — empty/hollow, bestie, not filled. Don't get it twisted with MLV_draw_filled_triangle. 🔺

💖 Paramètres

  • ax — La coordonnée en X du premier point du triangle.
  • ay — La coordonnée en Y dy premier point du traingle.
  • bx — La coordonnée en X du deuxième point du triangle.
  • by — La coordonnée en Y dy deuxième point du traingle.
  • cx — La coordonnée en X du troisième point du triangle.
  • cy — La coordonnée en Y dy troisième point du traingle.
  • color — La couleur du triangle.

🦋 Exemples

beginner/02_shapes.c.


🌸 void MLV_draw_triangle_on_image (int ax, int ay, int bx, int by, int cx, int cy, MLV_Color color, MLV_Image * image)

Draws a triangle (vide) — hollow, remember — onto an image you pass in. 🧚

💖 Paramètres

  • ax — La coordonnée en X du premier point du triangle.
  • ay — La coordonnée en Y dy premier point du traingle.
  • bx — La coordonnée en X du deuxième point du triangle.
  • by — La coordonnée en Y dy deuxième point du traingle.
  • cx — La coordonnée en X du troisième point du triangle.
  • cy — La coordonnée en Y dy troisième point du traingle.
  • color — La couleur du triangle.
  • image — L'image dans laquelle la figure est dessinée.

👑 Auteur

Généré automatiquement par Doxygen pour MLV-3.1.0 à partir du code source. (so yeah, a robot wrote this page and I just gave it a glow-up 💅✨)


and that's the whole page bestie!! 🫶 every last flag, param, example and path, all accounted for, nothing skipped, periodt. this one came from MLV-3.1.0, dated Samedi 29 Janvier 2022, and it's page MLV_shape.h(3) in the manual. go draw some shapes, you absolute icon 🌈💖
📦 where this page comes from