Subversion Repositories php-qbpwcf

Rev

Rev 3 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2025 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 92... Line 92...
92
 
92
 
93
		#回傳結果
93
		#回傳結果
94
		return $result;
94
		return $result;
95
 
95
 
96
		}#function __callStatic end
96
		}#function __callStatic end
97
		
97
 
98
	/*
98
	/*
99
	#函式說明:
99
	#函式說明:
100
	#展示canvas
100
	#展示canvas
101
	#回傳的結果:
101
	#回傳的結果:
102
	#回傳結果:
102
	#回傳結果:
Line 123... Line 123...
123
		#$conf["script"],字串,要執行的javaScript語法.
123
		#$conf["script"],字串,要執行的javaScript語法.
124
		$conf["javaScript::toScript"]["script"]=
124
		$conf["javaScript::toScript"]["script"]=
125
		"
125
		"
126
		//建立 canvas
126
		//建立 canvas
127
		var canvas=document.createElement('canvas');
127
		var canvas=document.createElement('canvas');
128
		
128
 
129
		//設置寬度為 100%
129
		//設置寬度為 100%
130
		canvas.style.width='100%';
130
		canvas.style.width='100%';
131
		
131
 
132
		//設置高度為 100% - logo
132
		//設置高度為 100% - logo
133
		canvas.style.height='calc( 100% - 20px )';
133
		canvas.style.height='calc( 100% - 20px )';
134
		
134
 
135
		//放置 canvas
135
		//放置 canvas
136
		document.body.prepend(canvas);
136
		document.body.prepend(canvas);
137
		
137
 
138
		//代表要使用2D環境
138
		//代表要使用2D環境
139
		var context2D=canvas.getContext('2d');
139
		var context2D=canvas.getContext('2d');
140
		
140
 
141
		//設置顏色為全黑
141
		//設置顏色為全黑
142
		context2D.fillStyle='#000000';
142
		context2D.fillStyle='#000000';
143
		
143
 
144
		//繪製矩形,寬為500px,高為300px
144
		//繪製矩形,寬為500px,高為300px
145
		context2D.fillRect(0,0,500,300);
145
		context2D.fillRect(0,0,500,300);
146
		
146
 
147
		//設置白色
147
		//設置白色
148
		context2D.fillStyle='#ffffff';
148
		context2D.fillStyle='#ffffff';
149
		
149
 
150
		//設置文字大小
150
		//設置文字大小
151
		context2D.font='20px Sans-Serif';
151
		context2D.font='20px Sans-Serif';
152
		
152
 
153
		//設置對齊方式
153
		//設置對齊方式
154
		context2D.textBaseline='top';
154
		context2D.textBaseline='top';
155
		
155
 
156
		//放置文字
156
		//放置文字
157
		context2D.fillText('Hello World!',0,0);
157
		context2D.fillText('Hello World!',0,0);
158
		
158
 
159
		";
159
		";
160
		#可省略參數:
160
		#可省略參數:
161
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
161
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
162
		#$conf["onReady"]="true";
162
		#$conf["onReady"]="true";
163
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
163
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
Line 171... Line 171...
171
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
171
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
172
		unset($conf["javaScript::toScript"]);
172
		unset($conf["javaScript::toScript"]);
173
 
173
 
174
		#如果建立失敗
174
		#如果建立失敗
175
		if($toScript["status"]==="false"){
175
		if($toScript["status"]==="false"){
176
		
176
 
177
			#印出結果
177
			#印出結果
178
			var_dump($toScript);
178
			var_dump($toScript);
179
			
179
 
180
			#結束執行
180
			#結束執行
181
			exit;
181
			exit;
182
		
182
 
183
			}#if end
183
			}#if end
184
 
184
 
185
		#印出語法
185
		#印出語法
186
		echo $toScript["content"];
186
		echo $toScript["content"];
187
 
187
 
188
		}#function demo end
188
		}#function demo end
189
 
189
 
190
	}#class canvas end
-
 
191
190
	}#class canvas end
-
 
191