Skip to content

dtl::XX::YY::clearRange (形状描画)

Kasugaccho edited this page Aug 13, 2019 · 2 revisions

Select Language 🌐

English 🇬🇧 / 日本語 🇯🇵


constexpr auto clearRange() noexcept;

概要

描画範囲(X,Y,W,H)を消去する。

戻り値

戻り値の型は全てにおいて 当クラスの参照値 である。

例外

投げない

計算量

定数時間

#include <DTL.hpp>
#include <iostream>
#include <cstddef>
#include <cstdint>

int main() {

	using shape_t = std::uint_fast8_t;
	constexpr std::size_t width{ 16 };
	constexpr std::size_t height{ 8 };

	shape_t matrix[height * width]{};

	dtl::shape::Border<shape_t> border(1);

	border.setRange(2, 1, 8, 5);
	border.clearRange().drawArray(matrix, width, height);

	std::cout << "PointX:" << border.getPointX() << '\n';
	std::cout << "PointY:" << border.getPointY() << '\n';
	std::cout << "Width:" << border.getWidth() << '\n';
	std::cout << "Height:" << border.getHeight() << '\n';

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

	return 0;
}

出力

PointX:0
PointY:0
Width:0
Height:0
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
################################
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
################################
Clone this wiki locally