cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian LeRoux...@brian.io>
Subject Re: iOS ScreenCapture plugin for Cordova
Date Mon, 15 Apr 2013 20:10:36 GMT
My only feedback would be to see if you can get it working w/ Plugman! [1]
(And if not lets file issues [2] to ensure it can.)

[1] https://github.com/apache/cordova-plugman
[2] http://issues.cordova.io




On Mon, Apr 15, 2013 at 11:01 AM, Max Woghiren <maxw@chromium.org> wrote:

> Hi Aaron,
>
> One quick, general Objective-C thing I noticed: when creating messages,
> it's helpful (and recommended) for readability to write declarations like
> this:
>
> - (void)getScreenBitsWithCaptureOptions:(NSObject*)captureOptions
> compareOptions:(NSObject*)compareOptions captureCount:(int)captureCount
> command:(CDVInvokedUrlCommand*)command;
>
> This way, when sending the message, the code looks like this:
>
> [self getScreenBitsWithCaptureOptions:captureOptions compareOptions:nil
> captureCount:self.mCaptureCount++ command:command];
>
> Without the parameter headings, your line 30 is confusing:
>
> [self getScreenBits:captureOptions:nil:self.mCaptureCount++:command];
>
> since, for example, it's unclear what nil is referring to.  It still
> compiles and works, but is less readable.
> This<
> http://stackoverflow.com/questions/722651/how-do-i-pass-multiple-parameters-in-objective-c
> >stackoverflow
> question covers it fairly well.
>
> On Mon, Apr 15, 2013 at 12:58 PM, Aaron Charbonneau <amcharbo@gmail.com>
> wrote:
> >
> > Hello Everyone,
> > I recently shared my code for a screen capture plugin for Android Cordova
> > not too long back, and since then have been working on an iOS version.
>  It
> > exposes the same api's to javascript and behaves identically between the
> > two platforms.
> >
> > The goal of these plugins is to provide a way of testing and debugging
> > Cordova applications, as well as testing Cordova itself.  With this
> plugin
> > you can render a WebView, take a capture of it, optionally isolate a
> > certain area of the capture, and write that capture to file, and even
> > provide a comparison image to validate the WebView is rendering
> correctly.
> >
> > Here's a brief overview of the functions it provides:
> > ScreenCapture.capture() - Takes a screenshot of the current WebView, with
> > optional output file name and subrect region.
> > ScreeCapture.captureAndCompare() - Same functionality as Capture, but you
> > can also include the url of a comparison image, and pixel/color
> tolerances
> > to perform an image compare on the native side for better performance.
> >
> > Both of the these functions funnels into a do-it-all function
> > getScreenBits,  In getScreenBits we spin off background threads to do
> file
> > IO and comparison work.  There is one section I'm not quite sure of, and
> > that is getting the raw pixel data out of a UIImage.  I ran into a
> problem
> > where the data was not in the correct colorSpace when getting it from the
> > UIImage directly, like this:
> > CFDataRef actualImageData = CGDataProviderCopyData
> > (CGImageGetDataProvider(image.CGImage));
> >
> > So I instead went with a way that works, but seems inefficient to me as
> it
> > involves a copy, this code is currently used in the getRawDataFromImage()
> > function.
> >
> > Once again, if anyone can afford the time, I would love some feedback on
> > the iOS implementation of this plugin, as I am still learning Objective
> C.
> >
> > Plugin:
> >
>
> https://github.com/Charbs09/Cordova-Mobile-Spec-ScreenCapture/blob/master/iOS/CordovaMobileSpecScreenCapture/Plugins/CDVScreenCapture.m
> >
> > Usage:
> >
>
> https://github.com/Charbs09/Cordova-Mobile-Spec-ScreenCapture/blob/master/iOS/www/autotest/tests/rendering.tests.js
> >
> > Also the non-working UIImage rawData code:
> >
>
> https://github.com/Charbs09/Cordova-Mobile-Spec-ScreenCapture/blob/master/iOS/CordovaMobileSpecScreenCapture/Plugins/CDVScreenCaptureNoCopy.m#L132
> >
> >
> > Thanks alot for your time!
> > Aaron
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message