2013-10-12 15:25:45 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:47:11 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2013-10-12 15:25:45 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __COCOA_CGAFFINETRANSFORM_H__
|
|
|
|
#define __COCOA_CGAFFINETRANSFORM_H__
|
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "base/CCGeometry.h"
|
|
|
|
#include "base/CCPlatformMacros.h"
|
2014-04-26 13:03:25 +08:00
|
|
|
#include "math/CCMath.h"
|
2013-10-12 15:25:45 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2014-04-09 14:21:41 +08:00
|
|
|
USING_NS_CC_MATH;
|
|
|
|
|
2013-10-12 15:25:45 +08:00
|
|
|
struct AffineTransform {
|
|
|
|
float a, b, c, d;
|
|
|
|
float tx, ty;
|
|
|
|
|
|
|
|
static const AffineTransform IDENTITY;
|
|
|
|
};
|
|
|
|
|
|
|
|
CC_DLL AffineTransform __CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty);
|
|
|
|
#define AffineTransformMake __CCAffineTransformMake
|
|
|
|
|
2014-04-15 18:08:29 +08:00
|
|
|
CC_DLL Vector2 __CCPointApplyAffineTransform(const Vector2& point, const AffineTransform& t);
|
2013-10-12 15:25:45 +08:00
|
|
|
#define PointApplyAffineTransform __CCPointApplyAffineTransform
|
|
|
|
|
|
|
|
CC_DLL Size __CCSizeApplyAffineTransform(const Size& size, const AffineTransform& t);
|
|
|
|
#define SizeApplyAffineTransform __CCSizeApplyAffineTransform
|
|
|
|
|
|
|
|
CC_DLL AffineTransform AffineTransformMakeIdentity();
|
|
|
|
CC_DLL Rect RectApplyAffineTransform(const Rect& rect, const AffineTransform& anAffineTransform);
|
|
|
|
|
2014-04-09 14:21:41 +08:00
|
|
|
CC_DLL Rect RectApplyTransform(const Rect& rect, const Matrix& transform);
|
2014-04-15 18:08:29 +08:00
|
|
|
CC_DLL Vector2 PointApplyTransform(const Vector2& point, const Matrix& transform);
|
2013-12-10 09:32:51 +08:00
|
|
|
|
2013-10-12 15:25:45 +08:00
|
|
|
CC_DLL AffineTransform AffineTransformTranslate(const AffineTransform& t, float tx, float ty);
|
|
|
|
CC_DLL AffineTransform AffineTransformRotate(const AffineTransform& aTransform, float anAngle);
|
|
|
|
CC_DLL AffineTransform AffineTransformScale(const AffineTransform& t, float sx, float sy);
|
|
|
|
CC_DLL AffineTransform AffineTransformConcat(const AffineTransform& t1, const AffineTransform& t2);
|
|
|
|
CC_DLL bool AffineTransformEqualToTransform(const AffineTransform& t1, const AffineTransform& t2);
|
|
|
|
CC_DLL AffineTransform AffineTransformInvert(const AffineTransform& t);
|
|
|
|
|
2014-04-09 14:21:41 +08:00
|
|
|
Matrix TransformConcat(const Matrix& t1, const Matrix& t2);
|
2013-12-11 03:07:15 +08:00
|
|
|
|
2013-10-12 15:25:45 +08:00
|
|
|
extern CC_DLL const AffineTransform AffineTransformIdentity;
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif // __COCOA_CGAFFINETRANSFORM_H__
|