GreyShaders is a mobile application/tool available on the Google and Apple App Stores.
Comments are welcome! Share references and knowledge about color space conversion in the comments section below and I’ll continue to expand this post with relevant updates at the bottom of this post. Enjoy the app!
Humans sense pure Green as brighter than pure Red, and Red is sensed as brighter than Blue. Therefore when we create a greyscale image based on a source color image we derive most of the brightness from the Green channel of the source image, followed by the Red channel, and finally the Blue channel contributes the least to the brightness of the converted image.
This weighted-conversion from color to greyscale can be done using several algorithms that approximate the perceived brightnesses of colors. Some algorithms do a better job of selecting the appropriate greyscale tone to represent the colors in the original image.
The Grey Shader app demonstrates several popular conversion algorithms. Users can toggle between the original full-color image and each shader-modified greyscale version. This allows optimal A/B comparison. More info about the Grey Shader app and each of the GLSL shaders it uses is below. [Read More…]
This is a bare-bones example of a shader in Cocos2d-x v.3.2. This shader simply swaps the color channels of the texture image. The Blue channel is drawn in the Red channel, Green in Blue, and Red in Green. See the results here: BasicShaderScreenshot.jpg
We recently encountered SecurityError #2122 when trying to capture BitmapData from a video file. Crossdomain.xml files were being requested as required for using BitmapData.draw on content loaded into a SWF. Everything had been working well until we tried using a video hosted by Vimeo using their Pro service that allows you to use them as a CDN — they deliver video files and you play them in your own player.
[For an excellent background description about this redirect problem, read the posts linked below]
We determined that the media file returned to FlashPlayer was coming from a different domain than the domain we were requesting the video from. We considered detecting the domain of the redirected media file and following up our media file request with a Security.loadPolicyFile call using the new domain. [Read More…]
Over-The-Shoulder Quick Tip
You have a Debug SWF uploaded to your server and want to use Flash Builder’s debugger features on it. You need to debug it from within its server environment for whatever reason. How do you initiate a debugger session in Flash Builder that connects with the debug-enabled SWF running from your server in the browser?
Answer: in Flash Builder’s Debug Configurations panel, set the *URL or path to launch* to “about:Blank”. Launch that debug configuration. Flash Builder begins listening for a debug SWF to be launched. Now launch the html page on the web that is hosting the debug-enabled SWF (in a browser with the debug version of the Flash Player installed). Flash Builder detects the SWF and begins debugging.
Over-The-Shoulder Quick Tip
Accessing VideoSurface in OSMF is useful if you want to capture a snapshot of the playing video, but it can be difficult to locate the video display object. I found a tip in the comments section of a post by Nils Thingvall that helped:
var tVideoSurface : VideoSurface = ( view.mediaPlayerCore.media.getTrait( MediaTraitType.DISPLAY_OBJECT ) as DisplayObjectTrait ).displayObject as VideoSurface;
var tBitmapData : BitmapData = new BitmapData( tVideoSurface.width, tVideoSurface.height, true, 0 );
tBitmapData.draw( tVideoSurface );
Over-The-Shoulder Quick Tip
The solution to this error was simple but didn’t reveal itself easily.
unexpected argument –migrate
The hyphen/dash is the wrong character! I must have copied/pasted it from somewhere.
The solution was found here: http://forums.adobe.com/message/2404728
Flash Player can send images to web services like Amazon AWS. The built-in behavior requires the user to browse to an image on the user’s system using a system dialog to select the image for sending. It is possible to send an image from Flash Player without requiring the use of a system dialog to locate the image file, and even without the requirement of saving the image to the system before sending it! In fact, images can be sent without any user interaction whatsoever.
In a recent application we developed, we deployed a solution for capturing BitmapData of a playing video and sent the image to Amazon AWS. The thumbnail could be retrieved later for populating a display of the user’s video bookmarks.
- Capture a BitmapData object of something being displayed in a SWF – any display object
- Convert it to JPG. Several methods are available, we used: https://github.com/LeeBurrows/Async-Image-Encoders
- Using HTTP POST, send the image to Amazon (or anywhere) for storage. This is the difficult part. We derived our solution from Open Booth: https://github.com/obsesh/openbooth/
Tip 1: playing an FLV from your local machine.
To play a local video you must modify your config XML file to include a baseURL. Otherwise, the video fails to load.
When publishing a mobile application with Adobe AIR, it’s possible to access the information in your application’s application descriptor xml file at runtime on a mobile device. Below is an example of accessing the versionNumber and renderMode from the application descriptor.
I’ve been doing ActionScript 3.0 development for over 10 years, making games and applications for mobile devices and Mac/Win desktops. I’ve recently been expanding my skills and learning Unity3D with C#. This post lists some of my discoveries and the resources that I’ve encountered along the way. These notes may be especially interesting to other ActionScript developers as they also begin to dabble in Unity3D and look for areas of similarity and difference between these 2 great development platforms. [Read More…]