Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
com.example.graphics.render.ConsoleRenderer Class Reference
Inheritance diagram for com.example.graphics.render.ConsoleRenderer:
Inheritance graph
Collaboration diagram for com.example.graphics.render.ConsoleRenderer:
Collaboration graph

Public Member Functions

 ConsoleRenderer (int width, int height)
void clear ()
void display ()
void renderCircle (Circle circle)
void renderLine (Line line)
void renderRectangle (Rectangle rectangle)
void renderTriangle (Triangle triangle)
Public Member Functions inherited from com.example.graphics.render.Renderer
default int getHeight ()
default int getWidth ()

Private Member Functions

void drawLine (int x1, int y1, int x2, int y2)
void drawPixel (int x, int y)

Private Attributes

char[][] canvas
final int height
final int width

Detailed Description

Console text-based implementation of the Renderer interface. Part of the Bridge pattern.

Definition at line 12 of file ConsoleRenderer.java.

Constructor & Destructor Documentation

◆ ConsoleRenderer()

com.example.graphics.render.ConsoleRenderer.ConsoleRenderer ( int width,
int height )
inline

Constructor initializes the console renderer with specified dimensions

Parameters
widththe width of the canvas
heightthe height of the canvas

Definition at line 22 of file ConsoleRenderer.java.

References clear(), height, and width.

Here is the call graph for this function:

Member Function Documentation

◆ clear()

void com.example.graphics.render.ConsoleRenderer.clear ( )
inline

Clear the rendering surface

Implements com.example.graphics.render.Renderer.

Definition at line 134 of file ConsoleRenderer.java.

References canvas, height, and width.

Referenced by ConsoleRenderer().

Here is the caller graph for this function:

◆ display()

void com.example.graphics.render.ConsoleRenderer.display ( )
inline

Display the rendered content

Implements com.example.graphics.render.Renderer.

Definition at line 144 of file ConsoleRenderer.java.

References canvas, height, and width.

◆ drawLine()

void com.example.graphics.render.ConsoleRenderer.drawLine ( int x1,
int y1,
int x2,
int y2 )
inlineprivate

Draw a line between two points

Parameters
x1the x coordinate of the first point
y1the y coordinate of the first point
x2the x coordinate of the second point
y2the y coordinate of the second point

Definition at line 188 of file ConsoleRenderer.java.

References drawPixel().

Referenced by renderTriangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawPixel()

void com.example.graphics.render.ConsoleRenderer.drawPixel ( int x,
int y )
inlineprivate

Draw a pixel at the specified coordinates

Parameters
xthe x coordinate
ythe y coordinate

Definition at line 175 of file ConsoleRenderer.java.

References canvas, and height.

Referenced by drawLine(), renderCircle(), renderLine(), and renderRectangle().

Here is the caller graph for this function:

◆ renderCircle()

void com.example.graphics.render.ConsoleRenderer.renderCircle ( Circle circle)
inline

Render a circle

Parameters
circlethe circle to render

Implements com.example.graphics.render.Renderer.

Definition at line 29 of file ConsoleRenderer.java.

References drawPixel(), com.example.graphics.model.Circle.getRadius(), com.example.graphics.model.Circle.getX(), and com.example.graphics.model.Circle.getY().

Here is the call graph for this function:

◆ renderLine()

void com.example.graphics.render.ConsoleRenderer.renderLine ( Line line)
inline

Render a line

Parameters
linethe line to render

Implements com.example.graphics.render.Renderer.

Definition at line 81 of file ConsoleRenderer.java.

References drawPixel(), com.example.graphics.model.Line.getX1(), com.example.graphics.model.Line.getX2(), com.example.graphics.model.Line.getY1(), and com.example.graphics.model.Line.getY2().

Here is the call graph for this function:

◆ renderRectangle()

void com.example.graphics.render.ConsoleRenderer.renderRectangle ( Rectangle rectangle)
inline

Render a rectangle

Parameters
rectanglethe rectangle to render

Implements com.example.graphics.render.Renderer.

Definition at line 61 of file ConsoleRenderer.java.

References drawPixel(), com.example.graphics.model.Rectangle.getHeight(), com.example.graphics.model.Rectangle.getWidth(), com.example.graphics.model.Rectangle.getX(), and com.example.graphics.model.Rectangle.getY().

Here is the call graph for this function:

◆ renderTriangle()

void com.example.graphics.render.ConsoleRenderer.renderTriangle ( Triangle triangle)
inline

Member Data Documentation

◆ canvas

char [][] com.example.graphics.render.ConsoleRenderer.canvas
private

Definition at line 15 of file ConsoleRenderer.java.

Referenced by clear(), display(), and drawPixel().

◆ height

final int com.example.graphics.render.ConsoleRenderer.height
private

Definition at line 14 of file ConsoleRenderer.java.

Referenced by ConsoleRenderer(), clear(), display(), and drawPixel().

◆ width

final int com.example.graphics.render.ConsoleRenderer.width
private

Definition at line 13 of file ConsoleRenderer.java.

Referenced by ConsoleRenderer(), clear(), and display().


The documentation for this class was generated from the following file: