Design Pattern Examples
Overview of object-oriented design patterns
Flyweight_BigResource.c File Reference

Implementation of the BigResource_Clear() function and the BigResource_Render() function used to render portions of the big resource into a "display" window as used in the Flyweight Pattern. More...

#include <stdlib.h>
#include "Flyweight_BigResourceManager.h"
#include "Flyweight_BigResource.h"
Include dependency graph for Flyweight_BigResource.c:

Go to the source code of this file.

Functions

void BigResource_Clear (BigResource *resource)
 Clear the BigResource object, freeing any memory associated with it.
 
void BigResource_Render (Display *display, int bigResourceId, int offset_x, int image_width, int image_height, int position_x, int position_y)
 Render the specified portion of the big resource into the given display at the given coordinates in the display.
 

Detailed Description

Implementation of the BigResource_Clear() function and the BigResource_Render() function used to render portions of the big resource into a "display" window as used in the Flyweight Pattern.

Definition in file Flyweight_BigResource.c.

Function Documentation

◆ BigResource_Clear()

void BigResource_Clear ( BigResource resource)

Clear the BigResource object, freeing any memory associated with it.

Parameters
resourceA BitResource object to clear.

Definition at line 16 of file Flyweight_BigResource.c.

References BigResource::data.

Referenced by BigResourceList_Clear().

◆ BigResource_Render()

void BigResource_Render ( Display display,
int  bigResourceId,
int  offset_x,
int  image_width,
int  image_height,
int  position_x,
int  position_y 
)

Render the specified portion of the big resource into the given display at the given coordinates in the display.

Parameters
displayThe Display object representing the "display" window.
bigResourceIdThe handle to the big resource from which to render images.
offset_xOffset from left edge in the big resource to the left edge of the image to use.
image_widthWith of the image to render.
image_heightHeight of the image to render.
position_xHorizontal position in the display of the upper left corner of the image to render.
position_yVertical position in the display of the upper left corner of the image to render.

Definition at line 28 of file Flyweight_BigResource.c.

References Display::area, BigResourceManager_GetResource(), BigResource::data, Display::height, BigResource::numImages, and Display::width.

Referenced by _Flyweight_RenderFlyweights().