text:
<?xml version = "1.0"?>
<?xml-stylesheet type="text/xsl" href="pb_help.xsl"?>
<API>
    <MODULE name="Camera" parent="Rho"  productException="">
        <HELP_OVERVIEW>The Camera API provides access to the device camera(s). Use this API to give users the ability to take a photo via one of the cameras and return it to the application. Photos can either be stored on the device as an image file or returned as a DataURI object for storage and/or display. Optionally, image files also can be transfered to online storage using the Network API.</HELP_OVERVIEW>
        <MORE_HELP>
## Enabling the API
To use this API, the following extension must be included in the `build.yml`:
    :::ruby
    extensions: ["mediacapture"]

## JavaScript Usage
Be sure to review the [JavaScript API Usage](/guide/api_js) guide for important information about using this API in JavaScript

## Ruby Usage
Be sure to review the [Ruby API Usage](/guide/api_ruby) guide for important information about using this API in Ruby

        </MORE_HELP>
        <MORE_HELP_EB>
## Enabling the API

There are two methods of enabling the Camera API:

* Include all 'ebapi' modules
* Include only the API modules you need

Both methods are explained below.

Either way, the included files will be found in:
`/Enterprise Browser/JavaScript Files/Enterprise Browser`,
a directory on the computer that contains the Enterprise Browser installation.

### Include all JS API modules
To include all JavaScript APIs, copy the `ebapi-modules.js` file to a location accessible by your app's files and include the JavaScript modules file in your app. For instance, to include the modules file in your `index.html`, copy the file to the same directory as your index.html and add the following line to the HEAD section of your index.html file:

    :::html
    <script type="text/javascript" charset="utf-8" src="ebapi-modules.js"></script>

> This will define the EB class within the page. **Note that the path for this file is relative to the current page** (index.html). Any page on which the modules are required will need to have the required .js file(s) included in this fashion.

### Include only the modules you need
To include individual APIs, you must first include the `ebapi.js` in your HTML, and then the additional required API file(s). For instance, to use the Camera API, add the following code to the HTML file(s). Again, this assumes that relevant API files have been copied to the same directory as the HTML.

    :::html
    <script type="text/javascript" charset="utf-8" src="ebapi.js"></script>
    <script type="text/javascript" charset="utf-8" src="eb.camera.js"></script>

