Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP Manual > ps_translate - Sets translation





ลองใช้ค้นหาข้อมูล


   
Bookmark.

ps_translate

(PECL ps:1.1.0-1.3.5)

ps_translateSets translation

Description

bool ps_translate ( resource $psdoc , float $x , float $y )

Sets a new initial point of the coordinate system.

Parameters

psdoc

Resource identifier of the postscript file as returned by ps_new().

x

x-coordinate of the origin of the translated coordinate system.

y

y-coordinate of the origin of the translated coordinate system.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 Translation of the coordinate system

<?php
function rectangle($ps) {
    
ps_moveto($ps00);
    
ps_lineto($ps050);
    
ps_lineto($ps5050);
    
ps_lineto($ps500);
    
ps_lineto($ps00);
    
ps_stroke($ps);
}

$ps ps_new();
if (!
ps_open_file($ps"translate.ps")) {
  print 
"Cannot open PostScript file\n";
  exit;
}

ps_set_info($ps"Creator""translate.php");
ps_set_info($ps"Author""Uwe Steinmann");
ps_set_info($ps"Title""Translated example");
ps_set_info($ps"BoundingBox""0 0 596 842");

$psfont ps_findfont($ps"Helvetica"""0);

ps_begin_page($ps596842);
ps_set_text_pos($ps100100);
ps_translate($ps500750);
rectangle($ps);
ps_translate($ps, -500, -750);
ps_setfont($ps$psfont8.0);
ps_show($ps"Text at initial position");
ps_end_page($ps);

ps_begin_page($ps596842);
ps_set_text_pos($ps100100);
ps_save($ps);
ps_translate($ps500750);
rectangle($ps);
ps_restore($ps);
ps_setfont($ps$psfont8.0);
ps_show($ps"Text at initial position");
ps_end_page($ps);

ps_delete($ps);
?>

The above example demonstrates two possible ways to place a graphic (in this case just a rectangle) at any position on the page, while the graphic itself uses its own coordinate system. The trick is to change the origin of the current coordinate system before drawing the rectangle. The translation has to undone after the graphic has been drawn.

On the second page a slightly different and more elegant approach is applied. Instead of undoing the translation with a second call of ps_translate() the graphics context is saved before modifying the coordinate system and restored after drawing the rectangle.



ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่