Gooey GUI Library
Loading...
Searching...
No Matches
gooey_canvas.h File Reference

Header file for the GooeyCanvas module. More...

#include "common/gooey_common.h"

Go to the source code of this file.

Functions

GooeyCanvas * GooeyCanvas_Create (int x, int y, int width, int height)
 Adds a canvas to the specified window.
 
void GooeyCanvas_DrawRectangle (GooeyCanvas *canvas, int x, int y, int width, int height, unsigned long color_hex, bool is_filled)
 Draws a rectangle onto the user-defined canvas.
 
void GooeyCanvas_DrawLine (GooeyCanvas *canvas, int x1, int y1, int x2, int y2, unsigned long color_hex)
 Draws a line onto the user-defined canvas.
 
void GooeyCanvas_DrawArc (GooeyCanvas *canvas, int x_center, int y_center, int width, int height, int angle1, int angle2)
 Draws an arc onto the user-defined canvas.
 
void GooeyCanvas_SetForeground (GooeyCanvas *canvas, unsigned long color_hex)
 Sets the foreground color of the user-defined canvas.
 

Detailed Description

Header file for the GooeyCanvas module.

Author
Yassine Ahmed Ali

Provides functions to create and manipulate a user-defined canvas for drawing primitives such as rectangles, lines, and arcs.

Function Documentation

◆ GooeyCanvas_Create()

GooeyCanvas * GooeyCanvas_Create ( int  x,
int  y,
int  width,
int  height 
)

Adds a canvas to the specified window.

This function creates a new GooeyCanvas and attaches it to the given GooeyWindow at the specified coordinates and dimensions.

Parameters
xThe x-coordinate of the canvas position.
yThe y-coordinate of the canvas position.
widthThe width of the canvas.
heightThe height of the canvas.
Returns
A pointer to the newly created GooeyCanvas.

◆ GooeyCanvas_DrawArc()

void GooeyCanvas_DrawArc ( GooeyCanvas *  canvas,
int  x_center,
int  y_center,
int  width,
int  height,
int  angle1,
int  angle2 
)

Draws an arc onto the user-defined canvas.

The arc is drawn within the specified bounding box and between the given angles.

Parameters
canvasThe user-defined canvas.
x_centerThe x-coordinate of the arc's center.
y_centerThe y-coordinate of the arc's center.
widthThe width of the arc's bounding box.
heightThe height of the arc's bounding box.
angle1The starting angle of the arc in degrees.
angle2The ending angle of the arc in degrees.

◆ GooeyCanvas_DrawLine()

void GooeyCanvas_DrawLine ( GooeyCanvas *  canvas,
int  x1,
int  y1,
int  x2,
int  y2,
unsigned long  color_hex 
)

Draws a line onto the user-defined canvas.

Parameters
canvasThe user-defined canvas.
x1The x-coordinate of the starting point of the line.
y1The y-coordinate of the starting point of the line.
x2The x-coordinate of the ending point of the line.
y2The y-coordinate of the ending point of the line.
color_hexThe color of the line in hexadecimal format.

◆ GooeyCanvas_DrawRectangle()

void GooeyCanvas_DrawRectangle ( GooeyCanvas *  canvas,
int  x,
int  y,
int  width,
int  height,
unsigned long  color_hex,
bool  is_filled 
)

Draws a rectangle onto the user-defined canvas.

The rectangle can be either filled with a solid color or outlined.

Parameters
canvasThe user-defined canvas.
xThe x-coordinate of the rectangle's top-left corner.
yThe y-coordinate of the rectangle's top-left corner.
widthThe width of the rectangle.
heightThe height of the rectangle.
color_hexThe color of the rectangle in hexadecimal format.
is_filledIf true, the rectangle is filled with a solid color; otherwise, it is hollow.

◆ GooeyCanvas_SetForeground()

void GooeyCanvas_SetForeground ( GooeyCanvas *  canvas,
unsigned long  color_hex 
)

Sets the foreground color of the user-defined canvas.

The foreground color is used for subsequent drawing operations.

Parameters
canvasThe user-defined canvas.
color_hexThe foreground color in hexadecimal format.