> In the code lines above, notice that `ebapi.js` is included first, followed by `eb.camera.js`, which is the Camera API for Enterprise Browser. **This coding is required on each HTML page whenever an individual API will be called from that page**.

        </MORE_HELP_EB>
        <PLATFORM>Android, iOS, WM, CE, WP8</PLATFORM>
        <PLATFORM_EB>WM, Android</PLATFORM_EB>

        <ALIASES>
            <ALIAS new="Camera" deprecated="true"/>
        </ALIASES>
        <TEMPLATES>
            <!-- <SINGLETON_INSTANCES/>   produce enumerate() fabric method, all instances is singletones by ID, add ID property -->
            <DEFAULT_INSTANCE/> <!-- object has default static property, all methods can be call by static way (called from default instance), produce default(), set_default() methods -->
            <PROPERTY_BAG/> <!-- object has properties, produce getProps(), setProps() methods -->
        </TEMPLATES>
		<CONSTANTS>

		  <!-- Camera Types -->

			<CONSTANT name="CAMERA_TYPE_BACK" value="back" type="STRING">
				<DESC>Back camera. This is not supported in WM/CE devices.</DESC>
			</CONSTANT>
			<CONSTANT name="CAMERA_TYPE_FRONT" value="front" type="STRING">
				<DESC>Front camera. This is not supported in WM/CE devices.</DESC>
			</CONSTANT>
			 <CONSTANT name="CAMERA_TYPE_IMAGER" value="imager" type="STRING">
				<DESC>Camera is an imager. This is supported only in WM/CE devices.</DESC>
			</CONSTANT>
			 <CONSTANT name="CAMERA_TYPE_COLOR" value="color" type="STRING">
				<DESC>Camera is color camera. This is supported only in WM/CE devices.</DESC>
			</CONSTANT>
			 <!-- Camera Compression Format -->
			 <CONSTANT name="COMPRESSION_FORMAT_JPG" value="jpg" type="STRING">
				<DESC>JPG compression.</DESC>
			</CONSTANT>
			<CONSTANT name="COMPRESSION_FORMAT_PNG" value="png" type="STRING">
				<DESC>PNG compression.</DESC>
			</CONSTANT>
			 <!-- Camera Output Image Format -->
			<CONSTANT name="OUTPUT_FORMAT_IMAGE" value="image" type="STRING">
				<DESC>This shall provide the image uri. This can be used to display image directly on the page. An example is shown in the example section</DESC>
			</CONSTANT>
			<CONSTANT name="OUTPUT_FORMAT_DATAURI" value="dataUri" type="STRING">
				<DESC>This is a base 64 encoding of the image and can be used to easily embed the image on the page or store the image in a database. On some consumer devices, captured image will be rotated 90 degrees while displaying.</DESC>
			</CONSTANT>
			<CONSTANT name="OUTPUT_FORMAT_IMAGE_PATH" value="imagePath" type="STRING">
				<DESC>If this value used for setting the outputFormat property, the takePicture or capture API will return imageUri as the path to the saved image in the device. User can use this image path to transfer the file to an http server if required. An example is given to demonstrate, transferring a file to http server.This property is not applicable for Android and windows phone 8.</DESC>
			</CONSTANT>
			<!-- Camera Color Model -->
			<CONSTANT name="COLOR_MODEL_RGB" value="rgb" type="STRING">
				<DESC>A colour image is captured.</DESC>
			</CONSTANT>
			<CONSTANT name="COLOR_MODEL_GRAYSCALE" value="grayscale" type="STRING">
				<DESC>A grayscale image is captured.</DESC>
			</CONSTANT>

			<CONSTANT name="FLASH_ON" value="on" type="STRING">
				<DESC>Flash will be used.</DESC>
			</CONSTANT>
			<CONSTANT name="FLASH_OFF" value="off" type="STRING">
				<DESC>Flash will not be used.</DESC>
			</CONSTANT>
			<CONSTANT name="FLASH_AUTO" value="auto" type="STRING">
				<DESC>Flash will be used if lighting conditions deem it necessary. This is not supported in WM/CE devices.</DESC>
			</CONSTANT>
			<CONSTANT name="FLASH_RED_EYE" value="redEye" type="STRING">
				<DESC>Flash with red eye reduction is used. This is supported only in Android devices.</DESC>
			</CONSTANT>
			<CONSTANT name="FLASH_TORCH" value="torch" type="STRING">
				<DESC>The flash is turned on in torch mode. This is supported only in Android devices.</DESC>
			</CONSTANT>
			<!-- Camera Imager AIM Types -->
			<CONSTANT name="AIM_ON" value="on" type="STRING">
				 <DESC>Switches the imager's aim to ON </DESC>
			</CONSTANT>
			<CONSTANT name="AIM_OFF" value="off" type="STRING">
				<DESC>Switches the imager's aim to OFF </DESC>
			</CONSTANT>
        </CONSTANTS>
        <PROPERTIES usePropertyBag="accessorsViaPropertyBag" generateAccessors="true" >
            <DESC>These properties are used to configure the Camera.</DESC>
            <ALIASES>
                <ALIAS new="format" existing="compressionFormat" deprecated="true"/>
                <ALIAS new="desired_height" existing="desiredHeight" deprecated="true"/>
                <ALIAS new="desired_width" existing="desiredWidth" deprecated="true"/>
                <ALIAS new="color_model" existing="colorModel" deprecated="true"/>
                <ALIAS new="enable_editing" existing="enableEditing" deprecated="true"/>
                <ALIAS new="flash_mode" existing="flashMode" deprecated="true"/>
                <ALIAS new="save_to_shared_gallery" existing="saveToDeviceGallery" deprecated="true"/>
                <ALIAS new="left" existing="previewLeft" deprecated="true"/>
                <ALIAS new="top" existing="previewTop" deprecated="true"/>
                <ALIAS new="camera_type" existing="cameraType" deprecated="true"/>
            </ALIASES>

            <PROPERTY name="cameraType" type="STRING" readOnly="true">
			    <PLATFORM>Android, iOS, WP8, WM, CE</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>This property is device specific. The value for this property can be either 'back' or 'front' in the case of Android/iOS/WP8 devices.In the case of WM/CE it could be either 'imager' or 'color'. WM/CE devices will use 'color'as default and if color camera not available the default value will be 'imager'. Android/iOS/WP8 devices will use 'back'as default and if back camera not available the default value will be 'front',
				This Property shall return one among the values mentioned in constant section which starts with CAMERA_TYPE_...
				</DESC>
                <DESC_EB>This property is device specific. The value for this property can be either 'back' or 'front' in the case of Android devices.In the case of windows it could be either 'imager' or 'color'. WM/CE devices will use 'color'as default and if color camera not available the default value will be 'imager'. Android devices will use 'back'as default and if back camera not available the default value will be 'front'.
				This Property shall return one among the values mentioned in constant section which starts with CAMERA_TYPE_...</DESC_EB>

            </PROPERTY>
            <PROPERTY name="maxWidth" type="INTEGER" generateAccessors="true" readOnly="true">
                <PLATFORM>Android, iOS, WP8, WM, CE</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>The maximum width of images which can be captured. This is measured in pixels. On WM/CE devices this is applicable only for color camera. Imager does not support this property.</DESC>
            </PROPERTY>
            <PROPERTY name="maxHeight" type="INTEGER" generateAccessors="true" readOnly="true">
                <PLATFORM>Android, iOS, WP8, WM, CE</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>The maximum height of images which can be captured. This is measured in pixels. On WM/CE devices this is applicable only for color camera. Imager does not support this property.</DESC>
            </PROPERTY>
            <PROPERTY name="supportedSizeList" type="ARRAY" readOnly="true" usePropertyBag="none" >
                <PARAM type="HASH">
                    <PARAMS>
                        <PARAM name="width" type="INTEGER"/>
                        <PARAM name="height" type="INTEGER"/>
                    </PARAMS>
                </PARAM>
                <PLATFORM>Android, WP8, WM, CE, iOS</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>List of resolutions (width and height in pixels) supported by the camera. On WM/CE devices this feature is supported only by color camera and it is not supported by imager. Refer example section for more details.</DESC>
            </PROPERTY>
            <PROPERTY name="desiredWidth" type="INTEGER">
                <VER_INTRODUCED>2.0.0</VER_INTRODUCED>
				<PLATFORM>Android, iOS, WM, CE, WP8</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>Camera hardware is limited to taking photos in a finite number of resolutions, eg 2048x1536, 640x480 etc. Specifying a desiredWidth will request to take the photo with the specified width but if it is not supported by the hardware then the closest match will be selected. The callback received when a photo is taken contains the actual resolution of the captured photo.</DESC>
            </PROPERTY>
            <PROPERTY name="desiredHeight" type="INTEGER">
                <VER_INTRODUCED>2.0.0</VER_INTRODUCED>
				<PLATFORM>Android, iOS, WM, CE, WP8</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>Camera hardware is limited to taking photos in a finite number of resolutions, eg 2048x1536, 640x480 etc. Specifying a desiredHeight will request to take the photo with the specified height but if it is not supported by the hardware then the closest match will be selected. The callback received when a photo is taken contains the actual resolution of the captured photo.</DESC>
            </PROPERTY>
            <PROPERTY name="fileName" type="STRING">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
				<PLATFORM>Android, iOS, WM, CE, WP8</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>The image file path without file extension to store captured image in subsequent calls to takePicture() or capture(). Default filename will be IMG_timestamp and will be saved under root directory. The filename extension will be added automatically according to compressionFormat property value.
				In Wp8, only filename can be changed, by default the path shall be under picture=>CameraRoll</DESC>
            </PROPERTY>
            <PROPERTY name="compressionFormat" type="STRING" default="jpg">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
                <APPLIES>JPG is supported on all devices, Android, WP8 and Windows Mobile does not support PNG images</APPLIES>
                <PLATFORM>Android, iOS, WM, CE, WP8</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>The format of the captured image in subsequent calls to takePicture(). If you do not define this property when you use choose_picture with iOS, the type of image in Gallery will be recognized, and the same format will be used for saving the image to applications data. In windows and WP8 devices the format will be always jpg type.
				This Property shall accept/return one among the values mentioned in constant section which starts with COMPRESSION_FORMAT_...
				</DESC>
                <DESC_EB>The format of the captured image in subsequent calls to takePicture(). On windows devices the format will be always .jpg type.
				This Property shall accept/return one among the values mentioned in constant section which starts with COMPRESSION_FORMAT_...
				</DESC_EB>

            </PROPERTY>
            <PROPERTY name="outputFormat" type="STRING" default="imagePath">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
				<PLATFORM>Android, iOS, WM, CE, WP8</PLATFORM>
                <PLATFORM_EB>WM, CE, Android</PLATFORM_EB>
                <DESC>Specifies the way to return the captured image to the application.
				This Property shall accept/return one among the values mentioned in constant section which starts with OUTPUT_FORMAT_...</DESC>
				<DESC_EB>Specifies the way to return the captured image to the application.
				This Property shall accept/return one among the values mentioned in constant section which starts with OUTPUT_FORMAT_...
				</DESC_EB>

            </PROPERTY>
            <PROPERTY name="colorModel" type="STRING" default="rgb">
                <VER_INTRODUCED>2.0.0</VER_INTRODUCED>
                <PLATFORM>Android, iOS</PLATFORM>
                <PLATFORM_EB>Android</PLATFORM_EB>
                <DESC>Where supported by the hardware this property can be used to select whether to capture a color or a grayscale image.
				This Property shall accept/return one among the values mentioned in constant section which starts with COLOR_MODEL_...</DESC>
				<DESC_EB>Where supported by the hardware this property can be used to select whether to capture a color or a grayscale image.
				This Property shall accept/return one among the values mentioned in constant section which starts with COLOR_MODEL_...
				</DESC_EB>

            </PROPERTY>
            <PROPERTY name="enableEditing" type="BOOLEAN" default="true" productException="eb">
                <VER_INTRODUCED>2.0.0</VER_INTRODUCED>
                <PLATFORM>iOS</PLATFORM>
                <DESC>Enables post photo capture image customizing; image will captured reduced to screen size (not full size of camera sensor).</DESC>
            </PROPERTY>
            <PROPERTY name="flashMode" type="STRING">
                <VER_INTRODUCED>2.0.0</VER_INTRODUCED>
                <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                <DESC>Specifies the flash behavior when taking a picture.
				This Property shall accept/return one among the values mentioned in constant section which starts with FLASH_...</DESC>
				<DESC_EB>Specifies the flash behavior when taking a picture.
				This Property shall accept/return one among the values mentioned in constant section which starts with FLASH_...</DESC_EB>

            </PROPERTY>
            <PROPERTY name="saveToDeviceGallery" type="BOOLEAN" default="false">
                <VER_INTRODUCED>2.0.0</VER_INTRODUCED>
                <PLATFORM>iOS,Android</PLATFORM>
                <PLATFORM_EB>Android</PLATFORM_EB>
                <DESC>If true, the picture you take will be added to the device photo gallery.</DESC>
            </PROPERTY>
            <PROPERTY name="captureSound" type="STRING">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
                <PLATFORM>Android, WM, CE</PLATFORM>
                <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                <DESC>Path to a sound file resident on the device which will be played when the image is captured.</DESC>
            </PROPERTY>
            <PROPERTY name="previewLeft" type="INTEGER">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
                <PLATFORM>WM, CE</PLATFORM>
                <DESC>In cases where the resident camera application on the device is not used this API is used to control the position of the viewfinder preview window when taking a photo.</DESC>
            </PROPERTY>
            <PROPERTY name="previewTop" type="INTEGER">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
                <PLATFORM>WM, CE</PLATFORM>
                <DESC>In cases where the resident camera application on the device is not used this API is used to control the position of the viewfinder preview window when taking a photo.</DESC>
            </PROPERTY>
            <PROPERTY name="previewWidth" type="INTEGER">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
                <PLATFORM>WM, CE</PLATFORM>
                <DESC>In cases where the resident camera application on the device is not used this API is used to control the position of the viewfinder preview window when taking a photo.</DESC>
            </PROPERTY>
            <PROPERTY name="previewHeight" type="INTEGER">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
                <PLATFORM>WM, CE</PLATFORM>
                <DESC>In cases where the resident camera application on the device is not used this API is used to control the position of the viewfinder preview window when taking a photo.</DESC>
            </PROPERTY>
            <PROPERTY name="useSystemViewfinder" type="BOOLEAN" default="false">
                <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
                <PLATFORM>Android</PLATFORM>
                <DESC>Setting the value of this property to "true", shall open the System ViewFinder with its properties. None of the Rho camera properties shall be applicable.</DESC>
            </PROPERTY>
			<PROPERTY name="aimMode" type="STRING">
                <PLATFORM>WM, CE</PLATFORM>
                <DESC>Specifies the aim behaviour when taking a picture. Applicable only for imager module.
				This Property shall accept/return one among the values mentioned in constant section which starts with AIM_...</DESC>
				<DESC_EB>Specifies the aim behaviour when taking a picture. Applicable only for imager module.
				This Property shall accept/return one among the values mentioned in constant section which starts with AIM_...</DESC_EB>

            </PROPERTY>
        </PROPERTIES>

        <METHODS>
            <ALIASES>
                <ALIAS new="save_image_to_device_gallery" existing="copyImageToDeviceGallery" deprecated="true"/>
            </ALIASES>

            <METHOD name="enumerate" access="STATIC" hasCallback="optional">
			    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                <DESC>Returns the cameras present on your device, allowing you to access your device's front or back camera.</DESC>
                <RETURN type="ARRAY">
                    <DESC>Array of objects.</DESC>
                    <PARAM name="cameraArray" type="SELF_INSTANCE"/>
                </RETURN>
            </METHOD>
            <METHOD name="getCameraByType" access="STATIC" hasCallback="optional">
			    <PLATFORM>Android, iOS, WP8, WM, CE</PLATFORM>
                <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                <DESC>Returns the camera of requested type if that camera exist - else return nil.</DESC>
                <PARAMS>
                    <PARAM name="cameraType" type="STRING">
                        <DESC>CameraType: 'back' or 'front' in the case of Android, iOS and WP8 and 'color' or 'imager' in the case of WM, CE devices</DESC>
                        <DESC_EB>CameraType: 'back' or 'front' in the case of Android and 'color' or 'imager' in the case of WM, CE devices</DESC_EB>
                    </PARAM>
                </PARAMS>
                <RETURN type="SELF_INSTANCE">
                    <DESC>Camera with requested type or nil if not requested type does not exist. Refer example section for more details.</DESC>
                </RETURN>
            </METHOD>
            <METHOD name="takePicture" hasCallback="mandatory" runInThread="ui">
			    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                <DESC>Start the camera application to take a picture. The user can capture the displayed image by interacting with the resident camera app. In Windows, this method always shows the preview in full screen and user can use the native button to capture the image.
				On wp8,wm when 'outputFormat' is 'image' then imageUri/image_uri shall have only Image name with \ sign, on WP8 ImageName shall be suffixed by DTF when 'outputFormat' is 'image'
