类的使用demo:

<?php
//http://www.cnblogs.com/roucheng/
require_once "roucheng.php";
$gr = new gifresizer;
$gr->temp_dir = "keleyi";
$gr->resize("keleyi.gif","keleyi_resized.gif",500,500);
?>

类的源代码,保存为roucheng.php文件:

 <?
/**
*
* Resizes Animated GIF Files
*
* ///IMPORTANT NOTE: The script needs a temporary directory where all the frames should be extracted.
* Create a directory with a 777 permission level and write the path into $temp_dir variable below.
*
* Default directory is "frames".
*/ class gifresizer { public $temp_dir = "frames";
private $pointer = 0;
private $index = 0;
private $globaldata = array();
private $imagedata = array();
private $imageinfo = array();
private $handle = 0;
private $orgvars = array();
private $encdata = array();
private $parsedfiles = array();
private $originalwidth = 0;
private $originalheight = 0;
private $wr,$hr;
private $props = array();
private $decoding = false; /**
* Public part of the class
*
* @orgfile - Original file path
* @newfile - New filename with path
* @width - Desired image width
* @height - Desired image height
*/
function resize($orgfile,$newfile,$width,$height){
$this->decode($orgfile);
$this->wr=$width/$this->originalwidth;
$this->hr=$height/$this->originalheight;
$this->resizeframes();
$this->encode($newfile,$width,$height);
$this->clearframes();
} /**
* GIF Decoder function.
* Parses the GIF animation into single frames.
*/
private function decode($filename){
$this->decoding = true;
$this->clearvariables();
$this->loadfile($filename);
$this->get_gif_header();
$this->get_graphics_extension(0);
$this->get_application_data();
$this->get_application_data();
$this->get_image_block(0);
$this->get_graphics_extension(1);
$this->get_comment_data();
$this->get_application_data();
$this->get_image_block(1);
while(!$this->checkbyte(0x3b) && !$this->checkEOF()){
$this->get_comment_data(1);
$this->get_graphics_extension(2);
$this->get_image_block(2);
}
$this->writeframes(time());
$this->closefile();
$this->decoding = false;
} /**
* GIF Encoder function.
* Combines the parsed GIF frames into one single animation.
*/
private function encode($new_filename,$newwidth,$newheight){
$mystring = "";
$this->pointer = 0;
$this->imagedata = array();
$this->imageinfo = array();
$this->handle = 0;
$this->index=0; $k=0;
foreach($this->parsedfiles as $imagepart){
$this->loadfile($imagepart);
$this->get_gif_header();
$this->get_application_data();
$this->get_comment_data();
$this->get_graphics_extension(0);
$this->get_image_block(0); //get transparent color index and color
if(isset($this->encdata[$this->index-1]))
$gxdata = $this->encdata[$this->index-1]["graphicsextension"];
else
$gxdata = null;
$ghdata = $this->imageinfo["gifheader"];
$trcolor = "";
$hastransparency=($gxdata[3]&&1==1); if($hastransparency){
$trcx = ord($gxdata[6]);
$trcolor = substr($ghdata,13+$trcx*3,3);
} //global color table to image data;
$this->transfercolortable($this->imageinfo["gifheader"],$this->imagedata[$this->index-1]["imagedata"]); $imageblock = &$this->imagedata[$this->index-1]["imagedata"]; //if transparency exists transfer transparency index
if($hastransparency){
$haslocalcolortable = ((ord($imageblock[9])&128)==128);
if($haslocalcolortable){
//local table exists. determine boundaries and look for it.
$tablesize=(pow(2,(ord($imageblock[9])&7)+1)*3)+10;
$this->orgvars[$this->index-1]["transparent_color_index"] =
((strrpos(substr($this->imagedata[$this->index-1]["imagedata"],0,$tablesize),$trcolor)-10)/3);
}else{
//local table doesnt exist, look at the global one.
$tablesize=(pow(2,(ord($gxdata[10])&7)+1)*3)+10;
$this->orgvars[$this->index-1]["transparent_color_index"] =
((strrpos(substr($ghdata,0,$tablesize),$trcolor)-10)/3);
}
} //apply original delay time,transparent index and disposal values to graphics extension if(!$this->imagedata[$this->index-1]["graphicsextension"]) $this->imagedata[$this->index-1]["graphicsextension"] = chr(0x21).chr(0xf9).chr(0x04).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x00); $imagedata = &$this->imagedata[$this->index-1]["graphicsextension"]; $imagedata[3] = chr((ord($imagedata[3]) & 0xE3) | ($this->orgvars[$this->index-1]["disposal_method"] << 2));
$imagedata[4] = chr(($this->orgvars[$this->index-1]["delay_time"] % 256));
$imagedata[5] = chr(floor($this->orgvars[$this->index-1]["delay_time"] / 256));
if($hastransparency){
$imagedata[6] = chr($this->orgvars[$this->index-1]["transparent_color_index"]);
}
$imagedata[3] = chr(ord($imagedata[3])|$hastransparency); //apply calculated left and top offset
$imageblock[1] = chr(round(($this->orgvars[$this->index-1]["offset_left"]*$this->wr) % 256));
$imageblock[2] = chr(floor(($this->orgvars[$this->index-1]["offset_left"]*$this->wr) / 256));
$imageblock[3] = chr(round(($this->orgvars[$this->index-1]["offset_top"]*$this->hr) % 256));
$imageblock[4] = chr(floor(($this->orgvars[$this->index-1]["offset_top"]*$this->hr) / 256)); if($this->index==1){
if(!isset($this->imageinfo["applicationdata"]) || !$this->imageinfo["applicationdata"])
$this->imageinfo["applicationdata"]=chr(0x21).chr(0xff).chr(0x0b)."NETSCAPE2.0".chr(0x03).chr(0x01).chr(0x00).chr(0x00).chr(0x00);
if(!isset($this->imageinfo["commentdata"]) || !$this->imageinfo["commentdata"])
$this->imageinfo["commentdata"] = chr(0x21).chr(0xfe).chr(0x10)."PHPGIFRESIZER1.0".chr(0);
$mystring .= $this->orgvars["gifheader"]. $this->imageinfo["applicationdata"].$this->imageinfo["commentdata"];
if(isset($this->orgvars["hasgx_type_0"]) && $this->orgvars["hasgx_type_0"]) $mystring .= $this->globaldata["graphicsextension_0"];
if(isset($this->orgvars["hasgx_type_1"]) && $this->orgvars["hasgx_type_1"]) $mystring .= $this->globaldata["graphicsextension"];
} $mystring .= $imagedata . $imageblock;
$k++;
$this->closefile();
} $mystring .= chr(0x3b); //applying new width & height to gif header
$mystring[6] = chr($newwidth % 256);
$mystring[7] = chr(floor($newwidth / 256));
$mystring[8] = chr($newheight % 256);
$mystring[9] = chr(floor($newheight / 256));
$mystring[11]= $this->orgvars["background_color"];
//if(file_exists($new_filename)){unlink($new_filename);}
file_put_contents($new_filename,$mystring);
} /**
* Variable Reset function
* If a instance is used multiple times, it's needed. Trust me.
*/
private function clearvariables(){
$this->pointer = 0;
$this->index = 0;
$this->imagedata = array();
$this->imageinfo = array();
$this->handle = 0;
$this->parsedfiles = array();
} /**
* Clear Frames function
* For deleting the frames after encoding.
*/
private function clearframes(){
foreach($this->parsedfiles as $temp_frame){
unlink($temp_frame);
}
} /**
* Frame Writer
* Writes the GIF frames into files.
*/
private function writeframes($prepend){
for($i=0;$i<sizeof($this->imagedata);$i++){
file_put_contents($this->temp_dir."/frame_".$prepend."_".str_pad($i,2,"0",STR_PAD_LEFT).".gif",$this->imageinfo["gifheader"].$this->imagedata[$i]["graphicsextension"].$this->imagedata[$i]["imagedata"].chr(0x3b));
$this->parsedfiles[]=$this->temp_dir."/frame_".$prepend."_".str_pad($i,2,"0",STR_PAD_LEFT).".gif";
}
} /**
* Color Palette Transfer Device
* Transferring Global Color Table (GCT) from frames into Local Color Tables in animation.
*/
private function transfercolortable($src,&$dst){
//src is gif header,dst is image data block
//if global color table exists,transfer it
if((ord($src[10])&128)==128){
//Gif Header Global Color Table Length
$ghctl = pow(2,$this->readbits(ord($src[10]),5,3)+1)*3;
//cut global color table from gif header
$ghgct = substr($src,13,$ghctl);
//check image block color table length
if((ord($dst[9])&128)==128){
//Image data contains color table. skip.
}else{
//Image data needs a color table.
//get last color table length so we can truncate the dummy color table
$idctl = pow(2,$this->readbits(ord($dst[9]),5,3)+1)*3;
//set color table flag and length
$dst[9] = chr(ord($dst[9]) | (0x80 | (log($ghctl/3,2)-1)));
//inject color table
$dst = substr($dst,0,10).$ghgct.substr($dst,-1*strlen($dst)+10);
}
}else{
//global color table doesn't exist. skip.
}
} /**
* GIF Parser Functions.
* Below functions are the main structure parser components.
*/
private function get_gif_header(){
$this->p_forward(10);
if($this->readbits(($mybyte=$this->readbyte_int()),0,1)==1){
$this->p_forward(2);
$this->p_forward(pow(2,$this->readbits($mybyte,5,3)+1)*3);
}else{
$this->p_forward(2);
} $this->imageinfo["gifheader"]=$this->datapart(0,$this->pointer);
if($this->decoding){
$this->orgvars["gifheader"]=$this->imageinfo["gifheader"];
$this->originalwidth = ord($this->orgvars["gifheader"][7])*256+ord($this->orgvars["gifheader"][6]);
$this->originalheight = ord($this->orgvars["gifheader"][9])*256+ord($this->orgvars["gifheader"][8]);
$this->orgvars["background_color"]=$this->orgvars["gifheader"][11];
} }
//-------------------------------------------------------
private function get_application_data(){
$startdata = $this->readbyte(2);
if($startdata==chr(0x21).chr(0xff)){
$start = $this->pointer - 2;
$this->p_forward($this->readbyte_int());
$this->read_data_stream($this->readbyte_int());
$this->imageinfo["applicationdata"] = $this->datapart($start,$this->pointer-$start);
}else{
$this->p_rewind(2);
}
}
//-------------------------------------------------------
private function get_comment_data(){
$startdata = $this->readbyte(2);
if($startdata==chr(0x21).chr(0xfe)){
$start = $this->pointer - 2;
$this->read_data_stream($this->readbyte_int());
$this->imageinfo["commentdata"] = $this->datapart($start,$this->pointer-$start);
}else{
$this->p_rewind(2);
}
}
//-------------------------------------------------------
private function get_graphics_extension($type){
$startdata = $this->readbyte(2);
if($startdata==chr(0x21).chr(0xf9)){
$start = $this->pointer - 2;
$this->p_forward($this->readbyte_int());
$this->p_forward(1);
if($type==2){
$this->imagedata[$this->index]["graphicsextension"] = $this->datapart($start,$this->pointer-$start);
}else if($type==1){
$this->orgvars["hasgx_type_1"] = 1;
$this->globaldata["graphicsextension"] = $this->datapart($start,$this->pointer-$start);
}else if($type==0 && $this->decoding==false){
$this->encdata[$this->index]["graphicsextension"] = $this->datapart($start,$this->pointer-$start);
}else if($type==0 && $this->decoding==true){
$this->orgvars["hasgx_type_0"] = 1;
$this->globaldata["graphicsextension_0"] = $this->datapart($start,$this->pointer-$start);
}
}else{
$this->p_rewind(2);
}
}
//-------------------------------------------------------
private function get_image_block($type){
if($this->checkbyte(0x2c)){
$start = $this->pointer;
$this->p_forward(9);
if($this->readbits(($mybyte=$this->readbyte_int()),0,1)==1){
$this->p_forward(pow(2,$this->readbits($mybyte,5,3)+1)*3);
}
$this->p_forward(1);
$this->read_data_stream($this->readbyte_int());
$this->imagedata[$this->index]["imagedata"] = $this->datapart($start,$this->pointer-$start); if($type==0){
$this->orgvars["hasgx_type_0"] = 0;
if(isset($this->globaldata["graphicsextension_0"]))
$this->imagedata[$this->index]["graphicsextension"]=$this->globaldata["graphicsextension_0"];
else
$this->imagedata[$this->index]["graphicsextension"]=null;
unset($this->globaldata["graphicsextension_0"]);
}elseif($type==1){
if(isset($this->orgvars["hasgx_type_1"]) && $this->orgvars["hasgx_type_1"]==1){
$this->orgvars["hasgx_type_1"] = 0;
$this->imagedata[$this->index]["graphicsextension"]=$this->globaldata["graphicsextension"];
unset($this->globaldata["graphicsextension"]);
}else{
$this->orgvars["hasgx_type_0"] = 0;
$this->imagedata[$this->index]["graphicsextension"]=$this->globaldata["graphicsextension_0"];
unset($this->globaldata["graphicsextension_0"]);
}
} $this->parse_image_data();
$this->index++; }
}
//-------------------------------------------------------
private function parse_image_data(){
$this->imagedata[$this->index]["disposal_method"] = $this->get_imagedata_bit("ext",3,3,3);
$this->imagedata[$this->index]["user_input_flag"] = $this->get_imagedata_bit("ext",3,6,1);
$this->imagedata[$this->index]["transparent_color_flag"] = $this->get_imagedata_bit("ext",3,7,1);
$this->imagedata[$this->index]["delay_time"] = $this->dualbyteval($this->get_imagedata_byte("ext",4,2));
$this->imagedata[$this->index]["transparent_color_index"] = ord($this->get_imagedata_byte("ext",6,1));
$this->imagedata[$this->index]["offset_left"] = $this->dualbyteval($this->get_imagedata_byte("dat",1,2));
$this->imagedata[$this->index]["offset_top"] = $this->dualbyteval($this->get_imagedata_byte("dat",3,2));
$this->imagedata[$this->index]["width"] = $this->dualbyteval($this->get_imagedata_byte("dat",5,2));
$this->imagedata[$this->index]["height"] = $this->dualbyteval($this->get_imagedata_byte("dat",7,2));
$this->imagedata[$this->index]["local_color_table_flag"] = $this->get_imagedata_bit("dat",9,0,1);
$this->imagedata[$this->index]["interlace_flag"] = $this->get_imagedata_bit("dat",9,1,1);
$this->imagedata[$this->index]["sort_flag"] = $this->get_imagedata_bit("dat",9,2,1);
$this->imagedata[$this->index]["color_table_size"] = pow(2,$this->get_imagedata_bit("dat",9,5,3)+1)*3;
$this->imagedata[$this->index]["color_table"] = substr($this->imagedata[$this->index]["imagedata"],10,$this->imagedata[$this->index]["color_table_size"]);
$this->imagedata[$this->index]["lzw_code_size"] = ord($this->get_imagedata_byte("dat",10,1));
if($this->decoding){
$this->orgvars[$this->index]["transparent_color_flag"] = $this->imagedata[$this->index]["transparent_color_flag"];
$this->orgvars[$this->index]["transparent_color_index"] = $this->imagedata[$this->index]["transparent_color_index"];
$this->orgvars[$this->index]["delay_time"] = $this->imagedata[$this->index]["delay_time"];
$this->orgvars[$this->index]["disposal_method"] = $this->imagedata[$this->index]["disposal_method"];
$this->orgvars[$this->index]["offset_left"] = $this->imagedata[$this->index]["offset_left"];
$this->orgvars[$this->index]["offset_top"] = $this->imagedata[$this->index]["offset_top"];
}
}
//-------------------------------------------------------
private function get_imagedata_byte($type,$start,$length){
if($type=="ext")
return substr($this->imagedata[$this->index]["graphicsextension"],$start,$length);
elseif($type=="dat")
return substr($this->imagedata[$this->index]["imagedata"],$start,$length);
}
//-------------------------------------------------------
private function get_imagedata_bit($type,$byteindex,$bitstart,$bitlength){
if($type=="ext")
return $this->readbits(ord(substr($this->imagedata[$this->index]["graphicsextension"],$byteindex,1)),$bitstart,$bitlength);
elseif($type=="dat")
return $this->readbits(ord(substr($this->imagedata[$this->index]["imagedata"],$byteindex,1)),$bitstart,$bitlength);
}
//-------------------------------------------------------
private function dualbyteval($s){
$i = ord($s[1])*256 + ord($s[0]);
return $i;
}
//------------ Helper Functions ---------------------
private function read_data_stream($first_length){
$this->p_forward($first_length);
$length=$this->readbyte_int();
if($length!=0) {
while($length!=0){
$this->p_forward($length);
$length=$this->readbyte_int();
}
}
return true;
}
//-------------------------------------------------------
private function loadfile($filename){
$this->handle = fopen($filename,"rb");
$this->pointer = 0;
}
//-------------------------------------------------------
private function closefile(){
fclose($this->handle);
$this->handle=0;
}
//-------------------------------------------------------
private function readbyte($byte_count){
$data = fread($this->handle,$byte_count);
$this->pointer += $byte_count;
return $data;
}
//-------------------------------------------------------
private function readbyte_int(){
$data = fread($this->handle,1);
$this->pointer++;
return ord($data);
}
//-------------------------------------------------------
private function readbits($byte,$start,$length){
$bin = str_pad(decbin($byte),8,"0",STR_PAD_LEFT);
$data = substr($bin,$start,$length);
return bindec($data);
}
//-------------------------------------------------------
private function p_rewind($length){
$this->pointer-=$length;
fseek($this->handle,$this->pointer);
}
//-------------------------------------------------------
private function p_forward($length){
$this->pointer+=$length;
fseek($this->handle,$this->pointer);
}
//-------------------------------------------------------
private function datapart($start,$length){
fseek($this->handle,$start);
$data = fread($this->handle,$length);
fseek($this->handle,$this->pointer);
return $data;
}
//-------------------------------------------------------
private function checkbyte($byte){
if(fgetc($this->handle)==chr($byte)){
fseek($this->handle,$this->pointer);
return true;
}else{
fseek($this->handle,$this->pointer);
return false;
}
}
//-------------------------------------------------------
private function checkEOF(){
if(fgetc($this->handle)===false){
return true;
}else{
fseek($this->handle,$this->pointer);
return false;
}
}
//-------------------------------------------------------
/**
* Debug Functions. keleyi.com
* Parses the GIF animation into single frames.
*/
private function debug($string){
echo "<pre>";
for($i=0;$i<strlen($string);$i++){
echo str_pad(dechex(ord($string[$i])),2,"0",STR_PAD_LEFT). " ";
}
echo "</pre>";
}
//-------------------------------------------------------
private function debuglen($var,$len){
echo "<pre>";
for($i=0;$i<$len;$i++){
echo str_pad(dechex(ord($var[$i])),2,"0",STR_PAD_LEFT). " ";
}
echo "</pre>";
}
//-------------------------------------------------------
private function debugstream($length){
$this->debug($this->datapart($this->pointer,$length));
}
//-------------------------------------------------------
/**
* GD Resizer Device
* Resizes the animation frames
*/
private function resizeframes(){
$k=0;
foreach($this->parsedfiles as $img){
$src = imagecreatefromgif($img);
$sw = $this->imagedata[$k]["width"];
$sh = $this->imagedata[$k]["height"];
$nw = round($sw * $this->wr);
$nh = round($sh * $this->hr);
$sprite = imagecreatetruecolor($nw,$nh);
$trans = imagecolortransparent($sprite);
imagealphablending($sprite, false);
imagesavealpha($sprite, true);
imagepalettecopy($sprite,$src);
imagefill($sprite,0,0,imagecolortransparent($src));
imagecolortransparent($sprite,imagecolortransparent($src));
imagecopyresized($sprite,$src,0,0,0,0,$nw,$nh,$sw,$sh);
imagegif($sprite,$img);
imagedestroy($sprite);
imagedestroy($src);
$k++;
}
}
} ?>

