2 #include <Multimedia/SDX.h>
3 #include <Multimedia/Screen.h>
4 #include <Framework/Shape.h>
45 bool isScreen =
false;
46 bool isAlphaChannel =
false;
51 ImageHandle handle = 0;
54 void RGBACulculate()
const
58 SDL_SetTextureBlendMode(handle, (SDL_BlendMode)BlendMode::Alpha);
59 SDL_SetTextureAlphaMod(handle, 255);
61 SDL_SetTextureBlendMode(handle, (SDL_BlendMode)
Screen::Single().nowBlendMode);
65 SDL_SetTextureColorMod
77 Image(
const char *ファイル名)
82 Image(
Image& コピー元,
int X頂点,
int Y頂点,
int 幅,
int 高さ)
84 Copy(コピー元, X頂点, Y頂点, 幅, 高さ);
88 Image(
int 幅 ,
int 高さ ,
bool スクリーン用フラグ ,
bool αチャンネルフラグ =
true,
bool 透過フラグ =
true)
90 Make(幅, 高さ, スクリーン用フラグ, αチャンネルフラグ, 透過フラグ);
94 bool Load(
const char *ファイル名)
97 SDL_Surface* temp = IMG_Load(ファイル名);
99 if (temp ==
nullptr)
return false;
108 SDL_FreeSurface(temp);
109 return (handle !=
nullptr);
115 if (this->handle !=
nullptr)
117 SDL_DestroyTexture(handle);
124 ImageHandle
Make(
int 幅,
int 高さ,
bool スクリーン用フラグ =
false,
bool αチャンネルフラグ =
true,
bool 透過フラグ =
true)
128 handle = SDL_CreateTexture(
Screen::GetHandle(), SDL_TEXTUREACCESS_TARGET * スクリーン用フラグ, 0, 幅, 高さ);
135 isScreen = スクリーン用フラグ;
136 isAlphaChannel = αチャンネルフラグ;
142 ImageHandle
Copy(
const Image& 元イメージ,
int X原点,
int Y原点,
int 幅,
int 高さ)
144 this->handle = 元イメージ.handle;
150 this->isTrans = 元イメージ.isTrans;
151 this->isScreen =
false;
152 this->isAlphaChannel =
false;
166 SDL_Rect temp = { (int)座標.x, (
int)座標.y, part.w, part.h };
170 static SDL_Point point = { 0, 0 };
171 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp , 0 , &point , SDL_RendererFlip::SDL_FLIP_HORIZONTAL );
180 SDL_Rect temp = { (int)座標A.x, (
int)座標A.y, (int)(座標B.x - 座標A.x), (int)(座標B.y - 座標A.y) };
188 const int wbuf = int(part.w*拡大率);
189 const int hbuf = int(part.h*拡大率);
190 SDL_Rect temp = { (int)座標.x - wbuf / 2, (
int)座標.y - hbuf / 2, wbuf, hbuf };
191 SDL_Point point = { wbuf / 2, hbuf / 2 };
193 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 角度*180 / PAI, &point, SDL_RendererFlip(反転フラグ));
199 const int wbuf = int(part.w*拡大率);
200 const int hbuf = int(part.h*拡大率);
201 SDL_Rect temp = { (int)座標.x - wbuf / 2, (
int)座標.y - hbuf / 2, wbuf, hbuf };
202 SDL_Point point = { int(回転軸座標.x*拡大率), int(回転軸座標.y*拡大率) };
204 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 角度*180 / PAI , &point, SDL_RendererFlip(反転フラグ));
210 const int wbuf = int(part.w*拡大率X);
211 const int hbuf = int(part.h*拡大率Y);
212 SDL_Rect temp = { (int)座標.x - wbuf / 2, (
int)座標.y - hbuf / 2, wbuf, hbuf };
213 SDL_Point point = { int(回転軸座標.x*拡大率X), int(回転軸座標.y*拡大率Y) };
215 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 角度*180/PAI, &point, SDL_RendererFlip(反転フラグ));
225 bool DrawPart(
int 描画先X座標,
int 描画先Y座標,
int 描画元X原点,
int 描画元Y原点,
int 幅,
int 高さ,
bool 反転フラグ =
false)
const
227 SDL_Rect temp = { 描画先X座標, 描画先Y座標, 幅, 高さ };
228 SDL_Rect part = { 描画元X原点 + this->part.x, 描画元Y原点 + this->part.y, 幅, 高さ };
229 static SDL_Point point = { 0, 0 };
231 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 0, &point, SDL_RendererFlip(反転フラグ));
256 return this->isScreen;
262 return this->isAlphaChannel;
268 return this->isTrans;
ZMaskType
Zマスクの種類.
Definition: Image.h:9
int GetGreen() const
緑の要素を取得.
Definition: Color.h:31
bool Draw(const Point &座標, bool 反転フラグ=false) const
指定座標に描画.
Definition: Image.h:164
static RendererHandle GetHandle()
スクリーンハンドルを取得.
Definition: Screen.h:77
ClipType
説明.
Definition: Image.h:30
bool DrawExtend(const Point &座標A, const Point &座標B) const
指定矩形内に描画.
Definition: Image.h:178
int GetBlue() const
青の要素を取得.
Definition: Color.h:37
bool GetIsAlphaChannel() const
αチャンネルフラグを取得.
Definition: Image.h:260
static Screen & Single()
シングルトンなインスタンスを取得.
Definition: Screen.h:70
リソースを読み込まずに描画を行う関数群.
Definition: Drawing.h:13
ImageHandle Make(int 幅, int 高さ, bool スクリーン用フラグ=false, bool αチャンネルフラグ=true, bool 透過フラグ=true)
空のイメージを作成.
Definition: Image.h:124
ImageHandle GetHandle() const
ハンドルを取得.
Definition: Image.h:158
点を表す図形クラス.
Definition: Shape.h:129
フォントデータを表すクラス.
Definition: Font.h:23
bool SetDrawScreen()
描画先にこのイメージに指定[未実装].
Definition: Image.h:273
画像データを表すクラス.
Definition: Image.h:38
int GetHeight() const
高さを取得.
Definition: Image.h:248
int GetWidth() const
幅を取得.
Definition: Image.h:242
bool DrawModify(const Point &頂点A, const Point &頂点B, const Point &頂点C, const Point &頂点D) const
四角形に変形描画[未実装].
Definition: Image.h:219
bool Release()
イメージをメモリから開放.
Definition: Image.h:113
bool DrawPart(int 描画先X座標, int 描画先Y座標, int 描画元X原点, int 描画元Y原点, int 幅, int 高さ, bool 反転フラグ=false) const
一部を指定して描画.
Definition: Image.h:225
int LoadScreen(int X座標, int Y座標)
スクリーンの一部をイメージに取り込む[未実装].
Definition: Image.h:236
ImageHandle Copy(const Image &元イメージ, int X原点, int Y原点, int 幅, int 高さ)
元イメージの一部をコピーして、別イメージを作成.
Definition: Image.h:142
bool DrawRotateAxis(const Point &座標, const Point &回転軸座標, double 拡大率X, double 拡大率Y, double 角度, bool 反転フラグ=false) const
回転軸、角度、拡大率を縦横別に指定して描画.
Definition: Image.h:208
RGBA
説明.
Definition: Image.h:16
Imageをまとめてコマ送りアニメとして表すクラス.
Definition: Anime.h:28
bool GetIsScreen() const
説明.
Definition: Image.h:254
複数のImageをまとめるクラス.
Definition: ImagePack.h:9
Image(int 幅, int 高さ, bool スクリーン用フラグ, bool αチャンネルフラグ=true, bool 透過フラグ=true)
空のイメージを作成.
Definition: Image.h:88
bool DrawRotate(const Point &座標, double 拡大率, double 角度, bool 反転フラグ=false) const
角度、拡大率を指定して描画.
Definition: Image.h:186
bool DrawRotateAxis(const Point &座標, const Point &回転軸座標, double 拡大率, double 角度, bool 反転フラグ=false) const
回転軸、角度、拡大率を指定して描画.
Definition: Image.h:197
bool Load(const char *ファイル名)
画像をメモリへ読み込む.
Definition: Image.h:94
bool GetIsTrans() const
透過フラグを取得.
Definition: Image.h:266