> Note: To display an image, it is recommended that you use the full path to the image instead of a relative path. To do this, you can use the [`expandDatabaseBlobFilePath`](Application#mexpandDatabaseBlobFilePath) method of the [Application module](Application) as such:

##### Ruby
    :::ruby
    Rho::RhoApplication.expandDatabaseBlobFilePath(x.image_uri)

##### JavaScript
    :::js
    Rho.RhoApplication.expandDatabaseBlobFilePath(x.image_uri)
                </DESC>
                <PARAMS>
                    <PARAM name="propertyMap" type="HASH" propertyHash="true">
                        <DESC>Provide a set of properties to configure the camera, for example to specify the flashMode or compressionFormat.</DESC>
                        <CAN_BE_NIL>
                            <DESC>Not providing properties to this function will use the Camera's default properties, or those previously set on the Camera instance.</DESC>
                        </CAN_BE_NIL>
                    </PARAM>
                </PARAMS>
                <CALLBACK type="HASH">
                    <PARAMS>
                        <PARAM name="status" type="STRING">
						     <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                             <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>Whether or not the image was successfully captured. The returned string will be one of 'ok', 'cancel' or 'error'.</DESC>
                        </PARAM>
                        <PARAM name="imageUri" type="STRING">
						    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device.On wp8,wm when 'outputFormat' is 'image' then imageUri shall have only Image name with \ sign, on WP8 ImageName shall be suffixed by DTF when 'outputFormat' is 'image', this image will have an auto-generated name. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, In Wp8 dataUri shall provide the thumbnail for the picture taken, It is recommended to use Image over dataUri. If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http. </DESC>
							<DESC_EB>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http.</DESC_EB>
                        </PARAM>
                        <PARAM name="imageHeight" type="INTEGER">
						    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>The actual height of the image that was captured, this may differ from the requested height as the Camera will only support a finite resolutions.</DESC>
                        </PARAM>
                        <PARAM name="imageWidth" type="INTEGER">
						     <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                             <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>The actual width of the image that was captured, this may differ from the requested width as the Camera will only support a finite resolutions.</DESC>
                        </PARAM>
                        <PARAM name="imageFormat" type="STRING">
						    <PLATFORM>Android, WM, CE, iOS</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>The format in which the image was captured, either 'png' or 'jpg'.</DESC>
                        </PARAM>
                        <PARAM name="message" type="STRING">
						    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>If the returned status is 'error' then this field will contain more information on the error. To maintain backward compatibility WM and Android platforms provides message for cancel status as well.</DESC>
                        </PARAM>
                        <PARAM name="image_uri" type="STRING" deprecated="true">
						    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device.On wp8,wm when 'outputFormat' is 'image' then imageUri shall have only Image name with \ sign, on WP8 ImageName shall be suffixed by DTF when 'outputFormat' is 'image', this image will have an auto-generated name. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, In Wp8 dataUri shall provide the thumbnail for the picture taken, It is recommended to use Image over dataUri. If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http. </DESC>
							<DESC_EB>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http.</DESC_EB>
                        </PARAM>
                        <PARAM name="image_height" type="INTEGER" deprecated="true">
						    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>It is recommended to use imageHeight in preference to this parameter.</DESC>
                        </PARAM>
                        <PARAM name="image_width" type="INTEGER" deprecated="true">
						    <PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>It is recommended to use imageWidth in preference to this parameter.</DESC>
                        </PARAM>
                        <PARAM name="image_format" type="STRING" deprecated="true">
						    <PLATFORM>Android, WM, CE, iOS</PLATFORM>
                            <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>It is recommended to use imageFormat in preference to this parameter.</DESC>
                        </PARAM>
                    </PARAMS>
                </CALLBACK>
            </METHOD>
			<METHOD name="showPreview" runInThread="ui">
				<DESC>Shows the preview in user configurable viewer window.</DESC>
				<PLATFORM>WM, CE</PLATFORM>
				<PLATFORM_EB>WM, CE</PLATFORM_EB>
        <PARAMS>
				<PARAM name="propertyMap" type="HASH" propertyHash="true">
                        <DESC>Provide a set of properties to configure the camera.</DESC>
                        <CAN_BE_NIL>
                            <DESC>Not providing properties to this function will use the Camera's default properties, or those previously set on the Camera instance.</DESC>
                        </CAN_BE_NIL>
                    </PARAM>
         </PARAMS>
			</METHOD>
			<METHOD name="hidePreview">
				<DESC>Hides the preview opened by using showPreview.</DESC>
				<PLATFORM>WM, CE</PLATFORM>
				<PLATFORM_EB>WM, CE</PLATFORM_EB>
			</METHOD>
			<METHOD name="capture" hasCallback="mandatory">
				<DESC>Capture the image and save it to a file.</DESC>
				<PLATFORM>WM, CE</PLATFORM>
				<PLATFORM_EB>WM, CE</PLATFORM_EB>
				<CALLBACK type="HASH">
                    <PARAMS>
                        <PARAM name="status" type="STRING">
                            <DESC>Whether or not the image was successfully captured. The returned string will be one of 'ok' or 'error'.</DESC>
                        </PARAM>
                        <PARAM name="imageUri" type="STRING">
                            <DESC>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, In Wp8 dataUri shall provide the thumbnail for the picture taken, It is recommended to use Image over dataUri. If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http. </DESC>
							<DESC_EB>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http.</DESC_EB>
                        </PARAM>
                        <PARAM name="imageHeight" type="INTEGER">
                            <DESC>The actual height of the image that was captured, this may differ from the requested height as the Camera will only support a finite resolutions.</DESC>
                        </PARAM>
                        <PARAM name="imageWidth" type="INTEGER">
                            <DESC>The actual width of the image that was captured, this may differ from the requested width as the Camera will only support a finite resolutions.</DESC>
                        </PARAM>
                        <PARAM name="imageFormat" type="STRING">
                            <DESC>The format in which the image was captured, either 'png' or 'jpg'.</DESC>
                        </PARAM>
                        <PARAM name="message" type="STRING">
                            <DESC>If the returned status is 'error' then this field will contain more information on the error.</DESC>
                        </PARAM>
                    </PARAMS>
                </CALLBACK>
			</METHOD>
            <METHOD name="choosePicture" runInThread="module" hasCallback="mandatory" access="static">
                <DESC>Choose a picture from the album.</DESC>
                <PARAMS>
                    <PARAM name="propertyMap" type="HASH" propertyHash="true">
					     <PLATFORM>Android, WM, CE, WP8, iOS</PLATFORM>
                         <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                        <DESC>Provide a set of properties to configure an image, for example to specify the image size or color mode. In WM/CE,Android and WP8 devices user can only specify the outputFormat in the property bag. In iOS devices user can specify next options: compressionFormat, desiredWidth, desiredHeight, outputFormat, colorModel,  enableEditing.
							In Wp8 dataUri shall provide the thumbnail for the picture taken, It is recommended to use Image over dataUri.On wp8, wm when 'outputFormat' is 'image' then imageUri or image_uri shall have Image name with \ sign, on WP8 ImageName shall be suffixed by DTF when 'outputFormat' is 'image'</DESC>
                        <DESC_EB>Provide a set of properties to configure an image, for example to specify the image size or color mode. In WM/CE,Android devices user can only specify the outputFormat in the property bag.</DESC_EB>
                        <CAN_BE_NIL>
                            <DESC>Not providing properties to this function will use the Camera's default properties, or those previously set on the Camera instance.</DESC>
                        </CAN_BE_NIL>
                    </PARAM>
                </PARAMS>
                <CALLBACK type="HASH">
                    <PARAMS>
                        <PARAM name="status" type="STRING">
                            <DESC>Whether or not the image was successfully chosen from the gallery. The returned string will be one of 'ok', 'cancel' or 'error'.</DESC>
                        </PARAM>
                        <PARAM name="imageUri" type="STRING">
						<PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                        <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                            <DESC>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device.On wp8,wm when 'outputFormat' is 'image' then imageUri shall have only Image name with \ sign, on WP8 ImageName shall be suffixed by DTF when 'outputFormat' is 'image', this image will have an auto-generated name. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, In Wp8 dataUri shall provide the thumbnail for the picture taken, It is recommended to use Image over dataUri. If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http. </DESC>
							<DESC_EB>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http.</DESC_EB>
                        </PARAM>
                        <PARAM name="imageHeight" type="INTEGER">
                            <DESC>The height of the image.</DESC>
                        </PARAM>
                        <PARAM name="imageWidth" type="INTEGER">
                            <DESC>The width of the image.</DESC>
                        </PARAM>
                        <PARAM name="imageFormat" type="STRING">
                            <DESC>The format of the image, either 'png' or 'jpg'.</DESC>
                        </PARAM>
                        <PARAM name="message" type="STRING">
                            <DESC>If the returned status is 'error' then this field will contain more information on the error. To maintain backward compatibility WM and Android platforms provides message for cancel status as well.</DESC>
                        </PARAM>
                        <PARAM name="image_uri" type="STRING" deprecated="true">
						<PLATFORM>Android, WM, CE, iOS, WP8</PLATFORM>
                        <PLATFORM_EB>Android, WM, CE</PLATFORM_EB>
                           <DESC>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device.On wp8,wm when 'outputFormat' is 'image' then imageUri shall have only Image name with \ sign, on WP8 ImageName shall be suffixed by DTF when 'outputFormat' is 'image', this image will have an auto-generated name. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, In Wp8 dataUri shall provide the thumbnail for the picture taken, It is recommended to use Image over dataUri. If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http. </DESC>
						   <DESC_EB>If the specified 'outputFormat' was 'image' then this field is the URI to the taken image stored on the device. If the specified 'outputFormat' was 'dataUri' then this field will be the image encoded as a Data URI, If the specified 'outputFormat' was 'imagePath' then this field will have the image path on the device. User can use image path to transfer image over http.</DESC_EB>
                        </PARAM>
                        <PARAM name="image_height" type="INTEGER" deprecated="true">
                            <DESC>It is recommended to use imageHeight in preference to this parameter.</DESC>
                        </PARAM>
                        <PARAM name="image_width" type="INTEGER" deprecated="true">
                            <DESC>It is recommended to use imageWidth in preference to this parameter.</DESC>
                        </PARAM>
                        <PARAM name="image_format" type="STRING" deprecated="true">
                            <DESC>It is recommended to use imageFormat in preference to this parameter.</DESC>
                        </PARAM>
                    </PARAMS>
                </CALLBACK>
            </METHOD>
            <METHOD name="copyImageToDeviceGallery" access="static">
                <PLATFORM>iOS, Android</PLATFORM>
                <PLATFORM_EB>Android</PLATFORM_EB>
                <DESC>Save an image to the device gallery.</DESC>
                <PARAMS>
                    <PARAM name="pathToImage" type="STRING">
                        <DESC>The real path to the image that is to be saved in the device gallery. You need to use the RhoApplication method `expandDatabaseBlobFilePath` to have the real path, such as `Rho::RhoApplication::expandDatabaseBlobFilePath(img.image_uri)`.</DESC>
                    </PARAM>
                </PARAMS>
            </METHOD>
        </METHODS>

        <USER_OVERVIEW>
            <!--  More conversational style with INLINE SAMPLES, written in MarkDown -->
            <![CDATA[]]>
        </USER_OVERVIEW>
        <VER_INTRODUCED>4.0.0</VER_INTRODUCED>
        <PLATFORM>
            <!--  This section is used for the supported platform images at the top -->
        </PLATFORM>
        <EXAMPLES>
           <EXAMPLE title="Take picture with default camera">
            <SECTIONS>
              <SECTION>
               <DESC>Take an image with as little code as possible, using all default values.</DESC>
               <CODE>
                <RUBY>
           <![CDATA[
def take_picture_with_default_camera
  # Capture an image from the default camera on the device, using the default image settings
  Rho::Camera.takePicture({}, :picture_taken_callback)
end

def picture_taken_callback
  # Did we really take a picture?
  if (@params["status"]=="ok")
    # If so, show it
    Rho::WebView.navigate(url_for(:action => :show_picture, :query => {:image => Rho::Application.expandDatabaseBlobFilePath(@params["imageUri"])}))
  else
    # Otherwise we are done here
    Rho::WebView.navigate(url_for(:action => :index))
  end
end
                   ]]>
                 </RUBY>
                <JAVASCRIPT>
           <![CDATA[
function take_picture_with_default_camera() {
  // Capture an image from the default camera on the device, using the default image settings
  Rho.Camera.takePicture({}, picture_taken_callback);
}

function picture_taken_callback(params) {
  // Did we receive an image?
  if (params["status"]=="ok") {
    // Assuming we have an <img id="#captured_image"> tag, we will be able to see the image that was just captured
    $("#captured_image").attr("src", Rho.Application.expandDatabaseBlobFilePath(params["imageUri"]));
  }
}
                   ]]>
                 </JAVASCRIPT>
               </CODE>
               </SECTION>
               </SECTIONS>
           </EXAMPLE>
           <EXAMPLE title="Choose which camera to use when taking images">
            <SECTIONS>
              <SECTION>
               <DESC>On devices with more than one camera, you can select which camera to use for taking pictures.</DESC>
               <CODE>
                <RUBY>
           <![CDATA[
# controller.rb
def choose_camera
  $cameras = Rho::Camera.enumerate
  render
end

def take_picture_using_chosen_camera
  camera = $cameras[@params["cameraIndex"].to_i]
  camera.takePicture({}, url_for(:action => :picture_taken_callback))
end

# choose_camera.erb
<ul data-role="listview">
  <% $cameras.each_with_index do |camera, index| %>
    <li><a href="<%= url_for(:action => :take_picture_using_chosen_camera, :query => {:camera_index => index}) %>"><%= camera.cameraType %></li>
  <% end %>
</ul>
                   ]]>
                 </RUBY>
                <JAVASCRIPT>
           <![CDATA[
<div id="camera_list">
</div>

var cameras = [];

function choose_camera() {
  // get all available cameras
  cameras = Rho.Camera.enumerate();

  // build an HTML list
  var cameraList = "<ul>";

  for (var cameraIndex=0; cameraIndex<cameras.length; cameraIndex++) {
    var camera = cameras[cameraIndex];
    // Create a link for each camera with an onclick handler
    cameraList = cameraList +'<li><a href="#" class="take_picture_with_selected_camera" onclick="take_picture_with_camera('+cameraIndex+')">'+camera.cameraType+'</a></li>';
  }

  cameraList = cameraList+"</ul>";

  // make camera list visible to the user
  $("#camera_list").html(cameraList);
}

function take_picture_with_camera(cameraIndex) {
  var camera = cameras[cameraIndex];
  camera.takePicture({}, picture_taken_callback);
}
                   ]]>
                 </JAVASCRIPT>
               </CODE>
               </SECTION>
               </SECTIONS>
           </EXAMPLE>
           <EXAMPLE title="Saving a picture to the device's gallery">
            <SECTIONS>
              <SECTION>
               <DESC>Apart from taking new pictures, you can also save images to the built-in gallery. In the following examples, the picture we are adding to the gallery is one that was just taken with the camera, but you can add any other image you can access by filename.</DESC>
               <CODE>
                <RUBY>
           <![CDATA[
def take_picture_and_save_it_to_gallery
  Rho::Camera.choosePicture({}, url_for(:action => :picture_taken_callback_save_to_gallery))
end

def picture_taken_callback_save_to_gallery
  # Did we really take a picture?
  if (@params["status"]=="ok")
    # If so, save it to the gallery
    Rho::Camera.copyImageToDeviceGallery(Rho::Application.expandDatabaseBlobFilePath(@params["imageUri"]))
  end

  Rho::WebView.navigate(url_for(:action => :index))

end
                   ]]>
                 </RUBY>
                <JAVASCRIPT>
           <![CDATA[
function take_picture_and_save_it_to_gallery() {
  Rho.Camera.choosePicture({}, picture_taken_callback_save_to_gallery);
}

function picture_taken_callback_save_to_gallery(params) {
  if (params["status"]=="ok") {
    Rho.Camera.copyImageToDeviceGallery(Rho.Application.expandDatabaseBlobFilePath(params["imageUri"]));

    alert("Image saved to gallery");
  }
}
                   ]]>
                 </JAVASCRIPT>
               </CODE>
               </SECTION>
               </SECTIONS>
           </EXAMPLE>
           <EXAMPLE title="Control image properties">
            <SECTIONS>
              <SECTION>
               <DESC>You can tweak multiple options to get an image exactly as you need it </DESC>
               <CODE>
                <RUBY>
           <![CDATA[
def control_image_properties
  # Instead of accepting the defaults, let's set some properties to our liking

  # We will ask for a PNG file...
  Rho::Camera.compressionFormat = "png"

  # ...a particular image size...
  Rho::Camera.desiredWidth = 1024
  Rho::Camera.desiredHeight = 768

  # ...and force the flash to be used
  Rho::Camera.flashMode = "on"

  # Now, take the picture
  Rho::Camera.takePicture({}, :picture_taken_callback)
end

def picture_taken_callback
  # Did we really take a picture?
  if (@params["status"]=="ok")
    # If so, show it
    Rho::WebView.navigate(url_for(:action => :show_picture, :query => {:image => Rho::Application.expandDatabaseBlobFilePath(@params["imageUri"])}))
  else
    # Otherwise we are done here
    Rho::WebView.navigate(url_for(:action => :index))
  end
end
                   ]]>
                 </RUBY>
                <JAVASCRIPT>
           <![CDATA[
function control_image_properties() {
  // Instead of accepting the defaults, let's set some properties to our liking

  // We will ask for a PNG file...
  Rho.Camera.compressionFormat = "png";

  // ...a particular image size...
  Rho.Camera.desiredWidth = 1024;
  Rho.Camera.desiredHeight = 768;

  // ...and force the flash to be used
  Rho.Camera.flashMode = "on";

  // Now, take the picture
  Rho.Camera.takePicture({}, picture_taken_callback);
}

function picture_taken_callback(params) {
  // Did we receive an image?
  if (params["status"]=="ok") {
    // show it in our <img id="captured_image"> tag
    $("#captured_image").attr("src", Rho.Application.expandDatabaseBlobFilePath(params["imageUri"]));
  }

}
                   ]]>
                 </JAVASCRIPT>
               </CODE>
               </SECTION>
               </SECTIONS>
           </EXAMPLE>
           <EXAMPLE title="Determine camera capabilities">
            <SECTIONS>
              <SECTION>
               <DESC>You can get all available camera properties in a single call.</DESC>
               <CODE>
                <RUBY>
           <![CDATA[
# controller.rb

def determine_camera_capabilities
  # Get all camera properties
  @properties = Rho::Camera.getAllProperties
  render
end

# determine_camera_capabilities.erb
    <ul data-role="listview">

    <% @properties.each_pair do |name,value| %>
      <li><%= name %> : <%= value %></li>
    <% end %>

    </ul>
                   ]]>
                 </RUBY>
                <JAVASCRIPT>
           <![CDATA[
function determine_camera_capabilities() {
  var capabilitiesList = "<ul>";

  // Get all capabilities of the camera...
  var capabilities = Rho.Camera.getAllProperties();

  // ... compose a nicely formatted list with their names and values ...
  for (var capability in capabilities) {
    capabilitiesList+="<li>"+capability+": "+capabilities[capability]+"</li>";
  }

  capabilitiesList += "</ul>";

  // ... and show it
  $("#camera_capabilities").html(capabilitiesList);
}
                   ]]>
                 </JAVASCRIPT>
               </CODE>
               </SECTION>
               </SECTIONS>
           </EXAMPLE>
           <EXAMPLE title="Select picture from device gallery">
            <SECTIONS>
              <SECTION>
               <DESC>Apart from taking new pictures, the Camera API also lets you access existing images on the device's gallery.</DESC>
               <CODE>
                <RUBY>
           <![CDATA[
def select_picture_from_gallery
  Rho::Camera.choosePicture({}, url_for(:action => :picture_taken_callback))
end

def picture_taken_callback
  # Did we really take a picture?
  if (@params["status"]=="ok")
    # If so, show it
    Rho::WebView.navigate(url_for(:action => :show_picture, :query => {:image => Rho::Application.expandDatabaseBlobFilePath(@params["imageUri"])}))
  else
    # Otherwise we are done here
    Rho::WebView.navigate(url_for(:action => :index))
  end
end
                   ]]>
                 </RUBY>
                <JAVASCRIPT>
           <![CDATA[
function select_picture_from_gallery() {
  Rho.Camera.choose_picture({}, picture_taken_callback);
}

function picture_taken_callback(params) {
  // Did we receive an image?
  if (params["status"]=="ok") {
    // Show it in an <img> tag
    $("#captured_image").attr("src", Rho.Application.expandDatabaseBlobFilePath(params["imageUri"]));
  }
}
                   ]]>
                 </JAVASCRIPT>
               </CODE>
               </SECTION>
               </SECTIONS>
           </EXAMPLE>
          <EXAMPLE title="Getting a camera instance by cameraType">
            <SECTIONS>
              <SECTION>
                <DESC>Camera API also lets you access camera instance by cameraType.</DESC>
                <CODE>
                  <JAVASCRIPT>
                    <![CDATA[
//get the instance by cameraType and takePicture using that instance
function get_color_camera_instance() {
  var camInst = Rho.Camera.getCameraByType('color');
  camInst.takePicture({'outputFormat':'image'}, my_callback);
}

                   ]]>
                  </JAVASCRIPT>
                </CODE>
              </SECTION>
            </SECTIONS>
          </EXAMPLE>
          <EXAMPLE title="Getting the list of resolutions supported by the camera">
            <SECTIONS>
              <SECTION>
                <DESC>Camera resolution is hardware specific. Camera API supports getting the supported resolutions of a camera instance.</DESC>
                <CODE>
                  <JAVASCRIPT>
                    <![CDATA[
function getsupporteSizeList()
{
var instArray = Rho.Camera.enumerate();
var reslnArray = instArray[0].supportedSizeList;
alert(reslnArray[0].width);
alert(reslnArray[0].height);
alert(reslnArray[1].width);
alert(reslnArray[1].height);
}
                   ]]>
                  </JAVASCRIPT>
                </CODE>
              </SECTION>
            </SECTIONS>
          </EXAMPLE>
          <EXAMPLE title="Transfering an image to HTTP server">
            <SECTIONS>
              <SECTION>
                <DESC>This example demonstrate how user can transfer an image to http server. This will be useful when application is running on a remote server.</DESC>
                <CODE>
                  <JAVASCRIPT>
                    <![CDATA[
//enumerate the available cameras on the device
var camArray = EB.Camera.enumerate();

//below is the callback fired by network api after image upload to the server is completed
var upload_file_callback = function (args){
        status = args['status'];
		//a status ok indicates image transferred successfully
        alert(status);
       }

//below is the camera call back fired after takePicture is called
var camera_callbackFunc = function(cbData){
  alert(cbData.imageUri);
  //set the upload file properties; Refer network module for more details
  var uploadfileProps = {
           url: 'http://10.233.82.51:8081/upload_image_file',
          //authType: "basic",
          //authUser: "admin",
          //authPassword: "password",
          filename: cbData.imageUri,
          body: "uploading file",
          fileContentType: "image/jpeg"
        };

   //below is the network module API used for uploading images when camera fire the callback
   EB.Network.uploadFile(uploadfileProps, upload_file_callback);
 };

 //below is the test function which is used for capturing an image with outputFormat set as imagePath
function Test_image_transfer1()
{
  //invoke takePicture API with outputFormat as imagePath and set the callback method
  camArray[0].takePicture({'fileName' : '/Application/Test/myImagename', 'outputFormat': 'imagePath'}, camera_callbackFunc);
}
 //below is the test function which is used for choosing a picture from device with outputFormat set as imagePath
function Test_image_transfer2()
{
  //invoke choosePicture API with outputFormat as imagePath and set the callback method
  EB.Camera.choosePicture({'outputFormat': 'image'}, camera_callbackFunc);
}

                   ]]>
                  </JAVASCRIPT>
                </CODE>
              </SECTION>
            </SECTIONS>
          </EXAMPLE>
		            <EXAMPLE title="Dispalying an image using image uri.">
            <SECTIONS>
              <SECTION>
                <DESC>This example demonstrate how user can dispaly an image using image uri. The callback will return a image uri when outputFormat is set to 'image'</DESC>
                <CODE>
                  <JAVASCRIPT>
                    <![CDATA[
//enumerate the available cameras on the device
var camArray = EB.Camera.enumerate();

//below is the camera call back fired after takePicture is called
var camera_callbackFunc = function(cbData){

  //uri will have relative path info only
  //user has to form the absolute local server path as shown below
  uri = 'http://localhost:'+EB.System.localServerPort + cbData.imageUri;
  //set the image uri to the image element
  document.getElementById('imageUri').src = uri ;

 };

 //below is the test function which is used for capturing an image with outputFormat set as image
function Test_image_uri()
{
  //invoke takePicture API with outputFormat as image and set the callback method
  camArray[0].takePicture({'outputFormat': 'image'}, camera_callbackFunc);
}

                   ]]>
                  </JAVASCRIPT>
                </CODE>
              </SECTION>
            </SECTIONS>
          </EXAMPLE>
		</EXAMPLES>
        <REMARKS>
            <REMARK title="SD Card Access">
                <DESC>SD Card access is enabled by default; grants of additional access will be ignored. The following extensions are able to write to the SD card by default.</DESC>
            </REMARK>
			<REMARK title="Camera Preview">
                <DESC>Despite a user-selected full screen mode, preview rendering size will be overridden by the driver on some WM/CE devices.</DESC>
            </REMARK>
			<REMARK title="DataUri">
                <DESC>DataUri output is dependent on availability of virtual space. DataUri may fail, be unresponsive, cause reboot, degraded performance or fail to load in certain devices. In such cases, image path is recommended.</DESC>
            </REMARK>
			<REMARK title="ImageUri">
                <DESC>Image Uri display is dependent on browser capability.</DESC>
            </REMARK>
			<REMARK title="GetSupportedProperties in WP8">
                <DESC>WP8 does not support getSupportedProperties or SetSupportedProperties.</DESC>
            </REMARK>
		    <REMARK title="colorModel as Grayscale in Android">
                <DESC>Grayscale is supported only in the front camera of Android consumer devices.</DESC>
            </REMARK>
            <REMARK title="Invalid/Null values for properties in Android and iOS">
                <DESC>Only valid and non-empty values for properties are supported in Android and iOS.</DESC>
            </REMARK>
			<REMARK title="Ruby Support">
            <DESC>Due to platform limitations, imager and color camera are not supported in ruby applications for CE5 and CE6 devices.</DESC>
            </REMARK>
            <REMARK title="Camera in Suspend mode">
              <DESC>All WM and CE7 devices automatically turn off both color and imager cameras when the device is suspended. User must restart the camera to resume. Whereas CE5 (eg: MC9000) and CE6 (eg: MC31) devices retain the preview on resuming from suspend state.</DESC>
            </REMARK>
            <REMARK title="Image saving after taking picture">
              <DESC>In some devices (eg: Samsung), an image will be saved in landscape mode even if captured in portrait mode. This behavior is determined by the device's default settings.</DESC>
            </REMARK>
			<REMARK title="WM/CE devices lacking support">
            <DESC>Due to platform limitations, the ES400, MC65 and MC67 do not support the color camera.</DESC>
            </REMARK>
            <REMARK title="takePicture resolution issue on low-memory devices with WM">
            <DESC>Due to platform limitations, the ES400, MC65 and MC67 do not support a color camera. The imager on the MC55 with WM does not support the Fullscreen window (eg: takePicture). Parameters such as previewLeft, previewWidth, previewTop and previewHeight are supported by the device to set up a user-defined viewer window.</DESC>
            </REMARK>
            <REMARK title="takePicture resolution issue on low-memory devices with WM">
            <DESC>Processor limitations of some devices may cause a low-resolution image captures to appear as a small preview with a black background when transitioning back to the application.</DESC>
            </REMARK>
            <REMARK title="Android KitKat gallery displays black image">
            <DESC>For images captured with the camera using a Rho app, the image might initially appear black. Refresh the view to correct the problem.</DESC>
            </REMARK>
            <REMARK title="Android preview">
            <DESC>High-resolution settings are not recommended for low-memory devices. Image previews on tablet devices might appear stretched or shrunken.</DESC>
            </REMARK>

        </REMARKS>
    </MODULE>
</API>


text:
@import CoreGraphics;

@interface Movie : MTLModel

@property (nonatomic, copy) NSString *movieId;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *movieDescription;
@property (nonatomic, assign) CGFloat rating;

@end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ValueExpressionHelper</title>
<meta name="date" content="2014-07-09">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

at.irian.ankor.ref.el

Class ValueExpressionHelper

java.lang.Object

at.irian.ankor.ref.el.ValueExpressionHelper

public class ValueExpressionHelper
extends java.lang.Object

Constructor Summary

Constructors

Constructor and Description

ValueExpressionHelper()

Method Summary

Methods

Modifier and Type
Method and Description

static javax.el.ValueExpression
createValueExpression(ELRefContext elRefContext,
                     java.lang.String path)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ValueExpressionHelper

public ValueExpressionHelper()

Method Detail

createValueExpression

public static javax.el.ValueExpression createValueExpression(ELRefContext elRefContext,
                                             java.lang.String path)

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
using System;
using Laan.Risk.Terrain.Generator;
using System.Drawing;

namespace LandscapeGenCore
{
	public class LaanInterfaceRegister
	{
		public static IGenerator[] RegisterGenerator() {

			int seed = new Random().Next();
			int size = 129;

			return new IGenerator[] {
						new PerlinGenerator(seed, size),
						new KochSurfaceGenerator(seed, size)
			};
		}
	}

	public class PerlinGenerator : IGenerator {
		private INoiseSettings _settings;

		public PerlinGenerator(int seed, int size) {
			PerlinNoiseSettings objSettings = new PerlinNoiseSettings();

			objSettings.RandomSeed = seed;
			objSettings.ResultX = size;
			objSettings.ResultY = size;

			_settings = (INoiseSettings)objSettings;
		}

		#region IGenerator Members
		public System.Drawing.Bitmap Execute() {
			float[,] result;
			Bitmap img;

			// Create
			INoiseGenerator objGen = new PerlinNoise();
			objGen.Settings = _settings;

			result = objGen.Generate();

			objGen.Free();
			objGen = null;

			//Normalise and convert to ushort
			IPostProcessor objPostProc = new Normalize();

			result = objPostProc.Process(result);

			objPostProc.Free();
			objPostProc = null;

			// Render
			Render2D objRender = new Render2D();

			img = objRender.RenderGreyscale(result);

			objRender.Free();
			objRender = null;

			return img;
		}

		public string DisplayName() {
			return "Bevan - Perlin";
		}

		public object Properties() {
			return _settings;
		}
		#endregion

	}

	public class KochSurfaceGenerator : IGenerator {
		private INoiseSettings _settings;

		public KochSurfaceGenerator(int seed, int size) {
			KochLikeNoiseSettings objSettings = new KochLikeNoiseSettings();

			objSettings.RandomSeed = seed;
			objSettings.ResultX = size;
			objSettings.ResultY = size;

			_settings = (INoiseSettings)objSettings;
		}

		#region IGenerator Members
		public System.Drawing.Bitmap Execute() {
			float[,] result;
			Bitmap img;

			// Create
			INoiseGenerator objGen = new KochLikeNoise();
			objGen.Settings = _settings;

			result = objGen.Generate();

			objGen.Free();
			objGen = null;

			//Normalise and convert to ushort
			IPostProcessor objPostProc = new Normalize();

			result = objPostProc.Process(result);

			objPostProc.Free();
			objPostProc = null;

			// Render
			Render2D objRender = new Render2D();

			img = objRender.RenderGreyscale(result);

			objRender.Free();
			objRender = null;

			return img;
		}

		public string DisplayName() {
			return "Bevan - Koch Surface";
		}

		public object Properties() {
			return _settings;
		}
		#endregion

	}
}


text:
using OpenSage.Mathematics;

namespace OpenSage.Gui
{
    public sealed class SelectionGui
    {
        public Rectangle SelectionRectangle { get; set; }
        public bool SelectionBoxVisible { get; set; }

        public void Draw(DrawingContext2D context)
        {
            if (SelectionBoxVisible)
            {
                context.FillRectangle(SelectionRectangle, new ColorRgbaF(1, 1, 1, 0.1f));
                context.DrawRectangle(SelectionRectangle.ToRectangleF(), ColorRgbaF.Black, 2);
            }
        }
    }
}


text:
<!DOCTYPE html>

    <title>grunt</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="http://fonts.googleapis.com/css?family=Lato%3A400%2C700%2C400italic%7CSorts+Mill+Goudy%3A400italic%2C400&ver=3.7-alpha-25343" rel="stylesheet" type="text/css">
    <link href="big.css" rel="stylesheet" type="text/css">

Task Running like a boss

Tasks are ____

Tasks are Saves

Tasks are Builds

Tasks are Commits

Tasks are Repatative

Configure Our Tasks

Gruntfile.js Configures Tasks

Grunt runs tasks

Autoprefixer

JSHint

CssMin

Uglify

Those are basic

Grunt Notify

time-grunt

grunt-concurrent

grunt-newer

Something Different

Share Hooks

Dynamic Task Creation

filter files

Grunt Patch WordPress

Script Everything

WordPress Plugin Support


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace VkApi.Wrapper.Objects
{
    public class BaseLinkApplicationStore
    {
        ///
        /// Store Id
        ///
        [JsonProperty("id")]
        public double Id { get; set; }

        ///
        /// Store name
        ///
        [JsonProperty("name")]
        public String Name { get; set; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Interface sg.edu.cs2103aug2015_w13_2j.storage.StorageInterface</title>
<meta name="date" content="2015-11-09">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
sg.edu.cs2103aug2015_w13_2j.storage.StorageInterface

Packages that use StorageInterface

Package
Description

sg.edu.cs2103aug2015_w13_2j

sg.edu.cs2103aug2015_w13_2j.storage

Uses of StorageInterface in sg.edu.cs2103aug2015_w13_2j

Methods in sg.edu.cs2103aug2015_w13_2j with parameters of type StorageInterface

Modifier and Type
Method and Description

void
LogicInterface.injectDependencies(StorageInterface storage,
                  UIInterface textUI)

Injects the dependency on StorageInterface and
 UIInterface components into this LogicInterface
 component.

void
Logic.injectDependencies(StorageInterface storage,
                  UIInterface textUI)

Uses of StorageInterface in sg.edu.cs2103aug2015_w13_2j.storage

Classes in sg.edu.cs2103aug2015_w13_2j.storage that implement StorageInterface

Modifier and Type
Class and Description

class
Storage

Storage component which provides methods to store and retrieve a list of Task
 objects to and from disk.

class
StorageStub

StorageInterface component for testing purposes.

class
StorageTest

StorageInterface component that contains test cases for the
 Storage class.

Methods in sg.edu.cs2103aug2015_w13_2j.storage that return StorageInterface

Modifier and Type
Method and Description

static StorageInterface
StorageStub.getInstance()

Retrieves the single instance of this StorageInterface component.

static StorageInterface
Storage.getInstance()

Retrieves the singleton instance of the Storage component

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
@interface URXRawQueryTests : XCTestCase

@end

@implementation URXRawQueryTests

-(void)testRawQuery {
    NSString *keywords = @"chicago bulls";
    URXRawQuery *rawQuery = [[URXRawQuery alloc] initWithQueryString:keywords];
    XCTAssertTrue([keywords isEqualToString:[rawQuery queryString]], @"The rawQuery does not equal the string provided to it");
}

-(void)testNilRawQuery {
    URXRawQuery *rawQuery = [[URXRawQuery alloc] initWithQueryString:nil];
    XCTAssertTrue([@"" isEqualToString:[rawQuery queryString]], @"Nil raw query string should produce an empty string");
}

@end


text:
ElggSecurityTest = TestCase("ElggSecurityTest");

ElggSecurityTest.prototype.setUp = function() {
	//fill with fake, but reasonable, values for testing
	this.ts = elgg.security.token.__elgg_ts = 12345;
	this.token = elgg.security.token.__elgg_token = 'abcdef';
};

ElggSecurityTest.prototype.testAddTokenAcceptsUndefined = function() {
	var input,
		expected = {
			__elgg_ts: this.ts,
			__elgg_token: this.token
		};

	assertEquals(expected, elgg.security.addToken(input));
};

ElggSecurityTest.prototype.testAddTokenAcceptsObject = function() {
	var input = {},
		expected = {
			__elgg_ts: this.ts,
			__elgg_token: this.token
		};

	assertEquals(expected, elgg.security.addToken(input));
};

ElggSecurityTest.prototype.testAddTokenAcceptsRelativeUrl = function() {
	var input,
		str = "__elgg_ts=" + this.ts + "&__elgg_token=" + this.token;

	input = "test";
	assertEquals(input + '?' + str, elgg.security.addToken(input));
};

ElggSecurityTest.prototype.testAddTokenAcceptsFullUrl = function() {
	var input,
		str = "__elgg_ts=" + this.ts + "&__elgg_token=" + this.token;

	input = "http://elgg.org/";
	assertEquals(input + '?' + str, elgg.security.addToken(input));
};

ElggSecurityTest.prototype.testAddTokenAcceptsQueryString = function() {
	var input,
		str = "__elgg_ts=" + this.ts + "&__elgg_token=" + this.token;

	input = "?data=sofar";
	assertEquals(input + '&' + str, elgg.security.addToken(input));

	input = "test?data=sofar";
	assertEquals(input + '&' + str, elgg.security.addToken(input));

	input = "http://elgg.org/?data=sofar";
	assertEquals(input + '&' + str, elgg.security.addToken(input));
};

ElggSecurityTest.prototype.testAddTokenAlreadyAdded = function() {
	var input,
		str = "__elgg_ts=" + this.ts + "&__elgg_token=" + this.token;

	input = "http://elgg.org/?" + str + "&data=sofar";
	assertEquals(input, elgg.security.addToken(input));
};

ElggSecurityTest.prototype.testSetTokenSetsElggSecurityToken = function() {
	var json = {
		__elgg_ts: 4567,
		__elgg_token: 'abcdef'
	};

	elgg.security.setToken(json);
	assertEquals(json, elgg.security.token);
};


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
G-Index
</TITLE>

<META NAME="date" CONTENT="2013-09-29">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C G I L P S

G

getExistingSession(VaadinRequest, boolean) -
Method in class com.vaadin.server.PersistenceStorageService

The getExsistingSession that uses the sessionStorage to fetch VaadinSession objects
 based on the JSESSIONID from a storage media at BROWSER_DETAILS request for a client.

getLockAttributeName() -
Method in class com.vaadin.server.PersistenceStorageService

Returns the name used to store the lock in the HTTP session.

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C G I L P S


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>cn.lhfei</groupId>
	<artifactId>airqa</artifactId>
	<name>air-qa</name>
	<packaging>war</packaging>
	<version>1.0.0-BUILD-SNAPSHOT</version>
	<properties>
		<java-version>1.6</java-version>
		<org.springframework-version>4.0.3.RELEASE</org.springframework-version>
		<org.aspectj-version>1.7.4</org.aspectj-version>
		<org.slf4j-version>1.7.6</org.slf4j-version>
		<jackson.version>1.9.12</jackson.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	</properties>
	<dependencies>
		<!-- Spring -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${org.springframework-version}</version>
			<exclusions>
				<!-- Exclude Commons Logging in favor of SLF4j -->
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-expression</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<!-- AspectJ -->
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>${org.aspectj-version}</version>
		</dependency>

		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>${org.aspectj-version}</version>
		</dependency>

		<!-- Logging -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${org.slf4j-version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.15</version>
			<exclusions>
				<exclusion>
					<groupId>javax.mail</groupId>
					<artifactId>mail</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.jms</groupId>
					<artifactId>jms</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jdmk</groupId>
					<artifactId>jmxtools</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jmx</groupId>
					<artifactId>jmxri</artifactId>
				</exclusion>
			</exclusions>
			<scope>runtime</scope>
		</dependency>

		<!-- @Inject -->
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
		</dependency>

		<!-- Servlet -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>

		<!-- shiro -->
		<dependency>
			<groupId>org.apache.shiro</groupId>
			<artifactId>shiro-web</artifactId>
			<version>1.2.3</version>
		</dependency>
		<dependency>
			<groupId>org.apache.shiro</groupId>
			<artifactId>shiro-spring</artifactId>
			<version>1.2.3</version>
		</dependency>
		<dependency>
			<groupId>org.apache.shiro</groupId>
			<artifactId>shiro-cas</artifactId>
			<version>1.2.3</version>
		</dependency>

		<!-- Test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>4.3.1.Final</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
			<version>4.3.0.Final</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.3.1.Final</version>
		</dependency>
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.4</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.6</version>
		</dependency>
		<!-- Jackson Mapper -->
		<!-- <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId>
			<version>${jackson.version}</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-mapper-lgpl</artifactId> <version>${jackson.version}</version>
			</dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-jaxrs</artifactId>
			<version>${jackson.version}</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-xc</artifactId> <version>${jackson.version}</version>
			</dependency> -->

		<!-- Jackson JOSN processor -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.3.2</version>
		</dependency>

		<!-- JDBC driver -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.25</version>
		</dependency>
		<dependency>
			<groupId>javax.transaction</groupId>
			<artifactId>jta</artifactId>
			<version>1.1</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.9</version>
				<configuration>
					<additionalProjectnatures>
						<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
					</additionalProjectnatures>
					<additionalBuildcommands>
						<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
					</additionalBuildcommands>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>true</downloadJavadocs>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.5.1</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
					<compilerArgument>-Xlint:all</compilerArgument>
					<showWarnings>true</showWarnings>
					<showDeprecation>true</showDeprecation>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.2.1</version>
				<configuration>
					<mainClass>org.test.int1.Main</mainClass>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<server>liuwuTomcat</server>
					<url>http://localhost:8080/manager/text</url>
					<uriEncoding>UTF-8</uriEncoding>
					<contextReloadable>true</contextReloadable>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


text:
let err = new Error("foo", { cause: new Error("bar") });
err.cause;

new EvalError("foo", { cause: new Error("bar") });
new RangeError("foo", { cause: new Error("bar") });
new ReferenceError("foo", { cause: new Error("bar") });
new SyntaxError("foo", { cause: new Error("bar") });
new TypeError("foo", { cause: new Error("bar") });
new URIError("foo", { cause: new Error("bar") });
new AggregateError([], "foo", { cause: new Error("bar") });


text:
// Fill out your copyright notice in the Description page of Project Settings.

#include "RoguelikeSurvival.h"
#include "ZombieCharacter.h"
#include "ZombieController.h"
#include "PlayerDamageType.h"
#include "RoguelikeChar.h"
#include "ZombieAnimInstance.h"
//#include "DrawDebugHelpers.h"
#include "RoguelikeGameInstance.h"

// Sets default values
AZombieCharacter::AZombieCharacter()
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	//Initializing stats and components.

	AudioComponent = CreateDefaultSubobject<UAudioComponent>(FName("Audio"));
	AudioComponent->AttachTo(GetRootComponent());

	ParticleSystemComponent = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("ParticleComp"));
	ParticleSystemComponent->bAutoActivate = false;

	ParticleSystemComponent->AttachTo(GetRootComponent());

	//Combat stats
	MinHealth = 100.f;
	MaxHealth = 300.f;

	MinSpeed = 150.f;
	MaxSpeed = 250.f;

	MinDamage = 5.f;
	MaxDamage = 15.f;

	DotTickInSeconds = 1.f;
	SlowPercentage = 0.5f;
	SlowEffectDuration = 3.f;
	Damage = 15.f;

	MeleeDistanceThreshold = 150.f;
}

// Called when the game starts or when spawned
void AZombieCharacter::BeginPlay()
{
	Super::BeginPlay();

	//ParticleSystemComponent->SetWorldLocation(GetActorLocation());
	ParticleSystemComponent->SetRelativeLocation(FVector(90, 0, 40));
	AudioComponent->SetRelativeLocation(FVector(90, 0, 40));

	//Stats initialization
	StatsInit(MinHealth, MaxHealth, MinDamage, MaxDamage);
	CurrentSpeed = FMath::RandRange(MinSpeed, MaxSpeed);

	bHasDot = false;
	bHasSlow = false;

	InitialMaxWalkSpeed = CurrentSpeed;
	GetCharacterMovement()->MaxWalkSpeed = CurrentSpeed;

	//Animations initialization
	ZAnimInstance = Cast<UZombieAnimInstance>(GetMesh()->GetAnimInstance());
	ZAnimInstance->Speed = CurrentSpeed;

	//Setting up the player reference for future use
	OurCharacter = Cast<AZombieController>(GetController())->GetTarget();

	if(AlphaReductionCurveFloat && DeathMaterialInstance)
	{
		//Binds the functions for the progress and the finished function on the timeline
		FOnTimelineFloat TimelineFunctionProgress;

		TimelineFunctionProgress.BindUFunction(this, FName("HandleTimelineProgress"));

		FOnTimelineEvent CompletedTimelineEvent;
		CompletedTimelineEvent.BindUFunction(this, FName("Destroy"));

		//Binding...
		AlphaReductionTimeline.AddInterpFloat(AlphaReductionCurveFloat, TimelineFunctionProgress);
		AlphaReductionTimeline.SetTimelineFinishedFunc(CompletedTimelineEvent);
	}
}

// Called every frame
void AZombieCharacter::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	GetCharacterMovement()->MaxWalkSpeed = InitialMaxWalkSpeed;
	ZAnimInstance->Speed = InitialMaxWalkSpeed;

	//If the zombie is within the melee range cancel any movement animation so it's more realistic
	float Distance = FVector::Dist(GetActorLocation(),OurCharacter->GetActorLocation());
	if (Distance<= MeleeDistanceThreshold)
	{
		ZAnimInstance->Speed = 0;
	}

	//Enable the attack raycast sphere in zombies hand if the animation is valid
	if (ZAnimInstance->bEligibleForAttack)
	{
		Attack();
		if (GetCharacterMovement())
		{
			GetCharacterMovement()->MaxWalkSpeed = InitialMaxWalkSpeed;
		}
	}

	//Updates the alpha value if the zombie is dead to achieve over-time fade out
	if(!IsAlive())
	{
		//Ticks the alpha reduction timeline
		AlphaReductionTimeline.TickTimeline(DeltaTime);
	}

}

float AZombieCharacter::TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
	//Determines the damage amount and type in order to apply it to the zombie
	const float ActualDamage = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);

	OurCharacter = Cast<ARoguelikeChar>(DamageCauser);

	HandleDamage(DamageAmount, DamageEvent);

	return ActualDamage;
}