可以调整gif动画图片尺寸的很实用的php类的更多相关文章

  1. PHPThumb处理图片,生成缩略图,图片尺寸调整,图片截取,图片加水印,图片旋转

    [强烈推荐]下载地址(github.com/masterexploder/PHPThumb). 注意这个类库有一个重名的叫phpThumb,只是大小写的差别,所以查找文档的时候千万注意. 在网站建设过 ...

  2. .NET 调整图片尺寸(Resize)各种方法

    本文中如无特别说明 .NET 指 .NET 5或者更高版本,代码同样可用于 .NET Core 前言 调整图片尺寸最常用的场景就是生成缩略图,一般为保持纵横比缩小,如果图片放大会使图片变得模糊,如果确 ...

  3. OpenCV图像金字塔:高斯金字塔、拉普拉斯金字塔与图片尺寸缩放

    这篇已经写得很好,真心给作者点个赞.题目都是直接转过来的,直接去看吧. Reference Link : http://blog.csdn.net/poem_qianmo/article/detail ...

  4. CSS3------background-size(背景图片尺寸属性)

    background-size 可以设置背景图片的大小,数值包括 长度length和百分比percentage. 并且会根据背景原点位置 background-origin 设置其图片覆盖的范围.那么 ...

  5. javascript加载图片获取图片尺寸信息方法

    如果你遇到不方便从服务器取图片尺寸信息的话,用下面代码就很方便了. // 更新: // 05.27: 1.保证回调执行顺序:error > ready > load:2.回调函数this指 ...

  6. 学习 opencv---(12)OpenCV 图像金字塔:高斯金字塔,拉普拉斯金字塔与图片尺寸缩放

    在这篇文章里,我们一起学习下 图像金字塔 的一些基本概念,如何使用OpenCV函数pyrUp和pyrDown 对图像进行向上和向下采样,以及了解专门用于缩放图像尺寸的resize函数的用法.此博文一共 ...

  7. opencv 4 图像处理(漫水填充,图像金字塔与图片尺寸缩放,阈(yu)值化)

    漫水填充 实现漫水填充算法:floodFill函数 简单调用范例 #include <opencv2/opencv.hpp> #include <opencv2/imgproc/im ...

  8. iOS 图片大小压缩 图片尺寸处理

    图片的压缩其实是俩概念,1.是 “压” 文件体积变小,但是像素数不变,长宽尺寸不变,那么质量可能下降,2.是 “缩” 文件的尺寸变小,也就是像素数减少.长宽尺寸变小,文件体积同样会减小. 这个 UII ...

  9. 一款很实用的jQuery鼠标悬浮有动画效果的响应式瀑布流插件

    一款很实用的jQuery鼠标悬浮有动画效果的响应式瀑布流插件 在线预览 下载地址 实例代码 <!doctype html> <html lang="zh"> ...

