iOS Thin Client

ScreenPad is a thin client that allows an iOs touch screen to be incorporated into desktop apps. This can act both as a second screen and as a more intuitive form of interaction. Developers only need to add a few extra lines of code to their app to get started with ScreenPad. It's also possible to use ScreenPad purely as a thin client to a server, so that custom content can be served to a number of iOS devices on the lan.

To use ScreenPad, simply run a supported desktop application, then start the iOS app. The two machines should find each other on the LAN, indicated by the ScreenPad turning form red to green, and then it should just start working. If you're on a large network via ethernet, you can create an extra "personal" wifi network just for screenpad, using the "Create Network" option on you desktops Airport menu - this should help performance.

ScreenPad is currently supported by:

Source code for ScreenPadWebCam is freely available, and provides classes which should be used to talk to a ScreenPad iOS device, allowing developers to easily incorporate ScreenPad into their own apps. Simlarly the code for LookRoundCorners contains an almost identical set of classes, modified to run on IOS, allowing you to use ScreenPad between to iPhones.

Adding ScreenPad support to an app can be as simple as dragging the ScreenPad classes from the demo app into your own project, creating a client in your view class:

		myScreenPad=[[ScreenPadClient alloc]initWithDelegate:self];

add empty delegate methods and updating your drawSelf method to draw to the remote device
- (void)drawRect:(NSRect)dirtyRect {
	
	
	//Regular Drawing
	[self doDrawing:dirtyRect];
	
	//ScreenPad  Drawing
	NSImage *image=[[NSImage alloc]initWithSize:[myScreenPad viewSize]];
	[image lockFocus];
	NSRect rect=NSMakeRect(0, 0, [myScreenPad viewSize].width, [myScreenPad viewSize].height);
	[self doDrawing:rect];
	[image unlockFocus];
	[myScreenPad sendImage:image];
	[image release];
}
Further details are included in the ScreenPadWebCam source bundle. Alternativly if you're using OpenGL you can use the following code to generate an image of a view that you've drawn:
- (NSImage *) flipImage: (NSImage *)image
{
	assert(image != nil);
	
	NSSize size = [image size];
	NSImage *newImage = [[NSImage alloc] initWithSize:size];
	[newImage autorelease];
	
	[newImage setFlipped:YES];
	[newImage lockFocus];
	[image drawInRect:NSMakeRect(0,0,size.width,size.height) 
			 fromRect:NSMakeRect(0,0,[image size].width, [image size].height) 
			operation:NSCompositeSourceOver fraction:1.0];
	[newImage unlockFocus];
	[newImage setFlipped:NO];

	return newImage;
}

- (NSImage *)image
{
	int height=NSHeight([self bounds]);
	int width=NSWidth([self bounds]);
	//NSLog(@"%d,%d",width,height);
	NSBitmapImageRep *imageRep;
	NSImage *image;
	imageRep=[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
													 pixelsWide:width
													 pixelsHigh:height
												  bitsPerSample:8
												samplesPerPixel:3
													   hasAlpha:NO
													   isPlanar:NO
												 colorSpaceName:NSCalibratedRGBColorSpace
													bytesPerRow:(width*3+3)&~3	//pack to four bytes
												   bitsPerPixel:0];
	[[self openGLContext] makeCurrentContext];
	glReadPixels(0,0,width,height,GL_RGB,GL_UNSIGNED_BYTE,[imageRep bitmapData]);
	
	image=[[[NSImage alloc] initWithSize:NSMakeSize(width,height)] autorelease];
	[image addRepresentation:imageRep];
	[imageRep release];
	
	return [self flipImage:image];
}
and then send it using:
	[myScreenPad sendImage:[self image]];

Download

You can get the ScreenPad iOS app from the iTunes AppStore. In the future ther may be a small charge for the iOS app. However it's currently free, and developers can get a free copy by contacting me.

The OSX WebCam app can be downloaded here

The MacOS source code can be downloaded here

The iOS Look Round Corners source code can be downloaded here.

Ian Stephenson.
DCT Systems
NCCA, Bournemouth University