Currently browsing category

Code Snippets

Data Source Handling with Tomcat 7.0

The “new” J2EE6 standard allows for setting up of datasources in the web.xml of a web application. If the webserver is compliant- this feature will enable defining your database resources in the web.xml like the example below. web.xml config MySQL Datasource example jdbc/mkyongdb javax.sql.DataSource Container Thanks to resource injection, the …

recolour-image

Code Snippet: Recolour an Image

This method will recolour an image to a new colour. However, it does give a washed out look to the image IMO. package net.avdw.image { import flash.display.BitmapData; import flash.filters.ColorMatrixFilter; import flash.geom.Point; import flash.geom.Rectangle; import net.avdw.color.extractARGB; /** * Makes a bitmap data object the color provided. * * @param destBitmapData The …

sepia-image

Code Snippet: Make a Image Sepia

The below code will convert an image to sepia. package net.avdw.image { import flash.display.BitmapData; import flash.filters.ColorMatrixFilter; import flash.geom.Point; import flash.geom.Rectangle; /** * Makes a bitmap data object sepia. * * @param destBitmapData The destination bitmap data object. * @param sourceBitmapData The source bitmap data where the pixel data is retrieved. …

grayscale-example

Code Snippet: How to Grayscale an Image

The below actionscript snippet will transform an image to grayscale using the ColorMatrixFilter. package net.avdw.image { import flash.display.BitmapData; import flash.filters.ColorMatrixFilter; import flash.geom.Point; import flash.geom.Rectangle; /** * Makes a bitmap data object grayscale. * * @param destBitmapData The destination bitmap data object. * @param sourceBitmapData The source bitmap data where the …