SDXFrameWork  0.13
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Friends | List of all members
SDX::Image Class Reference

画像データを表すクラス. More...

#include <Image.h>

Inherits SDX::IDrawable.

Public Member Functions

 Image (const char *ファイル名)
 画像をメモリへ読み込む. More...
 
 Image (const Image &コピー元, const Rect &コピー領域)
 別のImageの一部をコピーして、Imageを初期化. More...
 
 Image (SDL_Texture *画像ハンドル, int 幅, int 高さ)
 SDL_TextureからImageを作成. More...
 
 Image (int 幅, int 高さ)
 空のイメージを作成. More...
 
bool Load (const char *ファイル名)
 画像をメモリへ読み込む. More...
 
bool Release ()
 イメージをメモリから開放. More...
 
SDL_Texture * Make (int 幅, int 高さ)
 空のイメージを作成. More...
 
SDL_Texture * Copy (const Image &元イメージ, const Rect &コピー領域)
 別のImageの一部をコピーして、Imageを初期化. More...
 
Image Clone (bool is反転=false) const
 同じImageを作成. More...
 
Image Clone (const Rect &コピー領域, bool is反転=false) const
 Imageの一部から別Imageを作成. More...
 
SDL_Texture * GetHandle () const
 ハンドルを取得. More...
 
bool Draw (const Point &座標, bool 反転フラグ=false) const override
 指定座標に描画. More...
 
bool DrawExtend (const Rect &描画領域, bool 反転フラグ=false) const override
 指定矩形内に描画. More...
 
bool DrawRotate (const Point &座標, double 拡大率, double 角度, bool 反転フラグ=false) const override
 角度、拡大率を指定して描画. More...
 
bool DrawRotateAxis (const Point &座標, const Point &回転軸座標, double 拡大率, double 角度, bool 反転フラグ=false) const override
 回転軸、角度、拡大率を指定して描画. More...
 
bool DrawRotateAxis (const Point &座標, const Point &回転軸座標, double 拡大率X, double 拡大率Y, double 角度, bool 反転フラグ=false) const override
 回転軸、角度、拡大率を縦横別に指定して描画. More...
 
bool DrawPart (const Point &描画先座標, const Rect &描画元領域, bool 反転フラグ=false) const override
 指定した一部分を描画. More...
 
bool DrawPartExtend (const Rect &描画先領域, const Rect &描画元領域, bool 反転フラグ=false) const
 指定した一部分を描画. More...
 
int GetWidth () const
 幅を取得. More...
 
int GetHeight () const
 高さを取得. More...
 
void SetColor (const Color &描画色)
 描画色を指定. More...
 

Friends

class Drawing
 
class ImagePack
 

Detailed Description

画像データを表すクラス.

デストラクタでリソース解放周りは調整中

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//画像を描画する
bool SampleImage()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
Image ねずみ("data/pipo-enemy034.png");
Image ひよこ("data/pipo-enemy035.png");
Image にわとり("data/pipo-enemy036.png");
Image くま("data/pipo-enemy037.png");
にわとり.SetColor(Color::Red);//赤くする
くま.SetColor({255,255,255,128});//半透明にする
double angle = 0;
while (System::Update())
{
angle += 0.1;
ねずみ.Draw({ 100, 100 }, true);//反転して描画
ひよこ.DrawExtend({ 200, 100 , 200, 100 });//指定矩形に描画
にわとり.DrawRotate({ 100, 200 }, 0.5, angle);//角度と拡大率を指定して描画
くま.DrawPart({ 200, 200 }, {0,0,90,90});//一部分を描画
if (Input::key.Return.on){ break;}//Enterで終了
}
return true;
}

Constructor & Destructor Documentation

SDX::Image::Image ( const char *  ファイル名)
inline

画像をメモリへ読み込む.

SDX::Image::Image ( const Image コピー元,
const Rect コピー領域 
)
inline

別のImageの一部をコピーして、Imageを初期化.

handleは同一

SDX::Image::Image ( SDL_Texture *  画像ハンドル,
int  ,
int  高さ 
)
inline

SDL_TextureからImageを作成.

SDX::Image::Image ( int  ,
int  高さ 
)
inline

空のイメージを作成.

Member Function Documentation

bool SDX::Image::Load ( const char *  ファイル名)
inline

画像をメモリへ読み込む.

bool SDX::Image::Release ( )
inline

イメージをメモリから開放.

SDL_Texture* SDX::Image::Make ( int  ,
int  高さ 
)
inline

空のイメージを作成.

SDL_Texture* SDX::Image::Copy ( const Image 元イメージ,
const Rect コピー領域 
)
inline

別のImageの一部をコピーして、Imageを初期化.

handleは同一

Image SDX::Image::Clone ( bool  is反転 = false) const
inline

同じImageを作成.

handleは別、Screen::SetTargetに指定可能

Image SDX::Image::Clone ( const Rect コピー領域,
bool  is反転 = false 
) const
inline

Imageの一部から別Imageを作成.

handleは別、Screen::SetTargetに指定可能

SDL_Texture* SDX::Image::GetHandle ( ) const
inline

ハンドルを取得.

bool SDX::Image::Draw ( const Point 座標,
bool  反転フラグ = false 
) const
inlineoverridevirtual

指定座標に描画.

Implements SDX::IDrawable.

bool SDX::Image::DrawExtend ( const Rect 描画領域,
bool  反転フラグ = false 
) const
inlineoverridevirtual

指定矩形内に描画.

Implements SDX::IDrawable.

bool SDX::Image::DrawRotate ( const Point 座標,
double  拡大率,
double  角度,
bool  反転フラグ = false 
) const
inlineoverridevirtual

角度、拡大率を指定して描画.

Implements SDX::IDrawable.

bool SDX::Image::DrawRotateAxis ( const Point 座標,
const Point 回転軸座標,
double  拡大率,
double  角度,
bool  反転フラグ = false 
) const
inlineoverridevirtual

回転軸、角度、拡大率を指定して描画.

Implements SDX::IDrawable.

bool SDX::Image::DrawRotateAxis ( const Point 座標,
const Point 回転軸座標,
double  拡大率X,
double  拡大率Y,
double  角度,
bool  反転フラグ = false 
) const
inlineoverridevirtual

回転軸、角度、拡大率を縦横別に指定して描画.

Implements SDX::IDrawable.

bool SDX::Image::DrawPart ( const Point 描画先座標,
const Rect 描画元領域,
bool  反転フラグ = false 
) const
inlineoverridevirtual

指定した一部分を描画.

Implements SDX::IDrawable.

bool SDX::Image::DrawPartExtend ( const Rect 描画先領域,
const Rect 描画元領域,
bool  反転フラグ = false 
) const
inline

指定した一部分を描画.

int SDX::Image::GetWidth ( ) const
inline

幅を取得.

int SDX::Image::GetHeight ( ) const
inline

高さを取得.

void SDX::Image::SetColor ( const Color 描画色)
inline

描画色を指定.