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 Tue, 16 Apr 2013 17:23:09 GMT
Right on, how was the experience w/ Plugman? Anything we are missing /
should change?


On Mon, Apr 15, 2013 at 6:04 PM, Aaron Charbonneau <amcharbo@gmail.com>wrote:

> Plugman is a pretty cool little tool!  I was able to get the ScreenCapture
> plugin working with it fairly easily for both iOS and Android, here it is:
>
> https://github.com/Charbs09/ScreenCapture
>
> Right now it only supports Cordova 2.3.0 and higher since that is the
> version I started development with.  If there is concern to have this
> compatible with older versions I can add that functionality.
>
> Thanks again for showing me the ropes here!
> -Aaron
>
>
> On Mon, Apr 15, 2013 at 2:17 PM, Aaron Charbonneau <amcharbo@gmail.com
> >wrote:
>
> > Max: That's a great tip, I added the parameter labels as you suggested,
> > thanks!
> >
> > Brian: I'll try to get this going with Plugman and let you know how it
> > goes.
> >
> > Thanks!
> > -Aaron
> >
> >
> > On Mon, Apr 15, 2013 at 1:10 PM, Brian LeRoux <b@brian.io> wrote:
> >
> >> 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