
简单方法就是 ActualHeight SacleY还有一个方法稍微麻烦些,就是用 GeneralTransformTransform(Point point),或者TransformBounds大概思路看下面的方法。public Rect GetBounds(FrameworkElement of, FrameworkElement from){// Might throw an exception if of and from are not in the same visual treeGeneralTransform transform = ofTransformToVisual(from);return transformTransformBounds(new Rect(0, 0, ofActualWidth, ofActualHeight));}
我也不能解释的很清楚,说的不对的其他童鞋指正下:
transform的结构如下:
struct CATransform3D
{
CGFloat m11, m12, m13, m14;
CGFloat m21, m22, m23, m24;
CGFloat m31, m32, m33, m34;
CGFloat m41, m42, m43, m44;
};
首先要实现view(layer)的透视效果(就是近大远小),是通过设置m34的:
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransformm34 = 10 / -500;
m34负责z轴方向的translation(移动),m34= -1/D, 默认值是0,也就是说D无穷大,这意味layer in projection plane(投射面)和layer in world coordinate重合了。
D越小透视效果越明显。
所谓的D,是eye(观察者)到投射面的距离。
设置变形函数。
transform-function用于设置变形函数,可以是一个或多个变形函数列表。
在上面的语法格式中,transform属性的默认值为none,适用于内联元素和块元素,表示不进行变形。
以上就是关于使用ScaleTransform对图片进行缩放时怎么获取图片缩放后的实际尺寸全部的内容,包括:使用ScaleTransform对图片进行缩放时怎么获取图片缩放后的实际尺寸、哪位老师可以讲解下CATransform3D m34字段的取值信息、transform-function函数的用法等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)