From f70b530f8a0c9e594c60df9ad3d1323b86014869 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Mon, 24 Mar 2014 14:05:49 +0200 Subject: [PATCH] Image module reworked --- BCL.csproj | 3 --- Image/image.android.ts | 6 +++--- Image/image.d.ts | 7 +++++-- Image/image.ios.ts | 8 ++++---- Image/image_types.ts | 4 ---- 5 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 Image/image_types.ts diff --git a/BCL.csproj b/BCL.csproj index 9a7642fbe..7ee6cd1be 100644 --- a/BCL.csproj +++ b/BCL.csproj @@ -108,9 +108,6 @@ image.d.ts - - image.d.ts - location.d.ts diff --git a/Image/image.android.ts b/Image/image.android.ts index ea76b31c1..4e9b544c6 100644 --- a/Image/image.android.ts +++ b/Image/image.android.ts @@ -1,5 +1,5 @@ import app_module = require("Application/application"); -import types_module = require("Image/image_types"); +import image_module = require("Image/image"); export class Image { public android: any; @@ -36,11 +36,11 @@ export class Image { return (this.android != null); } - public saveToFile(path: string, format: types_module.ImageType, quality?: number): boolean { + public saveToFile(path: string, format: image_module.ImageType, quality?: number): boolean { if (this.android) { var targetFormat = android.graphics.Bitmap.CompressFormat.PNG; switch (format) { - case types_module.ImageType.JPEG: + case image_module.ImageType.JPEG: targetFormat = android.graphics.Bitmap.CompressFormat.JPEG; break; } diff --git a/Image/image.d.ts b/Image/image.d.ts index 75b7bb0e7..7c5452049 100644 --- a/Image/image.d.ts +++ b/Image/image.d.ts @@ -1,11 +1,14 @@ -import types_module = require("Image/image_types"); +export declare enum ImageType { + PNG = 0, + JPEG = 1, +} export declare class Image { loadFromResource(name: string): boolean; loadFromFile(path: string): boolean; loadFromData(data: any): boolean; loadFromBitmap(source: any): boolean; - saveToFile(path: string, format: types_module.ImageType, quality?: number): boolean; + saveToFile(path: string, format: ImageType, quality?: number): boolean; getHeight(): number; getWidth(): number; diff --git a/Image/image.ios.ts b/Image/image.ios.ts index 7bcea50e2..7f940298a 100644 --- a/Image/image.ios.ts +++ b/Image/image.ios.ts @@ -1,4 +1,4 @@ -import types_module = require("Image/image_types"); +import image_module = require("Image/image"); export class Image { public ios: any; @@ -27,17 +27,17 @@ export class Image { return (this.ios != null); } - public saveToFile(path: string, format: types_module.ImageType, quality?: number): boolean { + public saveToFile(path: string, format: image_module.ImageType, quality?: number): boolean { if (null == this.ios) { return false; } var res = false; var data = null; switch (format) { - case types_module.ImageType.JPEG: + case image_module.ImageType.JPEG: data = UIKit.UIImageJPEGRepresentation(this.ios, ('undefined' == typeof quality) ? 1.0 : quality); break; - case types_module.ImageType.PNG: + case image_module.ImageType.PNG: data = UIKit.UIImagePNGRepresentation(this.ios); break; } diff --git a/Image/image_types.ts b/Image/image_types.ts deleted file mode 100644 index 1637cc6ea..000000000 --- a/Image/image_types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ImageType { - PNG = 0, - JPEG = 1, -} \ No newline at end of file