类 ConsoleRenderer

java.lang.Object
com.example.graphics.render.ConsoleRenderer
所有已实现的接口:
Renderer

public class ConsoleRenderer extends Object implements Renderer
Console text-based implementation of the Renderer interface. Part of the Bridge pattern.
  • 字段详细资料

    • width

      private final int width
    • height

      private final int height
    • canvas

      private char[][] canvas
  • 构造器详细资料

    • ConsoleRenderer

      public ConsoleRenderer(int width, int height)
      Constructor initializes the console renderer with specified dimensions
      参数:
      width - the width of the canvas
      height - the height of the canvas
  • 方法详细资料

    • renderCircle

      public void renderCircle(Circle circle)
      从接口复制的说明: Renderer
      Render a circle
      指定者:
      renderCircle 在接口中 Renderer
      参数:
      circle - the circle to render
    • renderRectangle

      public void renderRectangle(Rectangle rectangle)
      从接口复制的说明: Renderer
      Render a rectangle
      指定者:
      renderRectangle 在接口中 Renderer
      参数:
      rectangle - the rectangle to render
    • renderLine

      public void renderLine(Line line)
      从接口复制的说明: Renderer
      Render a line
      指定者:
      renderLine 在接口中 Renderer
      参数:
      line - the line to render
    • renderTriangle

      public void renderTriangle(Triangle triangle)
      从接口复制的说明: Renderer
      Render a triangle
      指定者:
      renderTriangle 在接口中 Renderer
      参数:
      triangle - the triangle to render
    • clear

      public void clear()
      从接口复制的说明: Renderer
      Clear the rendering surface
      指定者:
      clear 在接口中 Renderer
    • display

      public void display()
      从接口复制的说明: Renderer
      Display the rendered content
      指定者:
      display 在接口中 Renderer
    • drawPixel

      private void drawPixel(int x, int y)
      Draw a pixel at the specified coordinates
      参数:
      x - the x coordinate
      y - the y coordinate
    • drawLine

      private void drawLine(int x1, int y1, int x2, int y2)
      Draw a line between two points
      参数:
      x1 - the x coordinate of the first point
      y1 - the y coordinate of the first point
      x2 - the x coordinate of the second point
      y2 - the y coordinate of the second point