From 7fad5d5786822c3b5d2781a47599b51adf1e040b Mon Sep 17 00:00:00 2001 From: Suraj Pindoria Date: Tue, 12 Dec 2017 11:09:29 -0800 Subject: [PATCH] CB-13661: Remove deprecated platforms --- README.md | 92 +---- package.json | 16 +- plugin.xml | 130 +------ src/blackberry10/index.js | 227 ------------ src/firefoxos/CameraProxy.js | 53 --- src/ubuntu/CaptureWidget.qml | 118 ------ src/ubuntu/back.png | Bin 12428 -> 0 bytes src/ubuntu/camera.cpp | 140 -------- src/ubuntu/camera.h | 86 ----- src/ubuntu/shoot.png | Bin 14430 -> 0 bytes src/ubuntu/toolbar-left.png | Bin 1212 -> 0 bytes src/ubuntu/toolbar-middle.png | Bin 4416 -> 0 bytes src/ubuntu/toolbar-right.png | Bin 1161 -> 0 bytes src/wp/Camera.cs | 534 ---------------------------- www/blackberry10/assets/camera.html | 82 ----- www/blackberry10/assets/camera.js | 46 --- 16 files changed, 3 insertions(+), 1521 deletions(-) delete mode 100644 src/blackberry10/index.js delete mode 100644 src/firefoxos/CameraProxy.js delete mode 100644 src/ubuntu/CaptureWidget.qml delete mode 100644 src/ubuntu/back.png delete mode 100644 src/ubuntu/camera.cpp delete mode 100644 src/ubuntu/camera.h delete mode 100644 src/ubuntu/shoot.png delete mode 100644 src/ubuntu/toolbar-left.png delete mode 100644 src/ubuntu/toolbar-middle.png delete mode 100644 src/ubuntu/toolbar-right.png delete mode 100644 src/wp/Camera.cs delete mode 100644 www/blackberry10/assets/camera.html delete mode 100644 www/blackberry10/assets/camera.js diff --git a/README.md b/README.md index 27bf6f5..c3948f0 100644 --- a/README.md +++ b/README.md @@ -179,14 +179,10 @@ than `DATA_URL`. __Supported Platforms__ - Android -- BlackBerry - Browser -- Firefox -- FireOS - iOS - Windows -- WP8 -- Ubuntu +- OSX More examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks). @@ -469,12 +465,6 @@ Take a photo and retrieve it as a Base64-encoded image: -#### Amazon Fire OS Quirks - -Amazon Fire OS uses intents to launch the camera activity on the device to capture -images, and on phones with low memory, the Cordova activity may be killed. In this -scenario, the image may not appear when the Cordova activity is restored. - #### Android Quirks Android uses intents to launch the camera activity on the device to capture @@ -490,10 +480,6 @@ successful. Can only return photos as Base64-encoded image. -#### Firefox OS Quirks - -Camera plugin is currently implemented using [Web Activities][web_activities]. - #### iOS Quirks Including a JavaScript `alert()` in either of the callback functions @@ -505,11 +491,6 @@ displays: // do your thing here! }, 0); -#### Windows Phone 7 Quirks - -Invoking the native camera application while the device is connected -via Zune does not work, and triggers an error callback. - #### Windows quirks On Windows Phone 8.1 using `SAVEDPHOTOALBUM` or `PHOTOLIBRARY` as a source type causes application to suspend until file picker returns the selected image and @@ -520,22 +501,6 @@ To avoid this we suggest using SPA pattern or call `camera.getPicture` only from More information about Windows Phone 8.1 picker APIs is here: [How to continue your Windows Phone app after calling a file picker](https://msdn.microsoft.com/en-us/library/windows/apps/dn720490.aspx) -#### Tizen Quirks - -Tizen only supports a `destinationType` of -`Camera.DestinationType.FILE_URI` and a `sourceType` of -`Camera.PictureSourceType.PHOTOLIBRARY`. - - -## `CameraOptions` Errata - -#### Amazon Fire OS Quirks - -- Any `cameraDirection` value results in a back-facing photo. - -- Ignores the `allowEdit` parameter. - -- `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album. #### Android Quirks @@ -547,38 +512,6 @@ Tizen only supports a `destinationType` of - Ignores the `encodingType` parameter if the image is unedited (i.e. `quality` is 100, `correctOrientation` is false, and no `targetHeight` or `targetWidth` are specified). The `CAMERA` source will always return the JPEG file given by the native camera and the `PHOTOLIBRARY` and `SAVEDPHOTOALBUM` sources will return the selected file in its existing encoding. -#### BlackBerry 10 Quirks - -- Ignores the `quality` parameter. - -- Ignores the `allowEdit` parameter. - -- `Camera.MediaType` is not supported. - -- Ignores the `correctOrientation` parameter. - -- Ignores the `cameraDirection` parameter. - -#### Firefox OS Quirks - -- Ignores the `quality` parameter. - -- `Camera.DestinationType` is ignored and equals `1` (image file URI) - -- Ignores the `allowEdit` parameter. - -- Ignores the `PictureSourceType` parameter (user chooses it in a dialog window) - -- Ignores the `encodingType` - -- Ignores the `targetWidth` and `targetHeight` - -- `Camera.MediaType` is not supported. - -- Ignores the `correctOrientation` parameter. - -- Ignores the `cameraDirection` parameter. - #### iOS Quirks - When using `destinationType.FILE_URI`, photos are saved in the application's temporary directory. The contents of the application's temporary directory is deleted when the application ends. @@ -587,29 +520,6 @@ Tizen only supports a `destinationType` of - When using `destinationType.NATIVE_URI` and `sourceType.PHOTOLIBRARY` or `sourceType.SAVEDPHOTOALBUM`, all editing options are ignored and link is returned to original picture. -#### Tizen Quirks - -- options not supported - -- always returns a FILE URI - -#### Windows Phone 7 and 8 Quirks - -- Ignores the `allowEdit` parameter. - -- Ignores the `correctOrientation` parameter. - -- Ignores the `cameraDirection` parameter. - -- Ignores the `saveToPhotoAlbum` parameter. IMPORTANT: All images taken with the WP8/8 Cordova camera API are always copied to the phone's camera roll. Depending on the user's settings, this could also mean the image is auto-uploaded to their OneDrive. This could potentially mean the image is available to a wider audience than your app intended. If this is a blocker for your application, you will need to implement the CameraCaptureTask as [documented on MSDN][msdn_wp8_docs]. You may also comment or up-vote the related issue in the [issue tracker][wp8_bug]. - -- Ignores the `mediaType` property of `cameraOptions` as the Windows Phone SDK does not provide a way to choose videos from PHOTOLIBRARY. - -[android_lifecycle]: http://cordova.apache.org/docs/en/dev/guide/platforms/android/lifecycle.html -[web_activities]: https://hacks.mozilla.org/2013/01/introducing-web-activities/ -[wp8_bug]: https://issues.apache.org/jira/browse/CB-2083 -[msdn_wp8_docs]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx - ## Sample: Take Pictures, Select Pictures from the Picture Library, and Get Thumbnails The Camera plugin allows you to do things like open the device's Camera app and take a picture, or open the file picker and select one. The code snippets in this section demonstrate different tasks including: diff --git a/package.json b/package.json index 5ff3df1..80b4fb9 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,13 @@ { "name": "cordova-plugin-camera", - "version": "3.0.1-dev", + "version": "4.0.0-dev", "description": "Cordova Camera Plugin", "types": "./types/index.d.ts", "cordova": { "id": "cordova-plugin-camera", "platforms": [ - "firefoxos", "android", - "amazon-fireos", - "ubuntu", "ios", - "blackberry10", - "wp7", - "wp8", - "windows8", "browser", "windows", "osx" @@ -31,15 +24,8 @@ "cordova", "camera", "ecosystem:cordova", - "cordova-firefoxos", "cordova-android", - "cordova-amazon-fireos", - "cordova-ubuntu", "cordova-ios", - "cordova-blackberry10", - "cordova-wp7", - "cordova-wp8", - "cordova-windows8", "cordova-browser", "cordova-windows", "cordova-osx" diff --git a/plugin.xml b/plugin.xml index cd59c02..31728cb 100644 --- a/plugin.xml +++ b/plugin.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:rim="http://www.blackberry.com/ns/widgets" id="cordova-plugin-camera" - version="3.0.1-dev"> + version="4.0.0-dev"> Camera Cordova Camera Plugin Apache 2.0 @@ -48,19 +48,6 @@ - - - - - - - - - - - - - @@ -97,48 +84,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -169,79 +114,6 @@ - - - - - - - - access_shared - use_camera - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js deleted file mode 100644 index 2ec7f69..0000000 --- a/src/blackberry10/index.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -/* globals qnx, FileError, PluginResult */ - -var PictureSourceType = { - PHOTOLIBRARY: 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android) - CAMERA: 1, // Take picture from camera - SAVEDPHOTOALBUM: 2 // Choose image from picture library (same as PHOTOLIBRARY for Android) -}; -var DestinationType = { - DATA_URL: 0, // Return base64 encoded string - FILE_URI: 1, // Return file uri (content://media/external/images/media/2 for Android) - NATIVE_URI: 2 // Return native uri (eg. asset-library://... for iOS) -}; -var savePath = window.qnx.webplatform.getApplication().getEnv('HOME').replace('/data', '') + '/shared/camera/'; -var invokeAvailable = true; - -// check for camera card - it isn't currently availble in work perimeter -window.qnx.webplatform.getApplication().invocation.queryTargets( - { - type: 'image/jpeg', - action: 'bb.action.CAPTURE', - target_type: 'CARD' - }, - function (error, targets) { - invokeAvailable = !error && targets && targets instanceof Array && - targets.filter(function (t) { return t.default === 'sys.camera.card'; }).length > 0; - } -); - -// open a webview with getUserMedia camera card implementation when camera card not available -function showCameraDialog (done, cancel, fail) { - var wv = qnx.webplatform.createWebView(function () { - wv.url = 'local:///chrome/camera.html'; - wv.allowQnxObject = true; - wv.allowRpc = true; - wv.zOrder = 1; - wv.setGeometry(0, 0, screen.width, screen.height); /* eslint no-undef : 0 */ - wv.backgroundColor = 0x00000000; - wv.active = true; - wv.visible = true; - wv.on('UserMediaRequest', function (evt, args) { - wv.allowUserMedia(JSON.parse(args).id, 'CAMERA_UNIT_REAR'); - }); - wv.on('JavaScriptCallback', function (evt, data) { - var args = JSON.parse(data).args; - if (args[0] === 'cordova-plugin-camera') { - if (args[1] === 'cancel') { - cancel('User canceled'); - } else if (args[1] === 'error') { - fail(args[2]); - } else { - saveImage(args[1], done, fail); - } - wv.un('JavaScriptCallback', arguments.callee); /* eslint no-caller : 0 */ - wv.visible = false; - wv.destroy(); - qnx.webplatform.getApplication().unlockRotation(); - } - }); - wv.on('Destroyed', function () { - wv.delete(); - }); - qnx.webplatform.getApplication().lockRotation(); - qnx.webplatform.getController().dispatchEvent('webview.initialized', [wv]); - }); -} - -// create unique name for saved file (same pattern as BB10 camera app) -function imgName () { - var date = new Date(); - var pad = function (n) { return n < 10 ? '0' + n : n; }; - return 'IMG_' + date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate()) + '_' + - pad(date.getHours()) + pad(date.getMinutes()) + pad(date.getSeconds()) + '.png'; -} - -// convert dataURI to Blob -function dataURItoBlob (dataURI) { - var byteString = atob(dataURI.split(',')[1]); - var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; - var arrayBuffer = new ArrayBuffer(byteString.length); - var ia = new Uint8Array(arrayBuffer); - var i; - for (i = 0; i < byteString.length; i++) { - ia[i] = byteString.charCodeAt(i); - } - return new Blob([new DataView(arrayBuffer)], { type: mimeString }); -} - -// save dataURI to file system and call success with path -function saveImage (data, success, fail) { - var name = savePath + imgName(); - require('lib/webview').setSandbox(false); - window.webkitRequestFileSystem(window.PERSISTENT, 0, function (fs) { - fs.root.getFile(name, { create: true }, function (entry) { - entry.createWriter(function (writer) { - writer.onwriteend = function () { - success(name); - }; - writer.onerror = fail; - writer.write(dataURItoBlob(data)); - }); - }, fail); - }, fail); -} - -function encodeBase64 (filePath, callback) { - var sandbox = window.qnx.webplatform.getController().setFileSystemSandbox; // save original sandbox value - var errorHandler = function (err) { - var msg = 'An error occured: '; - - switch (err.code) { - case FileError.NOT_FOUND_ERR: - msg += 'File or directory not found'; - break; - - case FileError.NOT_READABLE_ERR: - msg += 'File or directory not readable'; - break; - - case FileError.PATH_EXISTS_ERR: - msg += 'File or directory already exists'; - break; - - case FileError.TYPE_MISMATCH_ERR: - msg += 'Invalid file type'; - break; - - default: - msg += 'Unknown Error'; - break; - } - - // set it back to original value - window.qnx.webplatform.getController().setFileSystemSandbox = sandbox; - callback(msg); - }; - var gotFile = function (fileEntry) { - fileEntry.file(function (file) { - var reader = new FileReader(); - - reader.onloadend = function (e) { - // set it back to original value - window.qnx.webplatform.getController().setFileSystemSandbox = sandbox; - callback(this.result); - }; - - reader.readAsDataURL(file); - }, errorHandler); - }; - var onInitFs = function (fs) { - window.qnx.webplatform.getController().setFileSystemSandbox = false; - fs.root.getFile(filePath, {create: false}, gotFile, errorHandler); - }; - - window.webkitRequestFileSystem(window.TEMPORARY, 10 * 1024 * 1024, onInitFs, errorHandler); // set size to 10MB max -} - -module.exports = { - takePicture: function (success, fail, args, env) { - var destinationType = JSON.parse(decodeURIComponent(args[1])); - var sourceType = JSON.parse(decodeURIComponent(args[2])); - var result = new PluginResult(args, env); - var done = function (data) { - if (destinationType === DestinationType.FILE_URI) { - data = 'file://' + data; - result.callbackOk(data, false); - } else { - encodeBase64(data, function (data) { - if (/^data:/.test(data)) { - data = data.slice(data.indexOf(',') + 1); - result.callbackOk(data, false); - } else { - result.callbackError(data, false); - } - }); - } - }; - var cancel = function (reason) { - result.callbackError(reason, false); - }; - var invoked = function (error) { - if (error) { - result.callbackError(error, false); - } - }; - - switch (sourceType) { - case PictureSourceType.CAMERA: - if (invokeAvailable) { - window.qnx.webplatform.getApplication().cards.camera.open('photo', done, cancel, invoked); - } else { - showCameraDialog(done, cancel, fail); - } - break; - - case PictureSourceType.PHOTOLIBRARY: - case PictureSourceType.SAVEDPHOTOALBUM: - window.qnx.webplatform.getApplication().cards.filePicker.open({ - mode: 'Picker', - type: ['picture'] - }, done, cancel, invoked); - break; - } - - result.noResult(true); - } -}; diff --git a/src/firefoxos/CameraProxy.js b/src/firefoxos/CameraProxy.js deleted file mode 100644 index 83a685a..0000000 --- a/src/firefoxos/CameraProxy.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -/* globals MozActivity */ - -function takePicture (success, error, opts) { - var pick = new MozActivity({ - name: 'pick', - data: { - type: ['image/*'] - } - }); - - pick.onerror = error || function () {}; - - pick.onsuccess = function () { - // image is returned as Blob in this.result.blob - // we need to call success with url or base64 encoded image - if (opts && opts.destinationType === 0) { - // TODO: base64 - return; - } - if (!opts || !opts.destinationType || opts.destinationType > 0) { - // url - return success(window.URL.createObjectURL(this.result.blob)); - } - }; -} - -module.exports = { - takePicture: takePicture, - cleanup: function () {} -}; - -require('cordova/exec/proxy').add('Camera', module.exports); diff --git a/src/ubuntu/CaptureWidget.qml b/src/ubuntu/CaptureWidget.qml deleted file mode 100644 index 0a332e2..0000000 --- a/src/ubuntu/CaptureWidget.qml +++ /dev/null @@ -1,118 +0,0 @@ -/* - * - * Copyright 2013 Canonical Ltd. - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ -import QtQuick 2.0 -import QtMultimedia 5.0 - -Rectangle { - property string shootImagePath: "shoot.png" - function isSuffix(str, suffix) { - return String(str).substr(String(str).length - suffix.length) == suffix - } - - id: ui - color: "#252423" - anchors.fill: parent - - Camera { - objectName: "camera" - id: camera - onError: { - console.log(errorString); - } - videoRecorder.audioBitRate: 128000 - imageCapture { - onImageSaved: { - root.exec("Camera", "onImageSaved", [path]); - ui.destroy(); - } - } - } - VideoOutput { - id: output - source: camera - width: parent.width - height: parent.height - } - - Item { - anchors.bottom: parent.bottom - width: parent.width - height: shootButton.height - BorderImage { - id: leftBackground - anchors.left: parent.left - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: middle.left - anchors.topMargin: units.dp(2) - anchors.bottomMargin: units.dp(2) - source: "toolbar-left.png" - Image { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: parent.iconSpacing - source: "back.png" - width: units.gu(6) - height: units.gu(5) - MouseArea { - anchors.fill: parent - onClicked: { - root.exec("Camera", "cancel"); - } - } - } - } - BorderImage { - id: middle - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - height: shootButton.height + units.gu(1) - width: shootButton.width - source: "toolbar-middle.png" - Image { - id: shootButton - width: units.gu(8) - height: width - anchors.horizontalCenter: parent.horizontalCenter - source: shootImagePath - MouseArea { - anchors.fill: parent - onClicked: { - camera.imageCapture.captureToLocation(ui.parent.plugin('Camera').generateLocation("jpg")); - } - } - } - } - BorderImage { - id: rightBackground - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: middle.right - anchors.topMargin: units.dp(2) - anchors.bottomMargin: units.dp(2) - source: "toolbar-right.png" - } - } -} diff --git a/src/ubuntu/back.png b/src/ubuntu/back.png deleted file mode 100644 index af78faa837ce940e2818f5a8fcd2f88e1de27bda..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12428 zcmZ8{byytF@9-Ti#ogWADQ?9JEnZw&+`Z`G4#nYGq`)D?-QA13yBBvka6(14F(ne*X4)pB>sEp=`3vpgP{L)?kyfL0KiqRBqy!qy?omKJ;iXrf8(+F zzFpT>Th}X}>=0>^8h}ebW%yO2&QlZj!*G(KVhsUH1Kr@xVzmD*`GK&7FYivZ_-C=5 z9XzJ&U&*_wN$<1!5*-+-DTeXBkVX~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!wt;0#hRT1|=W?y`n{l5PI|?Tsj0O+S5$u4UZ2iLDd3{;=d6*_3 zx|#|Qiso zH+a2^YjntgQzERApTYfup8Hob_irK=uHRq)z{}0U&B4vf!NaY^%_G7iEW!sP->0wv0HqIVauqVB!T%4k C%sA`- diff --git a/src/ubuntu/camera.cpp b/src/ubuntu/camera.cpp deleted file mode 100644 index c58af32..0000000 --- a/src/ubuntu/camera.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -#include "camera.h" -#include - -#include -#include -#include -#include -#include - -const char code[] = "\ -var component, object; \ -function createObject() { \ - component = Qt.createComponent(%1); \ - if (component.status == Component.Ready) \ - finishCreation(); \ - else \ - component.statusChanged.connect(finishCreation); \ -} \ -function finishCreation() { \ - CordovaWrapper.global.cameraPluginWidget = component.createObject(root, \ - {root: root, cordova: cordova}); \ -} \ -createObject()"; - - -Camera::Camera(Cordova *cordova): - CPlugin(cordova), - _lastScId(0), - _lastEcId(0) { -} - -bool Camera::preprocessImage(QString &path) { - bool convertToPNG = (*_options.find("encodingType")).toInt() == Camera::PNG; - int quality = (*_options.find("quality")).toInt(); - int width = (*_options.find("targetWidth")).toInt(); - int height = (*_options.find("targetHeight")).toInt(); - - QImage image(path); - if (width <= 0) - width = image.width(); - if (height <= 0) - height = image.height(); - image = image.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); - - QFile oldImage(path); - QTemporaryFile newImage; - - const char *type; - if (convertToPNG) { - path = generateLocation("png"); - type = "png"; - } else { - path = generateLocation("jpg"); - type = "jpg"; - } - - image.save(path, type, quality); - - oldImage.remove(); - - return true; -} - -void Camera::onImageSaved(QString path) { - bool dataURL = _options.find("destinationType")->toInt() == Camera::DATA_URL; - - QString cbParams; - if (preprocessImage(path)) { - QString absolutePath = QFileInfo(path).absoluteFilePath(); - if (dataURL) { - QFile image(absolutePath); - image.open(QIODevice::ReadOnly); - QByteArray content = image.readAll().toBase64(); - cbParams = QString("\"%1\"").arg(content.data()); - image.remove(); - } else { - cbParams = CordovaInternal::format(QString("file://localhost") + absolutePath); - } - } - - this->callback(_lastScId, cbParams); - - _lastEcId = _lastScId = 0; -} - -void Camera::takePicture(int scId, int ecId, int quality, int destinationType, int/*sourceType*/, int targetWidth, int targetHeight, int encodingType, - int/*mediaType*/, bool/*allowEdit*/, bool/*correctOrientation*/, bool/*saveToPhotoAlbum*/, const QVariantMap &/*popoverOptions*/, int/*cameraDirection*/) { - if (_camera.isNull()) { - _camera = QSharedPointer(new QCamera()); - } - - if (((_lastScId || _lastEcId) && (_lastScId != scId && _lastEcId != ecId)) || !_camera->isAvailable() || _camera->lockStatus() != QCamera::Unlocked) { - this->cb(_lastEcId, "Device is busy"); - return; - } - - _options.clear(); - _options.insert("quality", quality); - _options.insert("destinationType", destinationType); - _options.insert("targetWidth", targetWidth); - _options.insert("targetHeight", targetHeight); - _options.insert("encodingType", encodingType); - - _lastScId = scId; - _lastEcId = ecId; - - QString path = m_cordova->get_app_dir() + "/../qml/CaptureWidget.qml"; - - // TODO: relative url - QString qml = QString(code).arg(CordovaInternal::format(path)); - m_cordova->execQML(qml); -} - -void Camera::cancel() { - m_cordova->execQML("CordovaWrapper.global.cameraPluginWidget.destroy()"); - this->cb(_lastEcId, "canceled"); - - _lastEcId = _lastScId = 0; -} diff --git a/src/ubuntu/camera.h b/src/ubuntu/camera.h deleted file mode 100644 index 6d96038..0000000 --- a/src/ubuntu/camera.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -#ifndef CAMERA_H -#define CAMERA_H - -#include - -#include -#include -#include -#include -#include - -class Camera: public CPlugin { - Q_OBJECT -public: - explicit Camera(Cordova *cordova); - - virtual const QString fullName() override { - return Camera::fullID(); - } - - virtual const QString shortName() override { - return "Camera"; - } - - static const QString fullID() { - return "Camera"; - } - -public slots: - void takePicture(int scId, int ecId, int quality, int destinationType, int/*sourceType*/, int targetWidth, int targetHeight, int encodingType, - int/*mediaType*/, bool/*allowEdit*/, bool/*correctOrientation*/, bool/*saveToPhotoAlbum*/, const QVariantMap &popoverOptions, int cameraDirection); - void cancel(); - - void onImageSaved(QString path); - - QString generateLocation(const QString &extension) { - int i = 1; - for (;;++i) { - QString path = QString("%1/.local/share/%2/persistent/%3.%4").arg(QDir::homePath()) - .arg(QCoreApplication::applicationName()).arg(i).arg(extension); - - if (!QFileInfo(path).exists()) - return path; - } - } -private: - bool preprocessImage(QString &path); - - int _lastScId; - int _lastEcId; - QSharedPointer _camera; - - QVariantMap _options; -protected: - enum DestinationType { - DATA_URL = 0, - FILE_URI = 1 - }; - enum EncodingType { - JPEG = 0, - PNG = 1 - }; -}; - -#endif // CAMERA_H diff --git a/src/ubuntu/shoot.png b/src/ubuntu/shoot.png deleted file mode 100644 index c093b633c886b1ebd03925113c66c49ac53f50b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14430 zcmajG1ymeC)HOJ`1$Wor?(QzZ-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zPAa-QLokM;Q074zPr17`C?40 zJupWk=#7WJyS;r) zX#i&nr2j&e*)S;2xWjyzs}Om6*i~~$dQrdwIVvhnGy|Dw>a{K(j+iLiBh7WqgO|7j z&Yru}@s~YThX*jM@Ww_nutbfJ*VAEIng|s6{V+k303@|U9NP~Y1Jr33V)`U!>z#-A zO)(snyma9@C?szagrx!hgtSnvjxs-H@#D=51yvmRAq8DD ze^WCEr@Y{qNDy5XQjKC71`gXCAohB`jX=URg7l)xb|FT(rB~XGi68AWvc0O{bQ0Im zrK2s5OIFomu2Nvp4=A`qHN{U0?T?Da5YL3^W(>lj#OC!lcD~* z&2_-$n~eh>_aP?WkkJJ(a-nEWK@mmnxS6F3rvT$Gyy0<6~+Frak{6))1Tr&jJ;1$A|Gju7aL zgxJ^@>!}=}gnlYqv~7!isa{y^u&>QZnL@KRai-G9$>BB0M21GWTsS0x-O)Sd^1P^$V4kw@UEtljqVWkDR4miLV_^(e?8+N zrnwn3oE*Tz#N@aRz%)2++do4Q$rBa2kDyY9W9UTJ#t#^n|MP%J-Kb+9b*l<37A=ZX zG#5MXU%(C>s#& z@U*nH*1`<^MxqWYHDLCFC^!l&h)@}3J{=AHj!Z8=Y-eX`x=ooTf6GckbC?^6O1h!b z=CW-JNSx>?g!{guQJNS>_7@us%89CeL4X~8E1^ApwhzaJQKvBZ`l{6JWYQboN0J_5?J@F?e^+~cu+$8k>0_FIxMF0Q* diff --git a/src/ubuntu/toolbar-left.png b/src/ubuntu/toolbar-left.png deleted file mode 100644 index 720d7f601675cb18b2394fedb47dc43805df7adf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1212 zcmeAS@N?(olHy`uVBq!ia0y~yU}OWb=Ws9s$yJG8=K}>g1AIbU|D%HX`ue?l_rk@_ zoH+w$BQx~$^wibWAtE0?esp$r{`Kn@kn8X74$p2$-0F2n4dSGJzyBGY~-m3k$QOqhnfH8j!&P z2CS?sV8jaKv9hwVu>lDdAjt-1K^S3SVL)Sn;_U2fT3VVA1HsDJczC$^`1sV-)xh>L zNlHorodk3M4-XGe1ZXRel$V!>+0P7i53``4pqQ8#P!OmLA_7qWbOW3LbO$FVCr||D z5;m9%K~4k;va_>87;rMvh&={qeRD~WUoZnR3mZEJ2fv_@sEoXdnzoL$hnJVPZ*X)> zLRv{#d1Z5RTU%G}^yxEa%?5%wbLY;TH*fy@`3n{T!JNRWDu3fi&!$u(3v}yC^EnBy4+YSUfcI@1_YuB#byLa!|vv==4c3+`X zU|__1x;TbZ+OE-f7&?D@}I`tyzkfj1A}hA ze{p}`mMey*`;Qzt^gVyRYs%fmr*Y3;|K4f-w(R%P#5j$!X`fe~xNtD;dGPC#SGjxJ zo?kulXxG)OrH?F9J>S05J$G-n#E;VT&sNQ}oU`v_(aMl1zU#%J%?~Yjcy-k;$D10e zp$?}{?>qO#H+12%FqyeWEm~{rrf+_F<#_upr>litRmL_WDd6QSPj? zc{ygYJx@zQ&=DswmJ{49u(#F$dc1aTo3!&nxOj@;e3>@RX5$yD8+lTGOn1CLVcJE> zWo(j0DGJPzCmh&}CIH1LXFeznvGY@7?&c0VAk{5uqFX}8w;MkaH;5B*qJPw=sue+Wii!L>(~orHkuW`Inwhk;g`_W-pA?5cO6>|s+PVx zG4Jz71(yfEc_&|aJ@41^uigqqTTBTiKS!{^-dBiF&&F KxvX*PxS diff --git a/src/ubuntu/toolbar-middle.png b/src/ubuntu/toolbar-middle.png deleted file mode 100644 index 77595bb1332aee9326f86e496a6cf8dca6724327..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4416 zcmYjVcQ_kd-$v~{f*^JxMr^GpRWqb1wPJ5oJhUWM)vDSRyS8d;wxu++DK(<@N{1Fz zBW7Ehpy-?D`QGvUamICi<6P%D*SYWecaqIajo6q4nW?C#*pS8s7L+lK(#jd>DZTCx zpDh&?7X#8j*Xr){&*I@5R$jow@ew7s1db*ZVUFZfd^-8w*u=Z-N2!pHAktXfnVVnm z;xoC~Ajx&Tm~y7d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hJ7ki##9@NHi}mZ=X(7lr}P#32`nQ4I1wb z+!1`sw-rO~2`7gC(PapP2FN>R*9nvGuvPr><;NWqUduDqFrX&0ZE;ncio5dSv*o(9 zH>XWE4K{g25eyXRV6oux7I*liAIGjt`5B=? M8k!o^>bXAn7gDq;O#lD@ diff --git a/src/ubuntu/toolbar-right.png b/src/ubuntu/toolbar-right.png deleted file mode 100644 index e4e6aa6026a3bc336abf5c46223c4f0152ecd2da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1161 zcmeAS@N?(olHy`uVBq!ia0y~yU}OQZ=Ws9s$#qjy7Xbwd1AIbU|099Ay1Ko4_re9v zo;?d^!x`%8>Uw&55bpc;@132UfBpIe-}+aZ9Fk%5tsao)UnKoSU;n1Bcbva&LPBr`J*K>-U3v!kP9YHBKw!2$-X ztSn%}3IuFytUz@@E|9^-#>U6T2VsPTg#oPqinFt`X=!P}&4kGE@NffFs;jF3tp?f! zbR^JKV21#?%u-TP5WB&;m<0p`#KgpaA`mV+J3B-cNCKS$AvriWfVKmu1L4Lsu%q(mi9Q=YpVlwh7YT7!Uo?hO5!7(ujX(eUlmCenqZQavn%$zkF z23T_2sUlr zym`ykZQHhQ-@aq#&Yin zZ+-VWOhL%umWmV;=d4>R3h#@GUJ1LiYHQNLx+-<&^B?Ej`+n$i{d{k|`;yP}>{+1^ z3ZgdLtm9{Ew!an7v$fRQ{M@_St9stsPoG{dSsNG@zFDsS`|~N+^0wd4$WMJ)wp(6o z|DPB9*ZcA>3(6cXwLSm+^&%F>&6RJjoj$ky--jbJg0|i|v&Q(*sfRzmE)aCPK3{JQ z5C78;)8NaRDkuH!tY$x}vG00h<#z9zWjkY5dM)O^Tlja^x`O(J^&wM@wrQjmzcD@j zaTAyRzPJ$A)0@0L-I$t{d+lSh!Myi-!hbdeiX1-mf+w|B{7#i}SG?}ZJvOXor9wY^ z3ElBK@@cA;i1$*j(qmWGAA0Mb^-Dfdbj_r->zm|VKHHk=28B7sw_g13=sw|OOlwi7 zeQ)9(4eO>#kq!kLr?~w+E*k6HGXxtsTojlDI~-V)1Sn>HDAbtGDctz7;eU}!ljX#W zb;mdOO!+cHqHFTJH5)aPAKwW175L{(gtlkAvBPw`9ZGdw2A=chPP6lxx#Z>N=0(pv zeVf~#t3Tzt+7_stJt1!1t(7+Rzcn*VW;L}WiX63SEc^PQ!tbS;RoBHyis#O#svVrm z?f$JtGj-OHPK}ixUz|MatM*|Tm;48FA_Lb$p-|30t~frA?{^^95F Vdv8wr^Q;LZ=;`X`vd$@?2>|~T#2)|v diff --git a/src/wp/Camera.cs b/src/wp/Camera.cs deleted file mode 100644 index 264a205..0000000 --- a/src/wp/Camera.cs +++ /dev/null @@ -1,534 +0,0 @@ -/* - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -using System; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Collections.Generic; -using Microsoft.Phone.Tasks; -using System.Runtime.Serialization; -using System.IO; -using System.IO.IsolatedStorage; -using System.Windows.Media.Imaging; -using Microsoft.Phone; -using Microsoft.Xna.Framework.Media; -using System.Diagnostics; - -namespace WPCordovaClassLib.Cordova.Commands -{ - public class Camera : BaseCommand - { - - /// - /// Return base64 encoded string - /// - private const int DATA_URL = 0; - - /// - /// Return file uri - /// - private const int FILE_URI = 1; - - /// - /// Return native uri - /// - private const int NATIVE_URI = 2; - - /// - /// Choose image from picture library - /// - private const int PHOTOLIBRARY = 0; - - /// - /// Take picture from camera - /// - - private const int CAMERA = 1; - - /// - /// Choose image from picture library - /// - private const int SAVEDPHOTOALBUM = 2; - - /// - /// Take a picture of type JPEG - /// - private const int JPEG = 0; - - /// - /// Take a picture of type PNG - /// - private const int PNG = 1; - - /// - /// Folder to store captured images - /// - private const string isoFolder = "CapturedImagesCache"; - - /// - /// Represents captureImage action options. - /// - [DataContract] - public class CameraOptions - { - /// - /// Source to getPicture from. - /// - [DataMember(IsRequired = false, Name = "sourceType")] - public int PictureSourceType { get; set; } - - /// - /// Format of image that returned from getPicture. - /// - [DataMember(IsRequired = false, Name = "destinationType")] - public int DestinationType { get; set; } - - /// - /// Quality of saved image - /// - [DataMember(IsRequired = false, Name = "quality")] - public int Quality { get; set; } - - /// - /// Controls whether or not the image is also added to the device photo album. - /// - [DataMember(IsRequired = false, Name = "saveToPhotoAlbum")] - public bool SaveToPhotoAlbum { get; set; } - - /// - /// Ignored - /// - [DataMember(IsRequired = false, Name = "correctOrientation")] - public bool CorrectOrientation { get; set; } - - /// - /// Ignored - /// - [DataMember(IsRequired = false, Name = "allowEdit")] - public bool AllowEdit { get; set; } - - /// - /// Height in pixels to scale image - /// - [DataMember(IsRequired = false, Name = "encodingType")] - public int EncodingType { get; set; } - - /// - /// Height in pixels to scale image - /// - [DataMember(IsRequired = false, Name = "mediaType")] - public int MediaType { get; set; } - - - /// - /// Height in pixels to scale image - /// - [DataMember(IsRequired = false, Name = "targetHeight")] - public int TargetHeight { get; set; } - - - /// - /// Width in pixels to scale image - /// - [DataMember(IsRequired = false, Name = "targetWidth")] - public int TargetWidth { get; set; } - - /// - /// Creates options object with default parameters - /// - public CameraOptions() - { - this.SetDefaultValues(new StreamingContext()); - } - - /// - /// Initializes default values for class fields. - /// Implemented in separate method because default constructor is not invoked during deserialization. - /// - /// - [OnDeserializing()] - public void SetDefaultValues(StreamingContext context) - { - PictureSourceType = CAMERA; - DestinationType = FILE_URI; - Quality = 80; - TargetHeight = -1; - TargetWidth = -1; - SaveToPhotoAlbum = false; - CorrectOrientation = true; - AllowEdit = false; - MediaType = -1; - EncodingType = -1; - } - } - - /// - /// Camera options - /// - CameraOptions cameraOptions; - - public void takePicture(string options) - { - try - { - string[] args = JSON.JsonHelper.Deserialize(options); - // ["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType", - // "mediaType", "allowEdit", "correctOrientation", "saveToPhotoAlbum" ] - cameraOptions = new CameraOptions(); - cameraOptions.Quality = int.Parse(args[0]); - cameraOptions.DestinationType = int.Parse(args[1]); - cameraOptions.PictureSourceType = int.Parse(args[2]); - cameraOptions.TargetWidth = int.Parse(args[3]); - cameraOptions.TargetHeight = int.Parse(args[4]); - cameraOptions.EncodingType = int.Parse(args[5]); - cameraOptions.MediaType = int.Parse(args[6]); - cameraOptions.AllowEdit = bool.Parse(args[7]); - cameraOptions.CorrectOrientation = bool.Parse(args[8]); - cameraOptions.SaveToPhotoAlbum = bool.Parse(args[9]); - - // a very large number will force the other value to be the bound - if (cameraOptions.TargetWidth > -1 && cameraOptions.TargetHeight == -1) - { - cameraOptions.TargetHeight = 100000; - } - else if (cameraOptions.TargetHeight > -1 && cameraOptions.TargetWidth == -1) - { - cameraOptions.TargetWidth = 100000; - } - } - catch (Exception ex) - { - DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message)); - return; - } - - // Api supports FILE_URI, DATA_URL, NATIVE_URI destination types. - // Treat all other destination types as an error. - switch (cameraOptions.DestinationType) - { - case Camera.FILE_URI: - case Camera.DATA_URL: - case Camera.NATIVE_URI: - break; - default: - DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect option: destinationType")); - return; - } - - ChooserBase chooserTask = null; - if (cameraOptions.PictureSourceType == CAMERA) - { - chooserTask = new CameraCaptureTask(); - } - else if ((cameraOptions.PictureSourceType == PHOTOLIBRARY) || (cameraOptions.PictureSourceType == SAVEDPHOTOALBUM)) - { - chooserTask = new PhotoChooserTask(); - } - // if chooserTask is still null, then PictureSourceType was invalid - if (chooserTask != null) - { - chooserTask.Completed += onTaskCompleted; - chooserTask.Show(); - } - else - { - Debug.WriteLine("Unrecognized PictureSourceType :: " + cameraOptions.PictureSourceType.ToString()); - DispatchCommandResult(new PluginResult(PluginResult.Status.NO_RESULT)); - } - } - - public void onTaskCompleted(object sender, PhotoResult e) - { - var task = sender as ChooserBase; - if (task != null) - { - task.Completed -= onTaskCompleted; - } - - if (e.Error != null) - { - DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR)); - return; - } - - switch (e.TaskResult) - { - case TaskResult.OK: - try - { - string imagePathOrContent = string.Empty; - - // Save image back to media library - // only save to photoalbum if it didn't come from there ... - if (cameraOptions.PictureSourceType == CAMERA && cameraOptions.SaveToPhotoAlbum) - { - MediaLibrary library = new MediaLibrary(); - Picture pict = library.SavePicture(e.OriginalFileName, e.ChosenPhoto); // to save to photo-roll ... - } - - int newAngle = 0; - // There's bug in Windows Phone 8.1 causing Seek on a DssPhotoStream not working properly. - // https://connect.microsoft.com/VisualStudio/feedback/details/783252 - // But a mis-oriented file is better than nothing, so try and catch. - try { - int orient = ImageExifHelper.getImageOrientationFromStream(e.ChosenPhoto); - switch (orient) { - case ImageExifOrientation.LandscapeLeft: - newAngle = 90; - break; - case ImageExifOrientation.PortraitUpsideDown: - newAngle = 180; - break; - case ImageExifOrientation.LandscapeRight: - newAngle = 270; - break; - case ImageExifOrientation.Portrait: - default: break; // 0 default already set - } - } catch { - Debug.WriteLine("Error fetching orientation from Exif"); - } - - if (newAngle != 0) - { - using (Stream rotImageStream = ImageExifHelper.RotateStream(e.ChosenPhoto, newAngle)) - { - // we should reset stream position after saving stream to media library - rotImageStream.Seek(0, SeekOrigin.Begin); - if (cameraOptions.DestinationType == DATA_URL) - { - imagePathOrContent = GetImageContent(rotImageStream); - } - else // FILE_URL or NATIVE_URI (both use the same resultant uri format) - { - imagePathOrContent = SaveImageToLocalStorage(rotImageStream, Path.GetFileName(e.OriginalFileName)); - } - } - } - else // no need to reorient - { - if (cameraOptions.DestinationType == DATA_URL) - { - imagePathOrContent = GetImageContent(e.ChosenPhoto); - } - else // FILE_URL or NATIVE_URI (both use the same resultant uri format) - { - imagePathOrContent = SaveImageToLocalStorage(e.ChosenPhoto, Path.GetFileName(e.OriginalFileName)); - } - } - - DispatchCommandResult(new PluginResult(PluginResult.Status.OK, imagePathOrContent)); - } - catch (Exception) - { - DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error retrieving image.")); - } - break; - case TaskResult.Cancel: - DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Selection cancelled.")); - break; - default: - DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Selection did not complete!")); - break; - } - } - - /// - /// Returns image content in a form of base64 string - /// - /// Image stream - /// Base64 representation of the image - private string GetImageContent(Stream stream) - { - byte[] imageContent = null; - - try - { - // Resize photo and convert to JPEG - imageContent = ResizePhoto(stream); - } - finally - { - stream.Dispose(); - } - - return Convert.ToBase64String(imageContent); - } - - /// - /// Resize image - /// - /// Image stream - /// resized image - private byte[] ResizePhoto(Stream stream) - { - //output - byte[] resizedFile; - - BitmapImage objBitmap = new BitmapImage(); - objBitmap.SetSource(stream); - objBitmap.CreateOptions = BitmapCreateOptions.None; - - WriteableBitmap objWB = new WriteableBitmap(objBitmap); - objBitmap.UriSource = null; - - // Calculate resultant image size - int width, height; - if (cameraOptions.TargetWidth >= 0 && cameraOptions.TargetHeight >= 0) - { - // Keep proportionally - double ratio = Math.Min( - (double)cameraOptions.TargetWidth / objWB.PixelWidth, - (double)cameraOptions.TargetHeight / objWB.PixelHeight); - width = Convert.ToInt32(ratio * objWB.PixelWidth); - height = Convert.ToInt32(ratio * objWB.PixelHeight); - } - else - { - width = objWB.PixelWidth; - height = objWB.PixelHeight; - } - - //Hold the result stream - using (MemoryStream objBitmapStreamResized = new MemoryStream()) - { - - try - { - // resize the photo with user defined TargetWidth & TargetHeight - Extensions.SaveJpeg(objWB, objBitmapStreamResized, width, height, 0, cameraOptions.Quality); - } - finally - { - //Dispose bitmaps immediately, they are memory expensive - DisposeImage(objBitmap); - DisposeImage(objWB); - GC.Collect(); - } - - //Convert the resized stream to a byte array. - int streamLength = (int)objBitmapStreamResized.Length; - resizedFile = new Byte[streamLength]; //-1 - objBitmapStreamResized.Position = 0; - - //for some reason we have to set Position to zero, but we don't have to earlier when we get the bytes from the chosen photo... - objBitmapStreamResized.Read(resizedFile, 0, streamLength); - } - - return resizedFile; - } - - /// - /// Util: Dispose a bitmap resource - /// - /// BitmapSource subclass to dispose - private void DisposeImage(BitmapSource image) - { - if (image != null) - { - try - { - using (var ms = new MemoryStream(new byte[] { 0x0 })) - { - image.SetSource(ms); - } - } - catch (Exception) - { - } - } - } - - /// - /// Saves captured image in isolated storage - /// - /// image file name - /// Image path - private string SaveImageToLocalStorage(Stream stream, string imageFileName) - { - - if (stream == null) - { - throw new ArgumentNullException("imageBytes"); - } - try - { - var isoFile = IsolatedStorageFile.GetUserStoreForApplication(); - - if (!isoFile.DirectoryExists(isoFolder)) - { - isoFile.CreateDirectory(isoFolder); - } - - string filePath = System.IO.Path.Combine("///" + isoFolder + "/", imageFileName); - - using (IsolatedStorageFileStream outputStream = isoFile.CreateFile(filePath)) - { - BitmapImage objBitmap = new BitmapImage(); - objBitmap.SetSource(stream); - objBitmap.CreateOptions = BitmapCreateOptions.None; - - WriteableBitmap objWB = new WriteableBitmap(objBitmap); - objBitmap.UriSource = null; - - try - { - - //use photo's actual width & height if user doesn't provide width & height - if (cameraOptions.TargetWidth < 0 && cameraOptions.TargetHeight < 0) - { - objWB.SaveJpeg(outputStream, objWB.PixelWidth, objWB.PixelHeight, 0, cameraOptions.Quality); - } - else - { - //Resize - //Keep proportionally - double ratio = Math.Min((double)cameraOptions.TargetWidth / objWB.PixelWidth, (double)cameraOptions.TargetHeight / objWB.PixelHeight); - int width = Convert.ToInt32(ratio * objWB.PixelWidth); - int height = Convert.ToInt32(ratio * objWB.PixelHeight); - - // resize the photo with user defined TargetWidth & TargetHeight - objWB.SaveJpeg(outputStream, width, height, 0, cameraOptions.Quality); - } - } - finally - { - //Dispose bitmaps immediately, they are memory expensive - DisposeImage(objBitmap); - DisposeImage(objWB); - GC.Collect(); - } - } - - return new Uri(filePath, UriKind.Relative).ToString(); - } - catch (Exception) - { - //TODO: log or do something else - throw; - } - finally - { - stream.Dispose(); - } - } - - } -} diff --git a/www/blackberry10/assets/camera.html b/www/blackberry10/assets/camera.html deleted file mode 100644 index 2ebd9d1..0000000 --- a/www/blackberry10/assets/camera.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - -
- -
-
- -
-
-
-
-
-
- - diff --git a/www/blackberry10/assets/camera.js b/www/blackberry10/assets/camera.js deleted file mode 100644 index 2a272be..0000000 --- a/www/blackberry10/assets/camera.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -document.addEventListener('DOMContentLoaded', function () { - document.getElementById('back').onclick = function () { - window.qnx.callExtensionMethod('cordova-plugin-camera', 'cancel'); - }; - window.navigator.webkitGetUserMedia( - { video: true }, - function (stream) { - var video = document.getElementById('v'); - var canvas = document.getElementById('c'); - var camera = document.getElementById('camera'); - video.autoplay = true; - video.width = window.innerWidth; - video.height = window.innerHeight - 100; - video.src = window.webkitURL.createObjectURL(stream); - camera.onclick = function () { - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; - canvas.getContext('2d').drawImage(video, 0, 0, video.videoWidth, video.videoHeight); - window.qnx.callExtensionMethod('cordova-plugin-camera', canvas.toDataURL('img/png')); - }; - }, - function () { - window.qnx.callExtensionMethod('cordova-plugin-camera', 'error', 'getUserMedia failed'); - } - ); -});