axmol/cocos/base/CCAffineTransform.h

74 lines
3.0 KiB
C
Raw Normal View History

2013-10-12 15:25:45 +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__
#include "CCGeometry.h"
#include "CCPlatformMacros.h"
#include "kazmath/kazmath.h"
#include "CCMath.h"
2013-10-12 15:25:45 +08:00
NS_CC_BEGIN
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
CC_DLL Point __CCPointApplyAffineTransform(const Point& point, const AffineTransform& t);
#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);
CC_DLL Rect RectApplyTransform(const Rect& rect, const Matrix& transform);
CC_DLL Point PointApplyTransform(const Point& point, const Matrix& transform);
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);
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__