void AZombieCharacter::HandleDamage(float DamageAmount, FDamageEvent DamageEvent)
{
	//Handles the given damage amount and effect
	//Makes sures to apply the right debuff (if any - based on the bullet type the player used) and damage to the zombie
	//Takes into consideration the active debuff in order to deactivate it if necessary (ie dot cancels slow effect and vice versa)

	if(IsAlive())
	{

		//Determing the damage type based on the bullet that the player used
		//ie frost damage if frost ammo is equipped
		UPlayerDamageType* DamageType = Cast<UPlayerDamageType>(DamageEvent.DamageTypeClass.GetDefaultObject());
		switch (DamageType->PlayerDamageType)
		{
			case EPlayerDamageType::Dot:
			{
				DisableSlowEffect();
				ApplyDotEffect(DamageAmount);
				break;
			}
			case EPlayerDamageType::Slow:
			{
				DisableDotEffectIfNecessary(true);
				ApplyDamage(DamageAmount);
				ApplySlowEffect();
				break;
			}
			default:
			{
				ApplyDamage(DamageAmount);
				break;
			}
		}

		if (!IsAlive())
		{
			//Stop logic of the AI
			Die();

		}
	}
}

void AZombieCharacter::ApplyDamage(float DamageAmount)
{
	//Applies damage to the zombie

	//Updating the animation of the zombie
	ZAnimInstance->GetHurt();
	if (bHasDot)
	{
		DisableDotEffectIfNecessary();
	}
	CurrentHealth -= DamageAmount;
	if (!IsAlive())
	{
		Die();
	}
	GLog->Log("Zombie has took damage, current hp:" + FString::SanitizeFloat(CurrentHealth));
}

