# core/component/outline (vanilla.js 0.4.0)

> https://vanillapunch.com/docs/vanilla.js/0.4.0/api/core/component/outline/

테만 그리는 컴포넌트. (둥근 네모 테 또는 동그라미 테)

## Outline extends Component

테만 그리는 컴포넌트. (둥근 네모 테 또는 동그라미 테)
- Paint 는 속을 채우기만 하므로, 비치는 판 위에 테를 따로 얹을 때 쓴다. (채운 판 두 장을 겹치면 비치는 속에 바깥 색이 섞인다)
- 둥근 네모 테는 노드의 내용 크기 그대로, 동그라미 테는 그 가운데에 짧은 변의 반을 반지름으로 그린다.
- 선은 내용 크기 안쪽에 들어온다. (선의 가운데가 굵기의 반만큼 안쪽)

예제: 비치는 판 위에 테 얹기

```js
import { Engine, EngineConfiguration, Scene, Vector2, WorldNode, Paint, Outline } from "./build/vanilla.js";

class MainScene extends Scene {
	async load(engine) {
		await super.load(engine);
		const root = this.getRoot();
		const panelNode = new WorldNode();
		panelNode.setContentSize(Vector2.create(240, 140));
		panelNode.setLocalPosition(Vector2.create(200, 180));
		const paint = panelNode.addComponent(Paint);
		paint.setColor("rgba(0, 0, 0, 0.5)");
		paint.setRoundSize(20);
		const outline = panelNode.addComponent(Outline);
		outline.setColor("#ffffff");
		outline.setLineWidth(4);
		outline.setRoundSize(20);
		root.addChild(panelNode);

		const ringNode = new WorldNode();
		ringNode.setContentSize(Vector2.create(100, 100));
		ringNode.setLocalPosition(Vector2.create(480, 180));
		const ring = ringNode.addComponent(Outline);
		ring.setColor("#ffcc00");
		ring.setLineWidth(6);
		ring.setCircle(true);
		root.addChild(ringNode);
	}
}

const engineConfiguration = new EngineConfiguration();
engineConfiguration.referenceResolutionSize = Vector2.create(640, 360);
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
```

- `constructor()` (constructor, since 0.4.0): 생성.
- `draw(graphic)` (method, since 0.4.0): 출력.
  - `graphic` Graphic: 그래픽.
- `isDrawnInsideContent()` (method, since 0.4.0): 내용 영역 안에서만 그리는지 반환. (선은 내용 크기 안쪽으로 굵기의 반만큼 들여 그린다)
  - draw 를 덮어쓴 하위 클래스는 어디에 그리는지 모르므로 false.
  - returns boolean: 내용 영역 안에서만 그리면 참.
- `setColor(other)` (method, since 0.4.0): 색상 설정.
  - `other` Color | string: 테의 색. (Color 나 "#rrggbb(aa)", "rgb(a)(...)" 글, null 이나 undefined 면 투명, 그 밖의 값은 무시한다)
- `getColor()` (method, since 0.4.0): 색상 반환.
  - returns Color: 테의 색.
- `setLineWidth(lineWidth)` (method, since 0.4.0): 굵기 설정.
  - `lineWidth` number: 테의 굵기. (내용 크기 단위, 0 이하면 그리지 않는다)
- `getLineWidth()` (method, since 0.4.0): 굵기 반환.
  - returns number: 테의 굵기.
- `setRoundSize(roundSize)` (method, since 0.4.0): 귀퉁이 둥근 정도 설정. (바깥 꼴 기준)
  - `roundSize` number: 바깥 꼴의 귀퉁이 반지름. (내용 크기 단위, 동그라미 테면 쓰지 않는다)
- `getRoundSize()` (method, since 0.4.0): 귀퉁이 둥근 정도 반환.
  - returns number: 바깥 꼴의 귀퉁이 반지름.
- `setCircle(isCircle)` (method, since 0.4.0): 동그라미 테로 그릴지 설정.
  - `isCircle` boolean: 참이면 동그라미 테, 거짓이면 둥근 네모 테.
- `isCircle()` (method, since 0.4.0): 동그라미 테인지 반환.
  - returns boolean: 동그라미 테면 참.
