亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gameswf_text.cpp

?? 一個開源的嵌入式flash播放器的源代碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// gameswf_text.cpp	-- Thatcher Ulrich <tu@tulrich.com> 2003// This source code has been donated to the Public Domain.  Do// whatever you want with it.// Code for the text tags.#include "base/utf8.h"#include "base/utility.h"#include "gameswf_impl.h"#include "gameswf_shape.h"#include "gameswf_stream.h"#include "gameswf_log.h"#include "gameswf_font.h"#include "gameswf_fontlib.h"#include "gameswf_render.h"#include "gameswf_textformat.h"namespace gameswf{	//	// text_character	//	// Helper struct.	struct text_style	{		int	m_font_id;		mutable font*	m_font;		rgba	m_color;		float	m_x_offset;		float	m_y_offset;		float	m_text_height;		bool	m_has_x_offset;		bool	m_has_y_offset;		text_style()			:			m_font_id(-1),			m_font(NULL),			m_x_offset(0),			m_y_offset(0),			m_text_height(1.0f),			m_has_x_offset(false),			m_has_y_offset(false)		{		}		void	resolve_font(movie_definition_sub* root_def) const		{			if (m_font == NULL)			{				assert(m_font_id >= 0);				m_font = root_def->get_font(m_font_id);				if (m_font == NULL)				{					log_error("error: text style with undefined font; font_id = %d\n", m_font_id);				}			}		}	};	// Helper struct.	struct text_glyph_record	{		struct glyph_entry		{			int	m_glyph_index;			float	m_glyph_advance;		};		text_style	m_style;		array<glyph_entry>	m_glyphs;		void	read(stream* in, int glyph_count, int glyph_bits, int advance_bits)		{			m_glyphs.resize(glyph_count);			for (int i = 0; i < glyph_count; i++)			{				m_glyphs[i].m_glyph_index = in->read_uint(glyph_bits);				m_glyphs[i].m_glyph_advance = (float) in->read_sint(advance_bits);			}		}	};	// Render the given glyph records.	static void	display_glyph_records(		const matrix& this_mat,		character* inst,		const array<text_glyph_record>& records,		movie_definition_sub* root_def)	{		static array<fill_style>	s_dummy_style;	// used to pass a color on to shape_character::display()		static array<line_style>	s_dummy_line_style;		s_dummy_style.resize(1);		matrix	mat = inst->get_world_matrix();		mat.concatenate(this_mat);		cxform	cx = inst->get_world_cxform();		float	pixel_scale = inst->get_pixel_scale();//		display_info	sub_di = di;//		sub_di.m_matrix.concatenate(mat);//		matrix	base_matrix = sub_di.m_matrix;		matrix	base_matrix = mat;		float	base_matrix_max_scale = base_matrix.get_max_scale();		float	scale = 1.0f;		float	x = 0.0f;		float	y = 0.0f;		for (int i = 0; i < records.size(); i++)		{			// Draw the characters within the current record; i.e. consecutive			// chars that share a particular style.			const text_glyph_record&	rec = records[i];			rec.m_style.resolve_font(root_def);			font*	fnt = rec.m_style.m_font;			if (fnt == NULL)			{				continue;			}			scale = rec.m_style.m_text_height / 1024.0f;	// the EM square is 1024 x 1024			float	text_screen_height = base_matrix_max_scale				* scale				* 1024.0f				/ 20.0f				* pixel_scale;			int	nominal_glyph_height = fnt->get_texture_glyph_nominal_size();			float	max_glyph_height = fontlib::get_texture_glyph_max_height(fnt);#ifdef GAMESWF_ALWAYS_USE_TEXTURES_FOR_TEXT_WHEN_POSSIBLE			const bool	use_glyph_textures = true;#else			bool	use_glyph_textures =				text_screen_height <= max_glyph_height * 1.0f;#endif			if (rec.m_style.m_has_x_offset)			{				x = rec.m_style.m_x_offset;			}			if (rec.m_style.m_has_y_offset)			{				y = rec.m_style.m_y_offset;			}			s_dummy_style[0].set_color(rec.m_style.m_color);			rgba	transformed_color = cx.transform(rec.m_style.m_color);			for (int j = 0; j < rec.m_glyphs.size(); j++)			{				int	index = rec.m_glyphs[j].m_glyph_index;									mat = base_matrix;				mat.concatenate_translation(x, y);				mat.concatenate_scale(scale);				if (index == -1)				{					// Invalid glyph; render it as an empty box.					render::set_matrix(mat);					render::line_style_color(transformed_color);					// The EM square is 1024x1024, but usually isn't filled up.					// We'll use about half the width, and around 3/4 the height.					// Values adjusted by eye.					// The Y baseline is at 0; negative Y is up.					static const Sint16	s_empty_char_box[5 * 2] =					{						 32,   32,						480,   32,						480, -656,						 32, -656,						 32,   32					};					render::draw_line_strip(s_empty_char_box, 5);				}				else				{					const texture_glyph&	tg = fnt->get_texture_glyph(index);					shape_character_def*	glyph = fnt->get_glyph(index);					if (tg.is_renderable()					    && (use_glyph_textures || glyph == NULL))					{						fontlib::draw_glyph(mat, tg, transformed_color, nominal_glyph_height);					}					else					{						// Draw the character using the filled outline.						if (glyph)						{							glyph->display(mat, cx, pixel_scale, s_dummy_style, s_dummy_line_style);						}					}				}				x += rec.m_glyphs[j].m_glyph_advance;			}		}	}	struct text_character_def : public character_def	{		movie_definition_sub*	m_root_def;		rect	m_rect;		matrix	m_matrix;		array<text_glyph_record>	m_text_glyph_records;		text_character_def(movie_definition_sub* root_def)			:			m_root_def(root_def)		{			assert(m_root_def);		}		void	read(stream* in, int tag_type, movie_definition_sub* m)		{			assert(m != NULL);			assert(tag_type == 11 || tag_type == 33);			m_rect.read(in);			m_matrix.read(in);			int	glyph_bits = in->read_u8();			int	advance_bits = in->read_u8();			IF_VERBOSE_PARSE(log_msg("begin text records\n"));			bool	last_record_was_style_change = false;			text_style	style;			for (;;)			{				int	first_byte = in->read_u8();								if (first_byte == 0)				{					// This is the end of the text records.					IF_VERBOSE_PARSE(log_msg("end text records\n"));					break;				}				// Style changes and glyph records just alternate.				// (Contrary to what most SWF references say!)				if (last_record_was_style_change == false)				{					// This is a style change.					last_record_was_style_change = true;					bool	has_font = (first_byte >> 3) & 1;					bool	has_color = (first_byte >> 2) & 1;					bool	has_y_offset = (first_byte >> 1) & 1;					bool	has_x_offset = (first_byte >> 0) & 1;					IF_VERBOSE_PARSE(log_msg("  text style change\n"));					if (has_font)					{						Uint16	font_id = in->read_u16();						style.m_font_id = font_id;						IF_VERBOSE_PARSE(log_msg("  has_font: font id = %d\n", font_id));					}					if (has_color)					{						if (tag_type == 11)						{							style.m_color.read_rgb(in);						}						else						{							assert(tag_type == 33);							style.m_color.read_rgba(in);						}						IF_VERBOSE_PARSE(log_msg("  has_color\n"));					}					if (has_x_offset)					{						style.m_has_x_offset = true;						style.m_x_offset = in->read_s16();						IF_VERBOSE_PARSE(log_msg("  has_x_offset = %g\n", style.m_x_offset));					}					else					{						style.m_has_x_offset = false;						style.m_x_offset = 0.0f;					}					if (has_y_offset)					{						style.m_has_y_offset = true;						style.m_y_offset = in->read_s16();						IF_VERBOSE_PARSE(log_msg("  has_y_offset = %g\n", style.m_y_offset));					}					else					{						style.m_has_y_offset = false;						style.m_y_offset = 0.0f;					}					if (has_font)					{						style.m_text_height = in->read_u16();						IF_VERBOSE_PARSE(log_msg("  text_height = %g\n", style.m_text_height));					}				}				else				{					// Read the glyph record. 					last_record_was_style_change = false;					int	glyph_count = first_byte;// 					if (! last_record_was_style_change)// 					{// 						glyph_count &= 0x7F;// 					}// 					// else { Don't mask the top bit; the first record is allowed to have > 127 glyphs. }					m_text_glyph_records.resize(m_text_glyph_records.size() + 1);					m_text_glyph_records.back().m_style = style;					m_text_glyph_records.back().read(in, glyph_count, glyph_bits, advance_bits);					IF_VERBOSE_PARSE(log_msg("  glyph_records: count = %d\n", glyph_count));				}			}		}		void	display(character* inst)		// Draw the string.		{			display_glyph_records(m_matrix, inst, m_text_glyph_records, m_root_def);		}	};	void	define_text_loader(stream* in, int tag_type, movie_definition_sub* m)	// Read a DefineText tag.	{		assert(tag_type == 11 || tag_type == 33);		Uint16	character_id = in->read_u16();				text_character_def*	ch = new text_character_def(m);		IF_VERBOSE_PARSE(log_msg("text_character, id = %d\n", character_id));		ch->read(in, tag_type, m);		// IF_VERBOSE_PARSE(print some stuff);		m->add_character(character_id, ch);	}	//	// edit_text_character_def	//	struct edit_text_character_def : public character_def	// A definition for a text display character, whose text can	// be changed at runtime (by script or host).	{		movie_definition_sub*	m_root_def;		rect			m_rect;		tu_string		m_default_name;		text_format		m_format;		bool			m_word_wrap;		bool			m_multiline;		bool			m_password;	// show asterisks instead of actual characters		bool			m_readonly;		bool			m_auto_size;	// resize our bound to fit the text		bool			m_no_select;		bool			m_border;	// forces white background and black border -- silly, but sometimes used		bool			m_html;		// Allowed HTML (from Alexi's SWF Reference):		//		// <a href=url target=targ>...</a> -- hyperlink		// <b>...</b> -- bold		// <br> -- line break		// <font face=name size=[+|-][0-9]+ color=#RRGGBB>...</font>  -- font change; size in TWIPS		// <i>...</i> -- italic		// <li>...</li> -- list item		// <p>...</p> -- paragraph		// <tab> -- insert tab		// <TEXTFORMAT>  </TEXTFORMAT>		//   [ BLOCKINDENT=[0-9]+ ]		//   [ INDENT=[0-9]+ ]		//   [ LEADING=[0-9]+ ]		//   [ LEFTMARGIN=[0-9]+ ]		//   [ RIGHTMARGIN=[0-9]+ ]		//   [ TABSTOPS=[0-9]+{,[0-9]+} ]		//		// Change the different parameters as indicated. The		// sizes are all in TWIPs. There can be multiple		// positions for the tab stops. These are seperated by		// commas.		// <U>...</U> -- underline		bool	m_use_outlines;	// when true, use specified SWF internal font.  Otherwise, renderer picks a default font		int	m_font_id;		font*	m_font;		float	m_text_height;		rgba	m_color;		int	m_max_length;		enum alignment		{			ALIGN_LEFT = 0,			ALIGN_RIGHT,			ALIGN_CENTER,			ALIGN_JUSTIFY	// probably don't need to implement...		};		alignment	m_alignment;				float	m_left_margin;	// extra space between box border and text		float	m_right_margin;		float	m_indent;	// how much to indent the first line of multiline text		float	m_leading;	// extra space between lines (in addition to default font line spacing)		tu_string	m_default_text;		edit_text_character_def(movie_definition_sub* root_def)			:			m_root_def(root_def),			m_word_wrap(false),			m_multiline(false),			m_password(false),			m_readonly(false),			m_auto_size(false),			m_no_select(false),			m_border(false),			m_html(false),			m_use_outlines(false),			m_font_id(-1),			m_font(NULL),			m_text_height(1.0f),			m_max_length(0),			m_alignment(ALIGN_LEFT),			m_left_margin(0.0f),			m_right_margin(0.0f),			m_indent(0.0f),			m_leading(0.0f)		{			assert(m_root_def);			m_color.set(0, 0, 0, 255);		}		// Set the format of the text		void	set_format(text_format &format)		{			m_format = format;		}				~edit_text_character_def()		{		}		character*	create_character_instance(movie* parent, int id);		void	read(stream* in, int tag_type, movie_definition_sub* m)		{			assert(m != NULL);			assert(tag_type == 37);			m_rect.read(in);			in->align();			bool	has_text = in->read_uint(1) ? true : false;			m_word_wrap = in->read_uint(1) ? true : false;			m_multiline = in->read_uint(1) ? true : false;			m_password = in->read_uint(1) ? true : false;			m_readonly = in->read_uint(1) ? true : false;			bool	has_color = in->read_uint(1) ? true : false;			bool	has_max_length = in->read_uint(1) ? true : false;			bool	has_font = in->read_uint(1) ? true : false;			in->read_uint(1);	// reserved			m_auto_size = in->read_uint(1) ? true : false;			bool	has_layout = in->read_uint(1) ? true : false;			m_no_select = in->read_uint(1) ? true : false;			m_border = in->read_uint(1) ? true : false;			in->read_uint(1);	// reserved			m_html = in->read_uint(1) ? true : false;			m_use_outlines = in->read_uint(1) ? true : false;			if (has_font)			{				m_font_id = in->read_u16();				m_text_height = (float) in->read_u16();			}			if (has_color)			{				m_color.read_rgba(in);			}			if (has_max_length)			{				m_max_length = in->read_u16();			}			if (has_layout)			{				m_alignment = (alignment) in->read_u8();				m_left_margin = (float) in->read_u16();				m_right_margin = (float) in->read_u16();				m_indent = (float) in->read_s16();				m_leading = (float) in->read_s16();			}			char*	name = in->read_string();			m_default_name = name;			delete [] name;			if (has_text)			{				char*	str = in->read_string();				m_default_text = str;				delete [] str;			}			IF_VERBOSE_PARSE(log_msg("edit_text_char, varname = %s, text = %s\n",						 m_default_name.c_str(), m_default_text.c_str()));		}	};	//	// edit_text_character	//	struct edit_text_character : public character	{		edit_text_character_def*	m_def;		array<text_glyph_record>	m_text_glyph_records;		array<fill_style>	m_dummy_style;	// used to pass a color on to shape_character::display()		array<line_style>	m_dummy_line_style;		rect	m_text_bounding_box;	// bounds of dynamic text, as laid out		tu_string	m_text;		edit_text_character(movie* parent, edit_text_character_def* def, int id)			:			character(parent, id),			m_def(def)		{			assert(parent);			assert(m_def);			set_text_value(m_def->m_default_text.c_str());			m_dummy_style.push_back(fill_style());			reset_bounding_box(0, 0);		}		~edit_text_character()		{		}		virtual const char*	get_text_name() const { return m_def->m_default_name.c_str(); }		void	reset_bounding_box(float x, float y)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
处破女av一区二区| 91农村精品一区二区在线| 欧美一区二区三区在线视频| 伊人性伊人情综合网| 成人高清免费在线播放| 国产目拍亚洲精品99久久精品| 免费一级片91| 欧美电影在哪看比较好| 亚洲国产精品欧美一二99| 在线观看一区不卡| 亚洲综合清纯丝袜自拍| 色吧成人激情小说| 亚洲精品国产a| 欧洲日韩一区二区三区| 亚洲一区二区三区四区在线观看 | 亚洲成人免费视| 欧美性猛交xxxx黑人交| 亚洲无线码一区二区三区| 欧美亚洲愉拍一区二区| 亚洲1区2区3区视频| 91超碰这里只有精品国产| 日韩高清不卡一区| 日韩免费性生活视频播放| 久久er精品视频| 久久久精品国产免大香伊| 国产成都精品91一区二区三| 国产精品久久久久久一区二区三区| 94-欧美-setu| 亚洲制服欧美中文字幕中文字幕| 欧美日韩成人高清| 日本不卡视频在线| 久久综合色一综合色88| 国产不卡在线一区| 一区二区三区精品视频| 欧美日韩国产美女| 久草中文综合在线| 国产精品美女久久久久久2018 | 成人app在线| 亚洲制服欧美中文字幕中文字幕| 制服丝袜国产精品| 国产精品主播直播| 亚洲免费在线视频一区 二区| 欧美色综合久久| 蜜臀国产一区二区三区在线播放| www国产成人免费观看视频 深夜成人网| 国产精品一二三四五| 亚洲欧洲精品成人久久奇米网| 91福利小视频| 久久www免费人成看片高清| 国产精品毛片高清在线完整版| 色爱区综合激月婷婷| 另类综合日韩欧美亚洲| 国产女同性恋一区二区| 欧美午夜不卡视频| 国产一区在线观看视频| 亚洲欧美激情插| 欧美第一区第二区| 波多野结衣亚洲| 丝袜脚交一区二区| 国产日产欧美一区| 精品视频1区2区3区| 国内一区二区视频| 一区二区中文视频| 欧美一区二区精品在线| 9久草视频在线视频精品| 日韩av中文字幕一区二区三区| 国产亚洲欧美日韩俺去了| 91黄色激情网站| 久久91精品国产91久久小草| 亚洲天堂福利av| 日韩精品一区国产麻豆| 91麻豆免费看| 国产美女精品人人做人人爽 | 亚洲精品亚洲人成人网| 欧美电视剧在线看免费| 91久久精品日日躁夜夜躁欧美| 久久黄色级2电影| 亚洲欧美日韩小说| 久久久久久久网| 制服丝袜亚洲精品中文字幕| 99re视频这里只有精品| 精品一区二区精品| 亚洲一区二区三区美女| 欧美激情中文不卡| 欧美日韩国产天堂| av在线不卡电影| 精品综合免费视频观看| 亚洲一区二区三区视频在线| 国产精品护士白丝一区av| xnxx国产精品| 欧美一区二区三区免费大片 | 日韩亚洲欧美在线| 91成人在线观看喷潮| 成人网在线播放| 精品一区二区在线看| 亚洲一二三区不卡| 国产精品福利影院| 久久久精品欧美丰满| 日韩一级黄色大片| 在线免费亚洲电影| 99视频在线精品| 国产成人av一区二区三区在线 | 久久伊99综合婷婷久久伊| 欧美日韩国产精品成人| 91亚洲精品一区二区乱码| 国产传媒欧美日韩成人| 麻豆91免费观看| 婷婷久久综合九色综合伊人色| 亚洲女子a中天字幕| 欧美国产精品专区| 久久色在线观看| 欧美mv日韩mv国产网站| 欧美高清视频www夜色资源网| 色哟哟在线观看一区二区三区| 成人午夜私人影院| 国产久卡久卡久卡久卡视频精品| 麻豆中文一区二区| 日韩 欧美一区二区三区| 亚洲高清久久久| 亚洲一本大道在线| 亚洲图片有声小说| 亚洲一区二区三区四区在线| 亚洲精品老司机| 亚洲天堂中文字幕| 最新欧美精品一区二区三区| 国产精品久线在线观看| 中文字幕欧美区| 国产精品网站在线观看| 欧美高清在线精品一区| 国产欧美日韩三级| 国产农村妇女精品| 中文字幕在线观看一区二区| 亚洲欧洲三级电影| 18欧美乱大交hd1984| 成人免费视频在线观看| 一区二区三区在线看| 玉足女爽爽91| 亚洲一区二区不卡免费| 亚洲国产一区二区在线播放| 午夜视频在线观看一区二区三区| 午夜精品一区在线观看| 三级影片在线观看欧美日韩一区二区 | 国产精品色哟哟| **网站欧美大片在线观看| 亚洲日本在线a| 亚洲一区二区三区四区在线免费观看 | 国产成人综合亚洲网站| 国产寡妇亲子伦一区二区| 不卡电影一区二区三区| 色综合久久99| 欧美性受xxxx| 91精品免费观看| 精品不卡在线视频| 国产日韩精品一区二区浪潮av| 国产精品国产三级国产aⅴ原创 | 偷拍一区二区三区四区| 男人的天堂亚洲一区| 韩国欧美一区二区| 99久久婷婷国产综合精品电影| 一本大道久久精品懂色aⅴ| 欧美午夜片在线看| 欧美va亚洲va香蕉在线| 欧美国产日本视频| 亚洲影院久久精品| 久久精品国产精品亚洲红杏| 国产福利电影一区二区三区| 97久久久精品综合88久久| 欧美性三三影院| 日韩欧美一二三四区| 国产精品三级视频| 亚洲一区二区三区四区不卡| 麻豆精品新av中文字幕| 成人免费的视频| 欧美曰成人黄网| 精品国产亚洲一区二区三区在线观看| 国产区在线观看成人精品| 亚洲精品免费在线播放| 蜜臀久久99精品久久久久宅男| 高清国产午夜精品久久久久久| 欧美亚洲日本国产| 久久久亚洲精华液精华液精华液| 亚洲私人黄色宅男| 日韩av中文字幕一区二区三区| 福利一区福利二区| 精品视频999| 亚洲国产精品成人久久综合一区| 亚洲一区二区欧美激情| 激情久久五月天| 在线欧美日韩精品| 久久夜色精品一区| 伊人一区二区三区| 国产精品影视在线观看| 欧美伊人精品成人久久综合97| 久久久蜜桃精品| 天堂成人免费av电影一区| 东方欧美亚洲色图在线| 在线91免费看| 亚洲另类春色国产| 国产精品一品二品| 欧美剧在线免费观看网站|