void AZombieCharacter::DisableDotEffectIfNecessary(bool ForceStop)
{
	//Disables the dot effect is necessary (ie dot timer has been depleted)
	//If ForceStop is active it forces the dot effect to stop even if the dot timer is still active
	UWorld* World = GetWorld();
	//Forced stop of dot effect
	if (ForceStop && World && OurCharacter && World->GetTimerManager().IsTimerActive(DotTimerHandle))
	{
		GLog->Log("Stopping Dot Effect...");
		World->GetTimerManager().ClearTimer(DotTimerHandle);

		ParticleSystemComponent->Deactivate();
		//ZombieDebuffComp->SetFireParticleEnabled(false);

		bHasDot = false;

	}
	else
	{	//Disable effect due to time out
		if (World && OurCharacter &&
			World->GetTimerManager().IsTimerActive(DotTimerHandle) &&
			World->GetTimeSeconds() - DotApplicationTime>=OurCharacter->DotDuration)
		{
			World->GetTimerManager().ClearTimer(DotTimerHandle);

			ParticleSystemComponent->Deactivate();
			//ZombieDebuffComp->SetFireParticleEnabled(false);

			bHasDot = false;
		}
	}

	//ParticleSystemComponent->Deactivate();

}

void AZombieCharacter::ApplyDotEffect(float DamageAmount)
{
	//Applies the damage over time effect on zombie and sets up the corresponding particle template
	//Moreover, initializes the dot timer handle so certain damage is applied over-time.
	if (!bHasDot)
	{
		AZombieController* ZCon = Cast<AZombieController>(GetController());
		if (ZCon)
		{

			//Calculating the tick damage that we're going to apply in the zombie
			//based on the given damage amount.
			float DotTimer = OurCharacter->DotDuration;

			float TickDamage = DamageAmount / DotTimer;

			//The delegate that is binded to the apply damage function
			FTimerDelegate Delegate;
			Delegate.BindUFunction<AZombieCharacter, float>(this, FName("ApplyDamage"), TickDamage);

			//Enabling the dot effect..
			UWorld* World = GetWorld();
			if (World && OurCharacter)
			{
				World->GetTimerManager().SetTimer(DotTimerHandle, Delegate, DotTickInSeconds, true);
				DotApplicationTime = World->GetTimeSeconds();
				GLog->Log("Dot application seconds:" + FString::SanitizeFloat(DotApplicationTime));
				bHasDot = true;

				//Resets the particle system template
				if(ParticleSystemComponent)
				{
					ParticleSystemComponent->SetTemplate(FireEffectParticleTemplate);
					ParticleSystemComponent->Activate(true);
					//Activate the fire particles
					/*ParticleSystemComponent->Deactivate();
					ParticleSystemComponent->Template = FireEffectParticleTemplate;
					ParticleSystemComponent->Activate(true);*/
					//ZombieDebuffComp->SetFireParticleEnabled(true);

				}

			}
		}
	}
}

