[TIMOB-3556] iOS: Transform Camera
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-02-19T16:10:39.000+0000 |
Affected Version/s | Release 1.7.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | feature, ios, rplist |
Reporter | Dawson Toth |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:46:37.000+0000 |
Updated | 2020-02-19T16:10:39.000+0000 |
Description
Let users apply a transform to the camera preview AFTER it has been shown (i.e. expose [picker setCameraViewTransform:[transform matrix]]). This will open up some interesting use cases.
Sample Code
Tested on an iPad 2, the following could be dropped in MediaModule.m:
-(void)applyTransform:(id)args
{
ENSURE_UI_THREAD(applyTransform, args);
ENSURE_SINGLE_ARG_OR_NIL(args, NSDictionary);
if (args!=nil)
{
// allow a transform on the preview image
id transform = [args objectForKey:@"transform"];
if (transform != nil)
{
[picker setCameraViewTransform:[transform matrix]];
}
else
{
// revert to use our own fullscreen transform if the developer didn't supply one
picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
}
}
}
And it could be consumed by this trivial app.js:
Ti.UI.createWindow({ backgroundColor: '#fff' }).open();
Ti.Media.showCamera();
Ti.Media.applyTransform({ transform: Ti.UI.create2DMatrix().scale(5) });</code>
I'd like this feature too. It can be used to create apps like 'magnifying glass'. Hope it would be included in the next release. Thanks.
For 2 of my apps, this feature is required. For now I adjust it with 2d scale but it is not good, the scale is variable on different devices with different version of iOS. We need this fix.
Will this code change on MediaModule.m solve the problem? Usually I get problems on iPhone. Camera preview will not fill the fullscreen. Will that be solved?
closing for inactivity.