Skip to content

dtl::shape::Rect

Kasugaccho edited this page Aug 17, 2019 · 22 revisions

Select Language ๐ŸŒ

English ๐Ÿ‡ฌ๐Ÿ‡ง / ๆ—ฅๆœฌ่ชž ๐Ÿ‡ฏ๐Ÿ‡ต


DTL Version 0.4.0.0-

<DTL/Shape/Rect.hpp>

namespace dtl::shape {
  template <typename T>
  class Rect;
}
  • T is 1 bit or more.

Support

Name Support
Non Rectangular Matrix Trueโœ…

Overview

Rect is a class that sets drawing values in the drawing range of Matrix.

Fill the entire drawing area.

Member Functions

drawing

Name Description Minimum Version
draw Draw on Matrix. v0.4.0
drawArray Draw on Matrix. v0.4.0
drawAdd Draw on Matrix. v0.4.12
create Draw on Matrix. v0.4.0
createArray Draw on Matrix. v0.4.0

Get drawing range / Get drawing value

Name Description Minimum Version
getPointX Gets the drawing start point coordinate X. v0.4.0
getPointY Gets the drawing start point coordinate Y. v0.4.0
getWidth Gets the drawing width. v0.4.0
getHeight Gets the drawing height. v0.4.0
getValue Gets the drawing value. v0.4.0

Set drawing range / Set drawing value

Name Description Minimum Version
setPointX Set the drawing start point coordinate X. v0.4.0
setPointY Set the drawing start point coordinate Y. v0.4.0
setWidth Set the drawing width. v0.4.0
setHeight Set the drawing height. v0.4.0
setPoint Set the drawing start point coordinates (X, Y). v0.4.0
setRange Set the drawing range (X, Y, W, H). v0.4.0
setValue Set the drawing value. v0.4.0

Clear drawing range / Clear drawing value

Name Description Minimum Version
clearPointX Resets the drawing start coordinate X to the initial value (deletes the drawing start coordinate X). v0.4.0
clearPointY Resets the drawing start coordinate Y to the initial value (deletes the drawing start coordinate Y). v0.4.0
clearWidth Resets the width of the range (X axis direction) to the initial value (deletes the drawing width). v0.4.0
clearHeight Resets the height of the range (Y axis direction) to the initial value (deletes the drawing height). v0.4.0
clearPoint Resets the drawing start coordinate (X, Y) to the initial value (deletes the drawing start coordinate (X, Y)). v0.4.0
clearRange Resets the drawing range to the initial value (deletes the drawing range (X, Y, W, H)). v0.4.0
clearValue Resets the drawing value to the initial value (deletes the drawing value). v0.4.0

Constructor

Parent class: <DTL/Range/RectBaseWithValue.hpp>

dtl::shape::Rect<shape_t>(draw_value).draw(matrix, width, height);

draw_value

Rect

Example (C++11)

#include <DTL.hpp>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	std::array<std::array<shape_t, 16>, 12> matrix{ {} };

	dtl::shape::Rect<shape_t>(1).draw(matrix);

	dtl::console::OutputNumber<shape_t>(",").draw(matrix);
	dtl::console::OutputString<shape_t>("//", "##").draw(matrix);

	return 0;
}

Output

1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################

Image

di

Related Item

dtl::utility::Init

Clone this wiki locally