void AZombieCharacter::ApplySlowEffect()
{
	//Applies the slow effect on zombie and sets up the slow timer
	//as well as the right particle template

	if (!bHasSlow)
	{
		DisableDotEffectIfNecessary(true);
		bHasSlow = true;

		float SlowSpeed = InitialMaxWalkSpeed * (1 - SlowPercentage);

		//Activating slow
		GetCharacterMovement()->MaxWalkSpeed = SlowSpeed;

		//Reseting the slow particle template
		ParticleSystemComponent->SetTemplate(SlowEffectParticleTemplate);
		ParticleSystemComponent->Activate(true);

		GLog->Log("Applied slow effect on zombie.");

		//Initializing the slow timer handle
		UWorld* World = GetWorld();
		if (World && OurCharacter)
		{
			World->GetTimerManager().SetTimer(SlowTimerHandle, this, &AZombieCharacter::DisableSlowEffect, SlowEffectDuration);
		}
	}
}

void AZombieCharacter::DisableSlowEffect()
{
	//Disables the slow effect on the zombie and applies its default movement speed
	bHasSlow = false;

	GetCharacterMovement()->MaxWalkSpeed = InitialMaxWalkSpeed;
	GLog->Log("Disabled slow effect on zombie.");

	UWorld* World=GetWorld();
	if (World)
	{
		//Clearing the slow timer so the effect can be applied again
		World->GetTimerManager().ClearTimer(SlowTimerHandle);
	}

	//Turning of the particle system
	ParticleSystemComponent->Deactivate();
}

