2 #include<Multimedia/SDX.h>
3 #include<Multimedia/Screen.h>
44 bool isScreen =
false;
45 bool isAlphaChannel =
false;
50 ImageHandle handle = 0;
53 void RGBACulculate()
const
57 SDL_SetTextureBlendMode(handle, (SDL_BlendMode)BlendMode::Alpha);
58 SDL_SetTextureAlphaMod(handle, 255);
60 SDL_SetTextureBlendMode(handle, (SDL_BlendMode)
Screen::Single().nowBlendMode);
64 SDL_SetTextureColorMod
76 Image(
const char *ファイル名)
81 Image(
Image& コピー元,
int X頂点,
int Y頂点,
int 幅,
int 高さ)
83 Copy(コピー元, X頂点, Y頂点, 幅, 高さ);
87 Image(
int 幅 ,
int 高さ ,
bool スクリーン用フラグ ,
bool αチャンネルフラグ =
true,
bool 透過フラグ =
true)
89 Make(幅, 高さ, スクリーン用フラグ, αチャンネルフラグ, 透過フラグ);
93 bool Load(
const char *ファイル名)
96 SDL_Surface* temp = IMG_Load(ファイル名);
98 if (temp ==
nullptr)
return false;
107 SDL_FreeSurface(temp);
108 return (handle !=
nullptr);
114 if (this->handle !=
nullptr)
116 SDL_DestroyTexture(handle);
123 ImageHandle
Make(
int 幅,
int 高さ,
bool スクリーン用フラグ =
false,
bool αチャンネルフラグ =
true,
bool 透過フラグ =
true)
127 handle = SDL_CreateTexture(
Screen::GetHandle(), SDL_TEXTUREACCESS_TARGET * スクリーン用フラグ, 0, 幅, 高さ);
134 isScreen = スクリーン用フラグ;
135 isAlphaChannel = αチャンネルフラグ;
141 ImageHandle
Copy(
const Image& 元イメージ,
int X原点,
int Y原点,
int 幅,
int 高さ)
143 this->handle = 元イメージ.handle;
149 this->isTrans = 元イメージ.isTrans;
150 this->isScreen =
false;
151 this->isAlphaChannel =
false;
163 bool Draw(
int X座標,
int Y座標 ,
bool 反転フラグ =
false)
const
165 SDL_Rect temp = { X座標, Y座標, part.w, part.h };
169 static SDL_Point point = { 0, 0 };
170 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp , 0 , &point , SDL_RendererFlip::SDL_FLIP_HORIZONTAL );
184 SDL_Rect temp = { X座標A, Y座標A, X座標B - X座標A, Y座標B - Y座標A };
195 bool DrawRotate(
int X座標,
int Y座標,
double 拡大率,
double 角度,
bool 反転フラグ =
false)
const
197 const int wbuf = int(part.w*拡大率);
198 const int hbuf = int(part.h*拡大率);
199 SDL_Rect temp = { X座標 - wbuf/2, Y座標 - hbuf/2, wbuf , hbuf };
200 SDL_Point point = { wbuf / 2, hbuf / 2 };
202 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 角度*180 / PAI, &point, SDL_RendererFlip(反転フラグ));
211 bool DrawRotateAxis(
int X座標,
int Y座標,
int X軸,
int Y軸,
double 拡大率,
double 角度,
bool 反転フラグ =
false)
const
213 const int wbuf = int(part.w*拡大率);
214 const int hbuf = int(part.h*拡大率);
215 SDL_Rect temp = { X座標 - wbuf / 2, Y座標 - hbuf / 2, wbuf, hbuf };
216 SDL_Point point = { int(X軸*拡大率), int(Y軸*拡大率) };
218 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 角度*180 / PAI , &point, SDL_RendererFlip(反転フラグ));
227 bool DrawRotateAxis(
int X座標,
int Y座標,
int X軸,
int Y軸,
double 拡大率X,
double 拡大率Y,
double 角度,
bool 反転フラグ =
false)
const
229 const int wbuf = int(part.w*拡大率X);
230 const int hbuf = int(part.h*拡大率Y);
231 SDL_Rect temp = { X座標 - wbuf / 2, Y座標 - hbuf / 2, wbuf, hbuf };
232 SDL_Point point = { int(X軸*拡大率X) , int(Y軸*拡大率Y) };
234 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 角度*180/PAI, &point, SDL_RendererFlip(反転フラグ));
237 bool ZMaskRotateAxis(
int X座標,
int Y座標,
int X軸,
int Y軸,
double 拡大率X,
double 拡大率Y,
double 角度,
ZMaskType Zマスクタイプ,
bool 反転フラグ =
false)
const
243 bool DrawModify(
int 頂点aX,
int 頂点aY,
int 頂点bX,
int 頂点bY,
int 頂点cX,
int 頂点cY,
int 頂点dX,
int 頂点dY)
const
249 bool ZMaskModify(
int 頂点aX,
int 頂点aY,
int 頂点bX,
int 頂点bY,
int 頂点cX,
int 頂点cY,
int 頂点dX,
int 頂点dY,
ZMaskType Zマスクタイプ)
const
255 bool DrawPart(
int 描画先X座標,
int 描画先Y座標,
int 描画元X原点,
int 描画元Y原点,
int 幅,
int 高さ,
bool 反転フラグ =
false)
const
257 SDL_Rect temp = { 描画先X座標, 描画先Y座標, 幅, 高さ };
258 SDL_Rect part = { 描画元X原点 + this->part.x, 描画元Y原点 + this->part.y, 幅, 高さ };
259 static SDL_Point point = { 0, 0 };
261 return !SDL_RenderCopyEx(
Screen::GetHandle(), handle, &part, &temp, 0, &point, SDL_RendererFlip(反転フラグ));
264 bool ZMaskPart(
int 描画先X座標,
int 描画先Y座標,
int 描画元X原点,
int 描画元Y原点,
int 幅,
int 高さ,
ZMaskType Zマスクタイプ,
bool 反転フラグ =
false)
const
291 return this->isScreen;
297 return this->isAlphaChannel;
303 return this->isTrans;
ZMaskType
Zマスクの種類.
Definition: Image.h:8
int GetGreen() const
緑の要素を取得.
Definition: Color.h:31
bool ZMaskRotate(int X座標, int Y座標, double 拡大率, double 角度, ZMaskType Zマスクタイプ, bool 反転フラグ=false) const
角度、拡大率を指定してマスク[DXLIB].
Definition: Image.h:205
bool ZMask(int X座標, int Y座標, ZMaskType Zマスクタイプ, bool 反転フラグ=false) const
指定座標にマスク[DXLIB].
Definition: Image.h:176
bool ZMaskRotateAxis(int X座標, int Y座標, int X軸, int Y軸, double 拡大率X, double 拡大率Y, double 角度, ZMaskType Zマスクタイプ, bool 反転フラグ=false) const
回転軸、角度、拡大率を縦横別に指定してマスク[DXLIB].
Definition: Image.h:237
ClipType
説明.
Definition: Image.h:29
int GetBlue() const
青の要素を取得.
Definition: Color.h:37
bool GetIsAlphaChannel() const
αチャンネルフラグを取得.
Definition: Image.h:295
static Screen & Single()
シングルトンなインスタンスを取得.
Definition: Screen.h:42
リソースを読み込まずに描画を行う関数群.
Definition: Drawing.h:12
ImageHandle Make(int 幅, int 高さ, bool スクリーン用フラグ=false, bool αチャンネルフラグ=true, bool 透過フラグ=true)
空のイメージを作成.
Definition: Image.h:123
bool Draw(int X座標, int Y座標, bool 反転フラグ=false) const
指定座標に描画.
Definition: Image.h:163
ImageHandle GetHandle() const
ハンドルを取得.
Definition: Image.h:157
フォントデータを表すクラス.
Definition: Font.h:23
bool ZMaskRotateAxis(int X座標, int Y座標, int X軸, int Y軸, double 拡大率, double 角度, ZMaskType Zマスクタイプ, bool 反転フラグ=false) const
回転軸、角度、拡大率を指定してマスク[DXLIB].
Definition: Image.h:221
bool SetDrawScreen()
描画先にこのイメージに指定[未実装].
Definition: Image.h:308
bool ZMaskExtend(int X座標A, int Y座標A, int X座標B, int Y座標B, ZMaskType Zマスクタイプ) const
指定矩形内にマスク[DXLIB].
Definition: Image.h:189
画像データを表すクラス.
Definition: Image.h:37
int GetHeight() const
高さを取得.
Definition: Image.h:283
int GetWidth() const
幅を取得.
Definition: Image.h:277
bool Release()
イメージをメモリから開放.
Definition: Image.h:112
bool DrawPart(int 描画先X座標, int 描画先Y座標, int 描画元X原点, int 描画元Y原点, int 幅, int 高さ, bool 反転フラグ=false) const
一部を指定して描画.
Definition: Image.h:255
int LoadScreen(int X座標, int Y座標)
スクリーンの一部をイメージに取り込む[DXLIB].
Definition: Image.h:271
bool DrawRotateAxis(int X座標, int Y座標, int X軸, int Y軸, double 拡大率X, double 拡大率Y, double 角度, bool 反転フラグ=false) const
回転軸、角度、拡大率を縦横別に指定して描画.
Definition: Image.h:227
ImageHandle Copy(const Image &元イメージ, int X原点, int Y原点, int 幅, int 高さ)
元イメージの一部をコピーして、別イメージを作成.
Definition: Image.h:141
RGBA
説明.
Definition: Image.h:15
Imageをまとめてコマ送りアニメとして表すクラス.
Definition: Anime.h:28
bool GetIsScreen() const
説明.
Definition: Image.h:289
複数のImageをまとめるクラス.
Definition: ImagePack.h:9
Image(int 幅, int 高さ, bool スクリーン用フラグ, bool αチャンネルフラグ=true, bool 透過フラグ=true)
空のイメージを作成.
Definition: Image.h:87
bool DrawRotateAxis(int X座標, int Y座標, int X軸, int Y軸, double 拡大率, double 角度, bool 反転フラグ=false) const
回転軸、角度、拡大率を指定して描画.
Definition: Image.h:211
bool ZMaskModify(int 頂点aX, int 頂点aY, int 頂点bX, int 頂点bY, int 頂点cX, int 頂点cY, int 頂点dX, int 頂点dY, ZMaskType Zマスクタイプ) const
四角形に変形マスク[DXLIB].
Definition: Image.h:249
bool DrawExtend(int X座標A, int Y座標A, int X座標B, int Y座標B) const
指定矩形内に描画.
Definition: Image.h:182
bool Load(const char *ファイル名)
画像をメモリへ読み込む.
Definition: Image.h:93
bool DrawModify(int 頂点aX, int 頂点aY, int 頂点bX, int 頂点bY, int 頂点cX, int 頂点cY, int 頂点dX, int 頂点dY) const
四角形に変形描画[DXLIB].
Definition: Image.h:243
bool GetIsTrans() const
透過フラグを取得.
Definition: Image.h:301
bool ZMaskPart(int 描画先X座標, int 描画先Y座標, int 描画元X原点, int 描画元Y原点, int 幅, int 高さ, ZMaskType Zマスクタイプ, bool 反転フラグ=false) const
一部を指定してマスク[DXLIB].
Definition: Image.h:264
static ScreenHandle GetHandle()
スクリーンハンドルを取得.
Definition: Screen.h:49
bool DrawRotate(int X座標, int Y座標, double 拡大率, double 角度, bool 反転フラグ=false) const
角度、拡大率を指定して描画.
Definition: Image.h:195