Gama C Library
Gama C API Documentation
image.h File Reference
#include "../color.h"
#include "../gapi.h"
#include "../position.h"
#include "./position.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  gm3Image
 Structure representing the 2D projected output of a 3D scene. More...
struct  _gmImageDepthEntry

Functions

void gm3_image_free (gm3Image *i)
int _gm3_depth_compare (const void *a, const void *b)
int gm3_draw_image (gm3Image *img, double x, double y, double scale)
 Draws the projected 3D scene contained within a gm3Image onto the screen.

Function Documentation

◆ _gm3_depth_compare()

int _gm3_depth_compare ( const void * a,
const void * b )

◆ gm3_draw_image()

int gm3_draw_image ( gm3Image * img,
double x,
double y,
double scale )

Draws the projected 3D scene contained within a gm3Image onto the screen.

This function sorts the projected triangles by depth (Painter's Algorithm) and then calls the gapi_draw_triangles function to render them.

Parameters
imgPointer to the gm3Image containing the projected scene data.
xThe X-offset for drawing the entire image.
yThe Y-offset for drawing the entire image.
scaleThe scaling factor to apply to the projected image.
Returns
1 on successful drawing, 0 if no triangles to draw, -1 on memory allocation failure.

◆ gm3_image_free()

void gm3_image_free ( gm3Image * i)

Call this when you are completely done with the image object and want to release memory to the OS.