void AZombieCharacter::StatsInit(float MinHealth, float MaxHealth, float MinDamage, float MaxDamage)
{
	//Initializes the stats of the zombie based on the given range of values
	CurrentHealth = FMath::RandRange(MinHealth, MaxHealth);
	Damage = FMath::RandRange(MinDamage, MaxDamage);
}

void AZombieCharacter::Attack()
{
	//This function is used only when it's permitted by the zombie's animation instance
	//It creates a raycast in a sphere shape and checks for possible hits
	//If the hits contain our player it makes sure it applies damage to him

	//Setting up the start and end location of the raycast
	FVector StartLocation = GetMesh()->GetSocketLocation(FName("MeleeStartSocket"));
	FVector EndLocation = GetMesh()->GetSocketLocation(FName("MeleeEndSocket"));

	//Raycasting in a sphere to detect collisions
	TArray<FHitResult> HitResults;

	//Setting up the shape of the raycast
	FCollisionShape CollisionShape;
	CollisionShape.ShapeType = ECollisionShape::Sphere;
	CollisionShape.SetSphere(AttackRaycastRadius);

	//Object query parameters
	FCollisionObjectQueryParams ObjectQueryParams;
	ObjectQueryParams.AllDynamicObjects;

	//Handling ignored actors
	FCollisionQueryParams QueryParams;
	QueryParams.AddIgnoredActor(this);

	UWorld* World = GetWorld();
	if (World && ZAnimInstance->bEligibleForAttack)
	{
		//Raycasting...
		bool bHit = World->SweepMultiByObjectType(HitResults, StartLocation, EndLocation, FQuat::Identity, ObjectQueryParams, CollisionShape, QueryParams);

		//Raycast visualization
		/*FVector Center = ((EndLocation - StartLocation) / 2) + StartLocation;
		DrawDebugSphere(World, Center, AttackRaycastRadius, 20, FColor::Green, false, 2.f);*/

		//Checking for possible hits
		if (bHit)
		{
			for (auto It = HitResults.CreateIterator(); It; It++)
			{
				ARoguelikeChar* Char = Cast<ARoguelikeChar>(It->GetActor());
				if (Char && ZAnimInstance && GetCharacterMovement())
				{
					//Calling the attack function from character
					Char->TakeDamageFromZombie(Damage);

					//Closing the flag which checks for the attack function
					ZAnimInstance->bEligibleForAttack = false;

					//Updating with new movement speed
					GetCharacterMovement()->MaxWalkSpeed = InitialMaxWalkSpeed;
					ZAnimInstance->Speed = InitialMaxWalkSpeed;
					break;
				}
			}
		}
	}

}

