Author: rmottola
Date: Mon Oct 5 00:18:58 2015
New Revision: 39028
URL: http://svn.gna.org/viewcvs/gnustep?rev=39028&view=rev
Log:
add affine transform
Added:
devmodules/dev-libs/mica/Headers/CoreGraphics/CGAffineTransform.h
Modified:
devmodules/dev-libs/mica/GNUmakefile
devmodules/dev-libs/mica/Headers/CoreGraphics/CGPath.h
devmodules/dev-libs/mica/Headers/CoreGraphics/CoreGraphics.h
devmodules/dev-libs/mica/Sources/CGPath.m
Modified: devmodules/dev-libs/mica/GNUmakefile
URL:
http://svn.gna.org/viewcvs/gnustep/devmodules/dev-libs/mica/GNUmakefile?rev=39028&r1=39027&r2=39028&view=diff
==============================================================================
--- devmodules/dev-libs/mica/GNUmakefile (original)
+++ devmodules/dev-libs/mica/GNUmakefile Mon Oct 5 00:18:58 2015
@@ -25,6 +25,7 @@
# Public headers (will be installed)
#
Mica_HEADER_FILES = \
+CoreGraphics/CGAffineTransform.h \
CoreGraphics/CGBitmapContext.h \
CoreGraphics/CGContext.h \
CoreGraphics/CGGeometry.h \
Added: devmodules/dev-libs/mica/Headers/CoreGraphics/CGAffineTransform.h
URL:
http://svn.gna.org/viewcvs/gnustep/devmodules/dev-libs/mica/Headers/CoreGraphics/CGAffineTransform.h?rev=39028&view=auto
==============================================================================
--- devmodules/dev-libs/mica/Headers/CoreGraphics/CGAffineTransform.h (added)
+++ devmodules/dev-libs/mica/Headers/CoreGraphics/CGAffineTransform.h Mon Oct
5 00:18:58 2015
@@ -0,0 +1,45 @@
+/**
+ Mica: Implementation of CoreGraphics on top of AppKit
+ CGAffineTransform.h
+
+ Copyright (C) 2015 Free Software Foundation, Inc.
+
+ Written by: Riccardo Mottola <[email protected]>
+
+ This file is part of the Mica Framework.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
+ */
+
+#ifndef CGAFFINETRANSFORM_H_
+#define CGAFFINETRANSFORM_H_
+
+#include <CoreGraphics/CGGeometry.h>
+
+typedef struct CGAffineTransform CGAffineTransform;
+
+struct CGAffineTransform
+{
+ CGFloat a;
+ CGFloat b;
+ CGFloat c;
+ CGFloat d;
+ CGFloat tx;
+ CGFloat ty;
+};
+
+
+#endif /* CGAFFINETRANSFORM_H_ */
Modified: devmodules/dev-libs/mica/Headers/CoreGraphics/CGPath.h
URL:
http://svn.gna.org/viewcvs/gnustep/devmodules/dev-libs/mica/Headers/CoreGraphics/CGPath.h?rev=39028&r1=39027&r2=39028&view=diff
==============================================================================
--- devmodules/dev-libs/mica/Headers/CoreGraphics/CGPath.h (original)
+++ devmodules/dev-libs/mica/Headers/CoreGraphics/CGPath.h Mon Oct 5
00:18:58 2015
@@ -30,17 +30,17 @@
#ifdef __OBJC__
@class CGPath;
-typedef CGPath *CGPathRef;
-
-@class CGMutablePath;
-typedef CGMutablePath *CGMutablePathRef;
+typedef const CGPath *CGPathRef;
+typedef CGPath *CGMutablePathRef;
#else /* standard C */
-typedef struct CGPath *CGPathRef;
-typedef struct CGMutablePath *CGMutablePathRef;
+typedef const struct CGPath *CGPathRef;
+typedef struct CGPath *CGMutablePathRef;
#endif /* OBJC */
+
+#include <CoreGraphics/CGAffineTransform.h>
enum CGPathDrawingMode
{
@@ -78,6 +78,8 @@
};
typedef enum CGLineJoin CGLineJoin;
+/* creation and management */
+
void CGPathRelease
(
CGPathRef path
@@ -88,4 +90,21 @@
CGPathRef path
);
+
+/* modifying */
+
+void CGPathAddPath
+(
+ CGMutablePathRef path1,
+ const CGAffineTransform *m,
+ CGPathRef path2
+ );
+
+void CGPathMoveToPoint
+(
+ CGMutablePathRef path1,
+ const CGAffineTransform *m,
+ CGFloat x, CGFloat y
+ );
+
#endif /* CGPATH_H_ */
Modified: devmodules/dev-libs/mica/Headers/CoreGraphics/CoreGraphics.h
URL:
http://svn.gna.org/viewcvs/gnustep/devmodules/dev-libs/mica/Headers/CoreGraphics/CoreGraphics.h?rev=39028&r1=39027&r2=39028&view=diff
==============================================================================
--- devmodules/dev-libs/mica/Headers/CoreGraphics/CoreGraphics.h
(original)
+++ devmodules/dev-libs/mica/Headers/CoreGraphics/CoreGraphics.h Mon Oct
5 00:18:58 2015
@@ -27,6 +27,7 @@
#ifndef COREGRAPHICS_H_
#define COREGRAPHICS_H_
+#include <CoreGraphics/CGAffineTransform.h>
#include <CoreGraphics/CGContext.h>
#include <CoreGraphics/CGColorSpace.h>
#include <CoreGraphics/CGBitmapContext.h>
Modified: devmodules/dev-libs/mica/Sources/CGPath.m
URL:
http://svn.gna.org/viewcvs/gnustep/devmodules/dev-libs/mica/Sources/CGPath.m?rev=39028&r1=39027&r2=39028&view=diff
==============================================================================
--- devmodules/dev-libs/mica/Sources/CGPath.m (original)
+++ devmodules/dev-libs/mica/Sources/CGPath.m Mon Oct 5 00:18:58 2015
@@ -26,17 +26,19 @@
#import <CoreGraphics/CGPath.h>
+#import <AppKit/NSAffineTransform.h>
#import <AppKit/NSBezierPath.h>
@interface CGPath : NSBezierPath
@end
+
void CGPathRelease
(
CGPathRef path
)
{
- NSBezierPath *nsPath;
+ const NSBezierPath *nsPath;
nsPath = path;
if (nsPath)
@@ -48,7 +50,7 @@
CGPathRef path
)
{
- NSBezierPath *nsPath;
+ const NSBezierPath *nsPath;
nsPath = path;
if (nsPath)
@@ -56,3 +58,44 @@
return (CGPathRef)nsPath;
}
+
+
+/* modifying */
+
+void CGPathAddPath
+(
+ CGMutablePathRef path1,
+ const CGAffineTransform *m,
+ CGPathRef path2
+ )
+{
+ NSBezierPath *nsPath1;
+ NSBezierPath *nsPath2;
+ NSAffineTransform *nsAt;
+
+ nsPath1 = path1;
+ nsPath2 = (NSBezierPath *)path2; // discard const qualifier
+ nsAt = [NSAffineTransform transform];
+ [nsAt setTransformStruct: *(NSAffineTransformStruct *)m];
+
+ [nsPath2 transformUsingAffineTransform: nsAt];
+ [nsPath1 appendBezierPath:nsPath2];
+}
+
+void CGPathMoveToPoint
+(
+ CGMutablePathRef path,
+ const CGAffineTransform *m,
+ CGFloat x, CGFloat y
+ )
+{
+ const NSBezierPath *nsPath;
+ NSAffineTransform *nsAt;
+
+ nsPath = path;
+ nsAt = [NSAffineTransform transform];
+ [nsAt setTransformStruct: *(NSAffineTransformStruct *)m];
+
+ [nsPath transformUsingAffineTransform: nsAt];
+ [nsPath moveToPoint: NSMakePoint(x, y)];
+}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs