功能{}

在本文中

方法

姓名描述
功能::get_item_Features从存储的内部功能绑定通道的宽度、高度、位深度和数量。
功能::get_primary_item_Features查找主要项的宽度、高度、位深度和通道数。

来源

类功能{public$has_primary_item=false;//如果解析了“pitm”,则为True。public$has_alpha=false;//如果分析了alpha“auxC”,则为True。公共$primary_item_id;public$primary_item_features=array(//从下面的数据中扣除。“width”=>UNDEFINED,//像素数。'height'=>UNDEFINED,//忽略镜像和旋转。“bit_depth”=>未定义,//每像素每个通道可能有8、10或12位。'num_channels'=>未定义//可能为1、2、3或4个通道://(1单色或3色)+(0或1 alpha));公共$tiles=数组();//平铺[]public$props=数组();//道具[]public$dim_props=数组();//维度_属性[]public$chan_props=array();//频道_节目[]/***从存储的内部功能绑定通道的宽度、高度、位深度和数量。**@param int$target_item_id特性将被绑定的项的id。*@param int$tile_depth在tile-parent关系中搜索的最大递归。*@return成功时状态为FOUND,失败时状态为NOT_FOUND。*/私有函数get_item_features($target_itemid,$tile_depth){foreach($this->props作为$prop){if($prop->itemid!=$targetitemid){继续;}//检索主要项的宽度和高度(如果尚未检索)。if($target_item_id==$this->primary_item_id&&($this->primary_item_features['width']==未定义||$this->primary_item_features['height']==UNDEFINED)){foreach($this->dimprops作为$dimprop){if($dim_prop->property_index!=$prop->property _index){继续;}$this->primary_item_features['width']=$dim_prop->width;$this->primary_item_features['height']=$dim_prop->height;if($this->primary_item_features['bit_depth']!=未定义&&$this->primary_item_features['num_channels']!=未定义){返回FOUND;}断裂;}}//如果没有,检索目标项的位深度和通道数//已经完成了。if($this->primary_item_features['bit_depth']==未定义||$this->primary_item_features['num_channels']==未定义){foreach($this->chan_props作为$chan_prop){if($chan_prop->property_index!=$prop->property _index){继续;}$this->primary_item_features['bit_depth']=$chan_prop->bit_dept;$this->primary_item_features['num_channels']=$chan_prop->num_cchannels;if($this->primary_item_features['width']!=未定义&&$this->primary_item_features['height']!=未定义){返回FOUND;}断裂;}}}//如果尚未找到平铺中的bit_depth和num_channels,请检查它们。if($tile_depth<3){foreach($this->平铺为$tile){if($tile->parent_item_id!=$target_item_id){继续;}$status=获取项特性($tile->tile_item_id,$tile_depth+1);if($status!=NOT_FOUND){返回$status;}}}返回NOT_FOUND;}/***查找主要项的宽度、高度、位深度和通道数。**@return成功时Status FOUND或失败时NOT_FOUND。*/公共函数get_primary_item_features(){//如果没有主项ID,则无需执行任何操作。如果(!$this->has_primary_item){返回NOT_FOUND;}//提前退出。if(空($this->dimprops)||empty($this->chan_props)){返回NOT_FOUND;}$status=$this->get_item_features($this->主项id,/*tile_depth=*/0);if($status!=找到){返回$status;}//“auxC”是在“ipma”属性之前解析的,因此现在已知它(如果有)。if($this->has_alpha){++$this->primary_item_features['num_channels'];}返回FOUND;}}

用户贡献的笔记

你必须登录在能够发表注释或反馈之前。