随机推荐

  1. OpenSSL命令---pkcs7

    用途: 用于处理DER或者PEM格式的pkcs#7文件. 用法: openssl pkcs7 [-inform PEM|DER] [-outform PEM|DER] [-in filename] [ ...

  2. [转] jQuery对象与DOM对象之间的转换

    http://wozailongyou.iteye.com/blog/299311 http://blog.allenm.me/2009/07/jquery%E4%B8%ADid%E5%92%8Cdo ...

  3. .net微信公众号开发——模板消息

    作者:王先荣    本文介绍微信公众号中的模板消息,包括以下内容:(1)TemplateMessage类简介:(2)设置所属行业:(3)获得模板id:(4)发送模板消息:(5)接收推送模板消息发送结果 ...

  4. 【cocos2d-x 手游研发小技巧(8)通讯的数据压缩与解压 】

    今天说一下手机游戏通讯协议中的数据问题,大量的数据将给服务器端和客户端带来很大的压力,一般来说. 转载请注明出处:http://www.cnblogs.com/zisou/p/cocos2dxJQ-8 ...

  5. WCF关于svcutil生成关于绑定出现 元数据包含无法解析的引用的解决方案

    元数据包含无法解析的引用. 没有终结点在侦听可以接受消息的 net.tcp://localhost:8000/service.这通常是由于不正确的地址或者 SOAP 操作导致的.如果存在此情况,请参阅 ...

  6. Bulk Insert的用法 .

    /******* 导出到excel */EXEC master..xp_cmdshell 'bcp SettleDB.dbo.shanghu out c:/temp1.xls -c -q -S&quo ...

  7. HDU 3487 Play with Chain(Splay)

    题目大意 给一个数列,初始时为 1, 2, 3, ..., n,现在有两种共 m 个操作 操作1. CUT a b c 表示把数列中第 a 个到第 b 个从原数列中删除得到一个新数列,并将它添加到新数 ...

  8. 使用UIKit制作卡牌游戏(三)ios游戏篇

    译者: Lao Jiang | 原文作者: Matthijs Hollemans写于2012/07/13 转自朋友Tommy 的翻译,自己只翻译了这第三篇教程. 原文地址: http://www.ra ...

  9. JavaScript基础知识整理

    只整理基础知识中关键技术,旨在系统性的学习和备忘. 1.在 JScript 中 null 和 undefined 的主要区别是 null 的操作象数字 0,而 undefined 的操作象特殊值NaN ...

  10. NavMesh名字、层索引、层值之间的转换

    // Nav层名字-->层的值,1.2.4.8.16 public static int AgentLayerNameToValue(string name) { int idx = NavMe ...