void AZombieCharacter::Die()
{
	//Disables the logic of the zombie and gradually destroys this Actor

	AZombieController* ZCon = Cast<AZombieController>(GetController());
	if (ZCon)
	{
		//Increasing the kills and wave count if necessary
		OurCharacter->Kills++;
		URoguelikeGameInstance* GameInstance = Cast<URoguelikeGameInstance>(GetGameInstance());
		GameInstance->IncreaseWaveCountIfNeeded();
		OurCharacter->PlayerController->UpdateUI();

		//Stopping the AI logic
		ZCon->UnPossess();

		AlphaChannelReduction();
		//AlphaReductionTimeline.PlayFromStart();

		//Handling the last animations
		ZAnimInstance->bIsDead = true;
		ZAnimInstance->Speed = 0;

		AudioComponent->Stop();

		//Disabling the collision to avoid false kill count!
		UCapsuleComponent* RootComp = Cast<UCapsuleComponent>(GetRootComponent());
		RootComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);

	}
}

void AZombieCharacter::HandleTimelineProgress(float AlphaReduction)
{
	//Gradually reducing the Alpha value of the material of the zombie
	//if(DeathMaterialInstance)
	//{
	//	//GLog->Log("Timeline tick");
	//	//GetMesh()->CreateAndSetMaterialInstanceDynamicFromMaterial(0, DeathMaterialInstance);
	//	GetMesh()->CreateDynamicMaterialInstance(0, DeathMaterialInstance);
	//	GLog->Log("Alpha reduction:" + FString::SanitizeFloat(AlphaReduction));

	//	//DeathMaterialInstance->OverrideScalarParameterDefault(FName("AlphaReduction"), AlphaReduction, true, ERHIFeatureLevel::Num);
	//	TArray<FScalarParameterValue> ZombieMatInstScalarParams;
	//	ZombieMatInstScalarParams = DeathMaterialInstance->ScalarParameterValues;
	//
	//	for (auto It = ZombieMatInstScalarParams.CreateIterator(); It;It++)
	//	{
	//		if((*It).ParameterName==FName("AlphaReduction"))
	//		{
	//			(*It).ParameterValue = AlphaReduction;
	//			break;
	//		}
	//	}

	//	FScalarParameterValue ZombieInstance;
	//	ZombieInstance.ParameterName = FName("AlphaReduction");
	//
	//	//int32 AlphaReductionPropertyIndex = ZombieMatInstScalarParams.Find(ZombieInstance.ParameterName);

	//	auto* Parameter=ZombieMatInstScalarParams.FindByPredicate( [&] (int32 i) {return ZombieMatInstScalarParams[i].ParameterName == FName("AlphaReduction"); });
	//	Parameter->ParameterValue = AlphaReduction;
	//

	//	//ZombieMatInstScalarParams[AlphaReductionPropertyIndex].ParameterValue = AlphaReduction;

	//}
}

//void AZombieCharacter::KillZombie()
//{
//	Destroy();
//}