Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3556] iOS: Transform Camera

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-02-19T16:10:39.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sn/a
ComponentsiOS
Labelsfeature, ios, rplist
ReporterDawson Toth
AssigneeIngo Muschenetz
Created2011-04-15T03:46:37.000+0000
Updated2020-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>

Associated Helpdesk Ticket

http://support.appcelerator.com/tickets/UYQ-99734-671

Comments

  1. Nicole 2011-10-06

    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.
  2. Manojkumar Murugesan 2013-11-29

    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.
  3. Manojkumar Murugesan 2013-12-03

    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?
  4. Rene Pot 2020-02-19

    closing for inactivity.

JSON Source