PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/src/cocktail/domElement/as3/ImageDOMElement.hx

http://github.com/silexlabs/Cocktail
Haxe | 61 lines | 25 code | 9 blank | 27 comment | 2 complexity | cb7fe1bae4ed1fa1d26bdd123b36c391 MD5 | raw file
 1/*
 2This file is part of Silex - see http://projects.silexlabs.org/?/silex
 3
 4Silex is Š 2010-2011 Silex Labs and is released under the GPL License:
 5
 6This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 
 7
 8This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 9
10To read the license please visit http://www.gnu.org/copyleft/gpl.html
11*/
12package cocktail.domElement.as3;
13
14import cocktail.nativeElement.NativeElement;
15import flash.display.Bitmap;
16import flash.display.BitmapData;
17import flash.display.Loader;
18import haxe.Log;
19import cocktail.domElement.abstract.AbstractImageDOMElement;
20
21/**
22 * This is the Image DOMElement implementation for Flash.
23 * 
24 * @author Yannick DOMINGUEZ
25 */
26class ImageDOMElement extends AbstractImageDOMElement
27{
28
29	public function new(nativeElement:NativeElement = null) 
30	{
31		super(nativeElement);
32	}
33	
34	//////////////////////////////////////////////////////////////////////////////////////////
35	// Overriden GETTER/SETTER
36	//////////////////////////////////////////////////////////////////////////////////////////
37	
38	/**
39	 * Override to use the flash API to smooth/unsmooth bitmap
40	 * @param	value
41	 * @return
42	 */
43	override public function setSmooth(value:Bool):Bool
44	{
45		super.setSmooth(value);
46		
47		//cast the native element as a loader
48		// and retrieve its bitmap content
49		var typedNativeElement:Loader = cast(this._nativeElement);
50		var bitmap:Bitmap = cast(typedNativeElement.content);
51		
52		if (bitmap != null)
53		{
54			//activate/deactivate picture smoothing
55			bitmap.smoothing = value;
56		}
57		
58		return value;
59	}
60	
61}