SDXFrameWork  0.13
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
ShapeDraw.h
1 //Copyright © 2014 SDXFramework
2 //[License]GNU Affero General Public License, version 3
3 //[Contact]http://sourceforge.jp/projects/dxframework/
4 #pragma once
5 #include <Multimedia/Drawing.h>
6 
7 //Shape系の描画関数の実装
8 namespace SDX
9 {
10  void Complex::Draw(const Color &描画色) const
11  {
12  for (auto it : shapes)
13  {
14  it->Draw(描画色);
15  }
16  }
17 
18  void Point::Draw(const Color &描画色) const
19  {
20  Drawing::Pixel({ x, y }, 描画色);
21  }
22 
23  void Line::Draw(const Color &描画色) const
24  {
25  Drawing::Line({ xA, yA }, { xB, yB }, 描画色, (int)thick);
26  if (thick >= 3)
27  {
28  Drawing::Circle({ xA, yA, (thick-1)/2 }, 描画色);
29  Drawing::Circle({ xB, yB, (thick-1)/2 }, 描画色);
30  }
31  }
32 
33  void Rect::Draw(const Color &描画色) const
34  {
35  Drawing::Rect({GetLeft(),GetTop(),GetW(),GetH()},描画色,true);
36  }
37 
38  void Circle::Draw(const Color &描画色) const
39  {
40  Drawing::Circle({ x, y, radius }, 描画色);
41  }
42 };
double y
座標
Definition: Point.h:26
void Draw(const Color &描画色) const override
描画する.
Definition: ShapeDraw.h:38
static void Pixel(const Point &座標, const Color &色)
指定座標に点を描画.
Definition: Drawing.h:436
std::vector< IShape * > shapes
保持するShape
Definition: Complex.h:23
static void Circle(const Circle &円形, const Color &色, int 太さ=0)
中心と半径を指定して円を描画.
Definition: Drawing.h:373
static void Line(const Point &始点, const Point &終点, const Color &色, int 太さ=1)
始点と終点を結ぶ直線を描画.
Definition: Drawing.h:297
void Draw(const Color &描画色) const override
描画する.
Definition: ShapeDraw.h:10
void Draw(const Color &描画色) const override
描画する.
Definition: ShapeDraw.h:33
void Draw(const Color &描画色) const override
描画する.
Definition: ShapeDraw.h:23
void Draw(const Color &描画色) const override
描画する.
Definition: ShapeDraw.h:18
色を表すクラス.
Definition: Color.h:11
double GetH() const override
高さを取得.
Definition: Line.h:110
double GetW() const override
幅を取得.
Definition: Line.h:105
double x
座標
Definition: Point.h:25
static void Rect(const Rect &領域, const Color &色, bool 塗りつぶしフラグ=true)
左上の座標と大きさを指定して矩形を描画.
Definition: Drawing.h:350