- 浏览: 356622 次
文章分类
最新评论
-
lord_is_layuping:
...
PYQT4 + Python2.6 + eric4-4.2.2a的安装全过程 -
597272095:
3Q
Oracle客户端PL/SQL 中文乱码解决 -
lpluck08:
如果不是在git本地版本目录中执行的话,会有问题。到本地版本目 ...
git 中文文件名 乱码 mac -
aiove:
-API
分享到: 阿撒旦发撒旦发速度飞洒发
iOS开发开源项目推荐 -
Wallian_hua:
感谢,楼主的详细分析,对我的启发很大。。我也正在研究这方面的技 ...
[ZT]简单OCR实现原理
CGAffineTransform rotation = CGAffineTransformMakeRotation(M_PI_2); 顺便记录一些常量,以后用的着! #define M_E 2.71828182845904523536028747135266250 e from:http://donbe.blog.163.com/blog/static/138048021201061054243442/
[xxx setTransform:rotation];
呵呵就这么简单的两行代码就可以实现了!
#define M_LOG2E 1.44269504088896340735992468100189214 log 2e
#define M_LOG10E 0.434294481903251827651128918916605082 log 10e
#define M_LN2 0.693147180559945309417232121458176568 log e2
#define M_LN10 2.30258509299404568401799145468436421 log e10
#define M_PI 3.14159265358979323846264338327950288 pi
#define M_PI_2 1.57079632679489661923132169163975144 pi/2
#define M_PI_4 0.785398163397448309615660845819875721 pi/4
#define M_1_PI 0.318309886183790671537767526745028724 1/pi
#define M_2_PI 0.636619772367581343075535053490057448 2/pi
#define M_2_SQRTPI 1.12837916709551257389615890312154517 2/sqrt(pi)
#define M_SQRT2 1.41421356237309504880168872420969808 sqrt(2)
#define M_SQRT1_2 0.707106781186547524400844362104849039 1/sqrt(2)
CGAffineTransformMakeTranslation(width, 0.0);是改变位置的,
CGAffineTransformRotate(transform, M_PI);是旋转的。
CGAffineTransformMakeRotation(-M_PI);也是旋转的
transform = CGAffineTransformScale(transform, -1.0, 1.0);是缩放的。
view.transform = CGAffineTransformIdentity;线性代数里面讲的矩阵变换,这个是恒等变换
当你改变过一个view.transform属性或者view.layer.transform的时候需要恢复默认状态的话,记得先把他们重置可以使用view.transform = CGAffineTransformIdentity,或者view.layer.transform = CATransform3DIdentity,假设你一直不断的改变一个view.transform的属性,而每次改变之前没有重置的话,你会发现后来的改变和你想要的发生变化了,不是你真正想要的结果void CGContextDrawImage (
CGContextRef c,
CGRect rect,
CGImageRef image
);
移动函数
CGContextTranslateCTM (myContext, 100, 50);
旋转函数
include <math.h>
static inline double radians (double degrees) {return degrees * M_PI/180;}
CGContextRotateCTM (myContext, radians(–45.));
缩放
CGContextScaleCTM (myContext, .5, .75);
翻转, 两种转换合成后的效果,先把图片移动到右上角,然后旋转180度
CGContextTranslateCTM (myContext, w,h);
CGContextRotateCTM (myContext, radians(-180.));
组合几个动作
CGContextTranslateCTM (myContext, w/4, 0);
CGContextScaleCTM (myContext, .25, .5);
CGContextRotateCTM (myContext, radians ( 22.));
CGContextRotateCTM (myContext, radians ( 22.));
CGContextScaleCTM (myContext, .25, .5);
CGContextTranslateCTM (myContext, w/4, 0);
上面是通过直接修改当前的ctm实现3大效果,下面是通过创建Affine Transforms,然后连接ctm实现同样的3种效果
这样做的好处是可以重用这个Affine Transforms
应用Affine Transforms 到ctm的函数
void CGContextConcatCTM (
CGContextRef c,
CGAffineTransform transform
);
Creating Affine Transforms
移动效果
CGAffineTransform CGAffineTransformMakeTranslation (
CGFloat tx,
CGFloat ty
);
CGAffineTransform CGAffineTransformTranslate (
CGAffineTransform t,
CGFloat tx,
CGFloat ty
);
旋转效果
CGAffineTransform CGAffineTransformMakeRotation (
CGFloat angle
);
CGAffineTransform CGAffineTransformRotate (
CGAffineTransform t,
CGFloat angle
);
缩放效果
CGAffineTransform CGAffineTransformMakeScale (
CGFloat sx,
CGFloat sy
);
CGAffineTransform CGAffineTransformScale (
CGAffineTransform t,
CGFloat sx,
CGFloat sy
);
反转效果
CGAffineTransform CGAffineTransformInvert (
CGAffineTransform t
);
只对局部产生效果
CGRect CGRectApplyAffineTransform (
CGRect rect,
CGAffineTransform t
);
判断两个AffineTrans是否相等
bool CGAffineTransformEqualToTransform (
CGAffineTransform t1,
CGAffineTransform t2
);
获得Affine Transform
CGAffineTransform CGContextGetUserSpaceToDeviceSpaceTransform (
CGContextRef c
);
下面的函数只起到查看的效果,比如看一下这个用户空间的点,转换到设备空间去坐标是多少
CGPoint CGContextConvertPointToDeviceSpace (
CGContextRef c,
CGPoint point
);
CGPoint CGContextConvertPointToUserSpace (
CGContextRef c,
CGPoint point
);
CGSize CGContextConvertSizeToDeviceSpace (
CGContextRef c,
CGSize size
);
CGSize CGContextConvertSizeToUserSpace (
CGContextRef c,
CGSize size
);
CGRect CGContextConvertRectToDeviceSpace (
CGContextRef c,
CGRect rect
);
CGRect CGContextConvertRectToUserSpace (
CGContextRef c,
CGRect rect
);
CTM真正的数学行为
这个转换矩阵其实是一个 3x3的 举证
如下图
bool CGAffineTransformIsIdentity (
CGAffineTransform t
);
移动矩阵
缩放矩阵
发表评论
-
[zt]iPhone开发中关于UIView Animation实现效果
2012-08-30 23:04 1325http://mobile.51cto.com/ipho ... -
Appletv3 到手试用 ,并推荐美剧一部
2012-06-04 21:20 1998一直也不知道 appletv 是干什么的,和同学聊起来,似乎他 ... -
mac 批量转换图片格式。
2012-02-05 11:42 1837mkdir jpegs; sips -s fo ... -
IOS 自带动画效果
2011-12-01 14:45 4006在ios view与view间切换的动画效果这篇文章中简单 ... -
[ZT]UITableView下拉刷新页面的实现
2011-12-01 14:02 2533UITableView下拉刷新页面的实现 以前 ... -
iOS的动画效果类型及实现方法
2011-12-01 14:00 4175iOS的动画效果类型及实现方法 ... -
[zt]UIImage图片的缩小与放大
2011-12-01 13:53 1450UIImage可以加载图片,但是我们想要得到一张缩小或放大 ... -
UIView内存释放问题
2011-12-01 11:30 1271UIView内存释放,之前一直以为把alloc的UIVie ... -
[zt]UIScrollView,点击、滑动翻页事件的区分
2011-11-29 10:00 3351UIScrollView,点击、滑动 ... -
iphone中的UITouch
2011-08-31 00:56 2076手指在屏幕上能达到的精度和鼠标指针有很大的不同。当用户触击 ... -
[ZT]UIView的剖析!
2011-08-27 18:49 2565http://blog.csdn.net/mengtnt/ ... -
xcode crash 查找 EXC_BAD_ACCESS 问题根源的方法
2011-06-28 17:49 10112xcode4 4.x EXC_BAD_ACCESS ... -
How To Use the Three20 Photo Viewer
2011-06-23 02:13 1644How To Use the Three20 Photo ... -
iOS开发开源项目推荐
2011-06-10 21:02 23121 tbxml xml解析的类库,只支持解析,不支持写, ... -
在ios应用程序中按目录管理资源
2011-06-10 21:00 5115在ios应用程序中按目录管理资源 在ios的 ... -
UIScrollView分页的实现
2011-06-06 17:14 6065UIScrollView分页的实现 UIScro ... -
编写简单的翻页效果
2011-05-30 21:46 1814http://marshal.easymorse ... -
UIPopoverController
2011-05-21 21:43 17591、初始化UIPopoverController ... -
iphone debug
2011-05-21 01:50 1005在 .pch中加入 #ifndef __OPTI ... -
国际化Iphone的应用程序名称
2011-01-17 13:31 1579http://www.voland.com.cn/iphone ...
相关推荐
自相关函数及互相关函数编程
matlab_随机信号的自相关函数和互相关函数
(完整word版)Matlab自相关函数和互相关函数的计算和作图.pdf(完整word版)Matlab自相关函数和互相关函数的计算和作图.pdf
ARMA模型的自相关函数和偏自相关函数图谱.pdf
自相关函数和互相关函数的利用MATLAB计算和作图.doc
3 matlab噪声的自相关函数和功率谱密度及功率谱估计
随机信号的自相关函数和互相关函数Matlab
C\A 码的产生,以及自相关,互相关函数,画出自相关互相关图(MATLAB语句简单易懂,适合新手)
任给一组数据,通过函数求解样本均值z1、样本自协方差函数r、样本自相关函数p(SACF)和样本偏自相关函数q(SPACF)
Matlab自相关函数和互相关函数的计算和作图
利用相关函数求信号功率谱,信号的自相关函数及不同信号的互相关函数-Use of correlation function for the signal power spectrum, the signal of the autocorrelation function and different signal cross-...
针对语音信号的处理,而提出的自相关函数基音检测算法
自己写的关于循环自相关函数的快速计算方法,不同的调制方式只要更改x_t表达式即可
随机信号的自相关函数和互相关函数Matlab,随机信号自相关函数怎么求,matlab源码
广义互相关函数,包含所有互相关的权函数,可以方便的使用它,其中PHAT加权效果最好!
随机信号及其自相关函数和功率谱密度的MATLAB实现
cw脉冲信号和lfm脉冲信号的自相关函数,发射两路脉冲信号进行自相关函数分析
函数名称 功能描述 表达式用法 abs 绝对值函数 abs(x) 6 sin 正弦函数 sin(x) cos 余弦函数 cos(x) tan 正切函数 tan(x) asin 反正弦函数 asin(x) acos 反余弦函数 acos(x) atan 反正切函数 atan(x) atan2 ...