Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Adobe Creative SDK ImageEdit UIの紹介

Adobe Creative SDK ImageEdit UIの紹介

2016.04.23に『フロントエンド✕モバイルアプリ勉強会
』でお話しした、『Adobe Creative SDK ImageEdit UIの紹介』のスライドです。

Ippei Sumida

April 23, 2016
Tweet

More Decks by Ippei Sumida

Other Decks in Programming

Transcript

  1. How to use Image Edit UI • iOS, Android͸ωΠςΟϒ •

    Web͸JavaScript͕ͩɺPC, λϒϨοτ޲͚ • ࠓճ͸ɺCordova + iOS SDK
  2. Plugin࡞੒
 Framework௥Ճ <framework src="src/ios/AdobeCreativeSDKImage.framework" custom="true" /> <framework src="src/ios/AdobeCreativeSDKCore.framework" custom="true" />

    <framework src="Accelerate.framework" /> <framework src="CoreData.framework" /> <framework src="libsqlite3.0.dylib" /> <framework src="libz.1.2.5.dylib" /> <framework src="Foundation.framework" /> <framework src="MessageUI.framework" /> <framework src="OpenGLES.framework" /> <framework src="QuartzCore.framework" /> <framework src="StoreKit.framework" /> <framework src="MobileCoreServices.framework" /> <framework src="UIKit.framework" /> <framework src="libc++.dylib" />
  3. Plugin࡞੒
 ίϚϯυ௥Ճ #import <Cordova/CDVPlugin.h> #import <Cordova/CDVInvokedUrlCommand.h> #import <AdobeCreativeSDKCore/AdobeCreativeSDKCore.h> #import <AdobeCreativeSDKImage/AdobeCreativeSDKImage.h>

    @interface AviaryImageEdit : CDVPlugin <AdobeUXImageEditorViewControllerDelegate> { AdobeUXImageEditorViewController *editorController; NSString *callbackId; } - (void)launch:(CDVInvokedUrlCommand*)command; @end
  4. Plugin࡞੒
 ίϚϯυ௥Ճ #import <Cordova/CDVPlugin.h> #import <Cordova/CDVInvokedUrlCommand.h> #import <AdobeCreativeSDKCore/AdobeCreativeSDKCore.h> #import <AdobeCreativeSDKImage/AdobeCreativeSDKImage.h>

    @interface AviaryImageEdit : CDVPlugin <AdobeUXImageEditorViewControllerDelegate> { AdobeUXImageEditorViewController *editorController; NSString *callbackId; } - (void)launch:(CDVInvokedUrlCommand*)command; @end Protocolઃఆ
  5. Plugin࡞੒
 ίϚϯυ௥Ճ #import <Cordova/CDVPlugin.h> #import <Cordova/CDVInvokedUrlCommand.h> #import <AdobeCreativeSDKCore/AdobeCreativeSDKCore.h> #import <AdobeCreativeSDKImage/AdobeCreativeSDKImage.h>

    @interface AviaryImageEdit : CDVPlugin <AdobeUXImageEditorViewControllerDelegate> { AdobeUXImageEditorViewController *editorController; NSString *callbackId; } - (void)launch:(CDVInvokedUrlCommand*)command; @end ίϚϯυએݴ
  6. Plugin࡞੒
 ίϚϯυ௥Ճ - (void)launch:(CDVInvokedUrlCommand*)command { [[AdobeUXAuthManager sharedManager] setAuthenticationParametersWithClientID:@"Client ID" clientSecret:@"Client

    Secret" enableSignUp:NO]; callbackId = command.callbackId; NSString *path = (NSString *) [command.arguments objectAtIndex: 0]; UIImage *imageToEdit = [UIImage imageWithContentsOfFile: [path substringFromIndex: 7]]; editorController = [[AdobeUXImageEditorViewController alloc] initWithImage:imageToEdit]; [editorController setDelegate: self]; [super.viewController presentViewController:editorController animated:YES completion:nil]; }
  7. Plugin࡞੒
 ίϚϯυ௥Ճ - (void)launch:(CDVInvokedUrlCommand*)command { [[AdobeUXAuthManager sharedManager] setAuthenticationParametersWithClientID:@"Client ID" clientSecret:@"Client

    Secret" enableSignUp:NO]; callbackId = command.callbackId; NSString *path = (NSString *) [command.arguments objectAtIndex: 0]; UIImage *imageToEdit = [UIImage imageWithContentsOfFile: [path substringFromIndex: 7]]; editorController = [[AdobeUXImageEditorViewController alloc] initWithImage:imageToEdit]; [editorController setDelegate: self]; [super.viewController presentViewController:editorController animated:YES completion:nil]; } Client ID, Secretઃఆ
  8. Plugin࡞੒
 ίϚϯυ௥Ճ - (void)launch:(CDVInvokedUrlCommand*)command { [[AdobeUXAuthManager sharedManager] setAuthenticationParametersWithClientID:@"Client ID" clientSecret:@"Client

    Secret" enableSignUp:NO]; callbackId = command.callbackId; NSString *path = (NSString *) [command.arguments objectAtIndex: 0]; UIImage *imageToEdit = [UIImage imageWithContentsOfFile: [path substringFromIndex: 7]]; editorController = [[AdobeUXImageEditorViewController alloc] initWithImage:imageToEdit]; [editorController setDelegate: self]; [super.viewController presentViewController:editorController animated:YES completion:nil]; } ฤूϏϡʔੜ੒ɾදࣔ
  9. Plugin࡞੒
 Delegateઃఆʢอଘʣ - (void)photoEditor:(AdobeUXImageEditorViewController *)editor finishedWithImage:(UIImage *)image { // Handle

    the result image here NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString * basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; NSData *binaryData = UIImagePNGRepresentation(image); [binaryData writeToFile:[basePath stringByAppendingPathComponent: @"result.png"] atomically: YES]; CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @"save"]; [editorController dismissViewControllerAnimated: YES completion: nil]; [self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId]; }
  10. Plugin࡞੒
 DelegateઃఆʢΩϟϯηϧʣ - (void)photoEditorCanceled:(AdobeUXImageEditorViewController *)editor { // Handle cancellation here

    CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @"cancel"]; [editorController dismissViewControllerAnimated: YES completion: nil]; [self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId]; }