FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
TextImage.h
説明を見る。
1 /****************************************************************************
2  *
3  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
4  *
5  * Redistribution and use in source and binary forms,
6  * with or without modification, are permitted provided that the
7  * following conditions are met:
8  *
9  * - Redistributions of source code must retain the above
10  * copyright notice, this list of conditions and the
11  * following disclaimer.
12  *
13  * - Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the
15  * following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * - Neither the name of the copyright holders nor the names
19  * of its contributors may be used to endorse or promote
20  * products derived from this software without specific
21  * prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  ****************************************************************************/
37 /****************************************************************************
38  *
39  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
40  *
41  * 本ソフトウェアおよびソースコードのライセンスは、基本的に
42  * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
43  *
44  * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
45  * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
46  *
47  * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
48  * および下記免責条項を含めること。
49  *
50  * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
51  * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
52  * 含めること。
53  *
54  * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
55  * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
56  * コントリビューターの名前を使用してはならない。
57  *
58  * 本ソフトウェアは、著作権者およびコントリビューターによって「現
59  * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
60  * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
61  * に限定されない、いかなる保証もないものとします。著作権者もコン
62  * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
63  * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
64  * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
65  * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
66  * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
67  * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
68  * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
69  * ついて、一切責任を負わないものとします。
70  *
71  ****************************************************************************/
72 #ifndef __FK_TEXTIMAGE_HEADER__
73 #define __FK_TEXTIMAGE_HEADER__
74 
75 #include <FK/Image.h>
76 #include <FK/UniCode.h>
77 #include <FK/Material.h>
78 
79 #include <string>
80 #include <vector>
81 
82 class fk_FTGlyph;
83 class fk_FTFace;
84 
90 };
91 
97 };
98 
99 
101 
136 class fk_TextImage : public fk_Image {
137  private:
138 
139  fk_FTFace *face;
140  int dpi, ptsize;
141  int boldStrength;
142  int lineSkip, charSkip, spaceLineSkip;
143  int maxHeight, maxWidth;
144  std::vector<fk_Rect> lineArray;
145  std::vector<fk_Rect> charArray;
146  std::vector<int> lineMap;
147  int minWidth;
148  int upOffset, downOffset, leftOffset, rightOffset;
149  bool smoothFlg;
150  fk_Color fgColor, bgColor, shadowColor;
151  fk_TextAlign alignMode;
152  std::vector<fk_Image *> charImages;
153  fk_TextSendingMode sendingMode;
154  int sendPos;
155  bool shadowMode;
156  fk_Dimension shadowOffset;
157  fk_UniStr strData;
158 
159  int LayoutGlyphs(std::vector<fk_FTGlyph *> *);
160  void DumpRasterMap(int, int *, int *,
161  std::vector<fk_FTGlyph *> *);
162  void FreeGlyph(std::vector<fk_FTGlyph *> *);
163 
164  void CalcTextOffset(void);
165  void ReCalcCharOffset(void);
166  void InitTextImage(void);
167  void CopyCharImage(int);
168  void ClearCharImages(void);
169  void MakeColorScale(const fk_Color &,
170  const fk_Color &,
171  int *);
172  public:
174  fk_TextImage(void);
175 
177  virtual ~fk_TextImage();
178 
179 
181 
182 
184 
203  bool initFont(const std::string fontFileName);
204 
206 
221  void setDPI(int dpi);
222 
224 
231  int getDPI(void) const;
232 
234 
249  void setPTSize(int size);
250 
252 
259  int getPTSize(void) const;
260 
262 
273  void setBoldStrength(int str);
274 
276 
283  int getBoldStrength(void) const;
284 
286 
295  void setShadowMode(bool mode);
296 
298 
305  bool getShadowMode(void) const;
306 
308 
320  void setShadowOffset(int x, int y);
321 
323 
330  fk_Dimension getShadowOffset(void) const;
331 
333 
340  void setShadowColor(fk_Color col);
341 
343 
354  void setShadowColor(float r, float g, float b, float a);
355 
357 
368  void setShadowColor(double r, double g, double b, double a);
369 
371 
378  fk_Color getShadowColor(void) const;
380 
382 
383 
385 
392  void setForeColor(fk_Color col);
393 
395 
407  void setForeColor(float r, float g, float b, float a);
408 
410 
422  void setForeColor(double r, double g, double b, double a);
423 
425 
432  fk_Color getForeColor(void) const;
433 
435 
442  void setBackColor(fk_Color col);
443 
445 
457  void setBackColor(float r, float g, float b, float a);
458 
460 
472  void setBackColor(double r, double g, double b, double a);
473 
475 
482  fk_Color getBackColor(void) const;
483 
485 
497  void setSmoothMode(bool mode);
498 
500 
507  bool getSmoothMode(void) const;
508 
509 #ifndef FK_DOXYGEN_USER_PROCESS
510  void setSmoothFlg(bool);
511  bool getSmoothFlg(void) const;
512 #endif
513 
515 
517 
519 
535  void setCharSkip(int skip);
536 
538 
546  int getCharSkip(void) const;
547 
549 
565  void setLineSkip(int skip);
566 
568 
576  int getLineSkip(void) const;
577 
579 
595  void setSpaceLineSkip(int skip);
596 
598 
606  int getSpaceLineSkip(void) const;
607 
609 
628  void setOffset(int up, int down, int left, int right);
629 
631 
639  int getUpOffset(void) const;
640 
642 
650  int getDownOffset(void) const;
651 
653 
661  int getLeftOffset(void) const;
662 
664 
672  int getRightOffset(void) const;
673 
675 
688  void setAlign(fk_TextAlign align);
689 
691 
698  fk_TextAlign getAlign(void) const;
699 
701 
723  void setMinLineWidth(int width);
724 
726 
734  int getMinLineWidth(void) const;
735 
737 
739 
740 
742 
758  bool loadUniStr(fk_UniStr *str);
759 
761 
779  bool loadStrFile(const std::string fileName,
780  fk_StringCode code = FK_STR_UTF16);
782 
784 
785 
787 
794  int getLineNum(void) const;
795 
797 
806  int getLineCharNum(int num) const;
807 
809 
816  int getAllCharNum(void) const;
817 
819 
830  int getMaxLineWidth(void) const;
831 
833 
849  int getMaxLineHeight(void) const;
850 
852 
862  int getLineWidth(int num) const;
863 
865 
880  int getLineHeight(int num) const;
881 
883 
894  int getLineStartXPos(int num) const;
895 
897 
908  int getLineStartYPos(int num) const;
909 
911 
913 
914 
916 
940 
942 
950 
952 
963  bool send(void);
964 
966 
978  bool finish(void);
979 
981 
993  bool clear(void);
994 
996 
998 
999 
1029  static void setCacheMode(bool mode);
1030 
1032 
1040  static bool getCacheMode(void);
1041 
1043 
1049  static void clearCache(void);
1051 };
1052 
1053 #endif // !__FK_TEXTIMAGE_HEADER__
virtual ~fk_TextImage()
デストラクタ
文字列板を管理するクラス
Definition: TextImage.h:136
void setShadowOffset(int x, int y)
影付けずらし幅設定関数
文字列板に表示する文字列を制御するクラス
Definition: UniCode.h:195
int getCharSkip(void) const
文字間幅参照関数
static void setCacheMode(bool mode)
キャッシュ機能制御関数
int getLineStartYPos(int num) const
行開始位置 y 成分取得関数
int getBoldStrength(void) const
太さ値参照関数
int getLineWidth(int num) const
行横幅参照関数
void setLineSkip(int skip)
行間幅設定関数
void setPTSize(int size)
フォントサイズ設定関数
int getLineCharNum(int num) const
行中文字数参照関数
fk_TextAlign
文字列板の文字列配置を表す列挙型
Definition: TextImage.h:86
int getDownOffset(void) const
オフセット下幅参照関数
static void clearCache(void)
キャッシュ初期化関数
fk_Color getBackColor(void) const
背景色参照関数
fk_StringCode
日本語文字コードを表す列挙型
Definition: UniCode.h:82
全体一括
Definition: TextImage.h:94
中寄せ
Definition: TextImage.h:88
bool clear(void)
文字送り初期化関数
void setSpaceLineSkip(int skip)
空行縦幅設定関数
RGB色を管理するクラス
Definition: Material.h:92
void setShadowMode(bool mode)
影付け効果設定関数
int getLineHeight(int num) const
行縦幅参照関数
void setBoldStrength(int str)
太さ値設定関数
void setSmoothMode(bool mode)
アンチエイリアシング効果設定関数
fk_Dimension getShadowOffset(void) const
影付けずらし幅参照関数
fk_TextSendingMode
文字列板の文字送りモードを表す列挙型
Definition: TextImage.h:93
bool loadUniStr(fk_UniStr *str)
文字列データ入力関数
void setDPI(int dpi)
フォント解像度設定関数
fk_TextAlign getAlign(void) const
文字列寄せ方向(アライメント)参照関数
void setAlign(fk_TextAlign align)
文字列寄せ方向(アライメント)設定関数
bool send(void)
文字送り実行関数
void setBackColor(fk_Color col)
背景色設定関数1
int getMaxLineHeight(void) const
最大縦幅参照関数
左寄せ
Definition: TextImage.h:87
fk_Color getShadowColor(void) const
影付け色参照関数
static bool getCacheMode(void)
キャッシュ機能有無効参照関数
文字単位
Definition: TextImage.h:95
int getLineStartXPos(int num) const
行開始位置 x 成分取得関数
int getMinLineWidth(void) const
画像最小横幅参照関数
int getLineNum(void) const
行数参照関数
fk_TextSendingMode getSendingMode(void) const
文字送りモード参照関数
void setMinLineWidth(int width)
画像最小横幅設定関数
void setOffset(int up, int down, int left, int right)
オフセット設定関数
右寄せ
Definition: TextImage.h:89
fk_Color getForeColor(void) const
文字色参照関数
bool initFont(const std::string fontFileName)
フォント情報入力関数
画像を生成、管理するクラス
Definition: Image.h:235
void setShadowColor(fk_Color col)
影付け色設定関数1
void setCharSkip(int skip)
文字間幅設定関数
int getLineSkip(void) const
行間幅参照関数
void setForeColor(fk_Color col)
文字色設定関数1
bool getShadowMode(void) const
影付け効果参照関数
bool finish(void)
文字送り完了関数
bool loadStrFile(const std::string fileName, fk_StringCode code=FK_STR_UTF16)
文字列データファイル入力関数
int getLeftOffset(void) const
オフセット左幅参照関数
Unicode (UTF-16)
Definition: UniCode.h:83
画像サイズを表すクラス
Definition: Image.h:141
int getPTSize(void) const
フォントサイズ参照関数
int getRightOffset(void) const
オフセット右幅参照関数
int getAllCharNum(void) const
文字数参照関数
bool getSmoothMode(void) const
アンチエイリアシング効果参照関数
行単位
Definition: TextImage.h:96
fk_TextImage(void)
コンストラクタ
void setSendingMode(fk_TextSendingMode mode)
文字送りモード設定関数
int getSpaceLineSkip(void) const
空行縦幅参照関数
int getUpOffset(void) const
オフセット上幅参照関数
int getDPI(void) const
フォント解像度参照関数
int getMaxLineWidth(void) const
最大横幅参照関数