-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SVGKLayeredImageView .actor missing Issue #5
bgen changes in 15.5 beta
- Loading branch information
1 parent
ee8f4ee
commit 0796316
Showing
7 changed files
with
154 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule SVGKit
updated
9 files
+0 −3 | CONTRIBUTING.md | |
+10 −0 | ISSUE_TEMPLATE | |
+1 −1 | README.mdown | |
+4 −0 | SVGKit-iOS.xcodeproj/project.pbxproj | |
+1 −1 | SVGKit.podspec | |
+2 −2 | SVGKitLibrary/SVGKit-iOS/SVGKit-iOS-Prefix.pch | |
+9 −3 | Source/Parsers/SVGKPointsAndPathsParser.m | |
+2 −0 | Source/SVGKImage.h | |
+32 −2 | Source/SVGKImage.m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,88 @@ | ||
using System; | ||
using UIKit; | ||
using SushiHangover.SVGKit; | ||
using CoreAnimation; | ||
using CoreGraphics; | ||
using CoreFoundation; | ||
using Foundation; | ||
|
||
namespace SVGKit.SampleApp | ||
{ | ||
public partial class ViewController : UIViewController | ||
{ | ||
protected ViewController(IntPtr handle) : base(handle) | ||
{ | ||
// Note: this .ctor should not contain any initialization logic. | ||
} | ||
|
||
public override void ViewDidLoad() | ||
{ | ||
base.ViewDidLoad(); | ||
|
||
var image = new SVGKImage("Media/Sushi.svg"); | ||
var imageView = new SVGKFastImageView(image); | ||
imageView.Frame = View.Frame; | ||
View.Add(imageView); | ||
} | ||
|
||
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() | ||
{ | ||
return UIInterfaceOrientationMask.LandscapeLeft; | ||
} | ||
|
||
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation() | ||
{ | ||
return UIInterfaceOrientation.LandscapeLeft; | ||
} | ||
|
||
public override bool ShouldAutorotate() | ||
{ | ||
return false; | ||
} | ||
} | ||
public static class Extension | ||
{ | ||
public static UIColor Inverse(this UIColor color) | ||
{ | ||
try | ||
{ | ||
var cgcolor = color.CGColor; | ||
if (cgcolor.NumberOfComponents == 1) | ||
return color; | ||
|
||
var comps = cgcolor.Components; | ||
var newComps = new nfloat[comps.Length]; | ||
var i = comps.Length - 1; | ||
newComps[i] = comps[i]; | ||
while (i-- > -0) | ||
{ | ||
newComps[i] = 1 - comps[i]; | ||
} | ||
using (var newCGColor = new CGColor(cgcolor.ColorSpace, newComps)) | ||
{ | ||
var newUIColor = UIColor.FromCGColor(newCGColor); | ||
return newUIColor; | ||
} | ||
} | ||
catch | ||
{ | ||
return UIColor.Black; | ||
} | ||
} | ||
} | ||
|
||
public partial class ViewController : UIViewController | ||
{ | ||
NSTimer timer; | ||
|
||
protected ViewController(IntPtr handle) : base(handle) | ||
{ | ||
// Note: this .ctor should not contain any initialization logic. | ||
} | ||
|
||
public override void ViewDidLoad() | ||
{ | ||
base.ViewDidLoad(); | ||
|
||
void RecurseLayers(CALayer[] layers) | ||
{ | ||
foreach (var layer in layers) | ||
{ | ||
if (layer is CAShapeLayer && (layer as CAShapeLayer).FillColor != null) | ||
(layer as CAShapeLayer).FillColor = UIColor.FromCGColor((layer as CAShapeLayer).FillColor).Inverse().CGColor; | ||
if (layer.Sublayers != null) | ||
RecurseLayers(layer.Sublayers); | ||
} | ||
} | ||
//var imageView = new SVGKLayeredImageView(new SVGKImage("Media/Sushi.svg")); | ||
var imageView = new SVGKFastImageView(new SVGKImage("Media/Sushi.svg")); | ||
imageView.Frame = View.Bounds; | ||
View.Add(imageView); | ||
//timer = NSTimer.CreateRepeatingScheduledTimer(2, (_) => InvokeOnMainThread(() => RecurseLayers(imageView.Layer.Sublayers))); | ||
} | ||
|
||
|
||
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() | ||
{ | ||
return UIInterfaceOrientationMask.LandscapeLeft; | ||
} | ||
|
||
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation() | ||
{ | ||
return UIInterfaceOrientation.LandscapeLeft; | ||
} | ||
|
||
public override bool ShouldAutorotate() | ||
{ | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System; | ||
using System.Drawing; | ||
using System.Diagnostics; | ||
using System.ComponentModel; | ||
using System.Threading.Tasks; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.CompilerServices; | ||
using UIKit; | ||
using GLKit; | ||
using Metal; | ||
using MapKit; | ||
using Photos; | ||
using ModelIO; | ||
using SceneKit; | ||
using Contacts; | ||
using Security; | ||
using Messages; | ||
using AudioUnit; | ||
using CoreVideo; | ||
using CoreMedia; | ||
using QuickLook; | ||
using CoreImage; | ||
using SpriteKit; | ||
using Foundation; | ||
using CoreMotion; | ||
using ObjCRuntime; | ||
using AddressBook; | ||
using MediaPlayer; | ||
using GameplayKit; | ||
using CoreGraphics; | ||
using CoreLocation; | ||
using AVFoundation; | ||
using NewsstandKit; | ||
using FileProvider; | ||
using CoreAnimation; | ||
using CoreFoundation; | ||
|
||
namespace SushiHangover.SVGKit | ||
{ | ||
public unsafe partial class SVGKLayeredImageView : SVGKImageView | ||
{ | ||
[Export("initWithSVGKImage:")] | ||
public SVGKLayeredImageView(SVGKImage im) : base (im) | ||
{ | ||
if (im == null) | ||
throw new ArgumentNullException("im"); | ||
IsDirectBinding = GetType().Assembly == global::ApiDefinitions.Messaging.this_assembly; | ||
if (IsDirectBinding) | ||
{ | ||
InitializeHandle(global::ApiDefinitions.Messaging.IntPtr_objc_msgSend_IntPtr(this.Handle, Selector.GetHandle("initWithSVGKImage:"), im.Handle), "initWithSVGKImage:"); | ||
} | ||
else | ||
{ | ||
InitializeHandle(global::ApiDefinitions.Messaging.IntPtr_objc_msgSendSuper_IntPtr(this.SuperHandle, Selector.GetHandle("initWithSVGKImage:"), im.Handle), "initWithSVGKImage:"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters