2013-11-28 15:57:09 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
2015-03-23 23:46:30 +00:00
< title > Phaser Source: src/gameobjects/BitmapData.js< / title >
2013-11-28 15:57:09 +00:00
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
2014-11-15 20:01:46 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/default.css" >
2013-11-28 15:57:09 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/sunlight.default.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/site.cerulean.css" >
< / head >
< body >
2014-11-25 00:23:44 +00:00
2013-11-28 15:57:09 +00:00
< div class = "container-fluid" >
< div class = "navbar navbar-fixed-top navbar-inverse" >
2014-11-25 00:23:44 +00:00
< div style = "position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050" > < a href = "http://phaser.io" > < img src = "img/phaser.png" border = "0" / > < / a > < / div >
2013-11-28 15:57:09 +00:00
< div class = "navbar-inner" >
2014-11-25 00:23:44 +00:00
< a class = "brand" href = "index.html" > Phaser API< / a >
2013-11-28 15:57:09 +00:00
< ul class = "nav" >
2014-11-25 00:23:44 +00:00
2013-11-28 15:57:09 +00:00
< li class = "dropdown" >
< a href = "namespaces.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Namespaces< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-0" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.html" > Phaser< / a >
< / li >
2015-10-15 11:06:38 +00:00
< li class = "class-depth-0" >
< a href = "Phaser.KeyCode.html" > KeyCode< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-0" >
< a href = "PIXI.html" > PIXI< / a >
< / li >
2013-11-28 15:57:09 +00:00
< / ul >
< / li >
< li class = "dropdown" >
< a href = "classes.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Classes< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Animation.html" > Animation< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.AnimationManager.html" > AnimationManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.AnimationParser.html" > AnimationParser< / a >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArraySet.html" > ArraySet< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayUtils.html" > ArrayUtils< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.AudioSprite.html" > AudioSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.BitmapData.html" > BitmapData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.BitmapText.html" > BitmapText< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Button.html" > Button< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Cache.html" > Cache< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Camera.html" > Camera< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Canvas.html" > Canvas< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Circle.html" > Circle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Color.html" > Color< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Component.Angle.html" > Angle< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Animation.html" > Animation< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.AutoCull.html" > AutoCull< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Bounds.html" > Bounds< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.BringToTop.html" > BringToTop< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Core.html" > Core< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Crop.html" > Crop< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Delta.html" > Delta< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Destroy.html" > Destroy< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.FixedToCamera.html" > FixedToCamera< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Health.html" > Health< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InCamera.html" > InCamera< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InputEnabled.html" > InputEnabled< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InWorld.html" > InWorld< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.LifeSpan.html" > LifeSpan< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.LoadTexture.html" > LoadTexture< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Overlap.html" > Overlap< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.PhysicsBody.html" > PhysicsBody< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Reset.html" > Reset< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.ScaleMinMax.html" > ScaleMinMax< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Smoothed.html" > Smoothed< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Create.html" > Create< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.Creature.html" > Creature< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Device.html" > Device< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.DeviceButton.html" > DeviceButton< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.DOM.html" > DOM< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Easing.html" > Easing< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Back.html" > Back< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Bounce.html" > Bounce< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Circular.html" > Circular< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Cubic.html" > Cubic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Elastic.html" > Elastic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Exponential.html" > Exponential< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Linear.html" > Linear< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quadratic.html" > Quadratic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quartic.html" > Quartic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quintic.html" > Quintic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Sinusoidal.html" > Sinusoidal< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.Ellipse.html" > Ellipse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Events.html" > Events< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Filter.html" > Filter< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.FlexGrid.html" > FlexGrid< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.FlexLayer.html" > FlexLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Frame.html" > Frame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.FrameData.html" > FrameData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Game.html" > Game< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-21 15:37:26 +00:00
< a href = "Phaser.GameObjectCreator.html" > GameObjectCreator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.GameObjectFactory.html" > GameObjectFactory< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Gamepad.html" > Gamepad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Graphics.html" > Graphics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Group.html" > Group< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-08 07:24:22 +00:00
< a href = "Phaser.Image.html" > Image< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ImageCollection.html" > ImageCollection< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Input.html" > Input< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.InputHandler.html" > InputHandler< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Key.html" > Key< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Keyboard.html" > Keyboard< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Line.html" > Line< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.LinkedList.html" > LinkedList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Loader.html" > Loader< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.LoaderParser.html" > LoaderParser< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Math.html" > Math< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Matrix.html" > Matrix< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Mouse.html" > Mouse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.MSPointer.html" > MSPointer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Net.html" > Net< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Particle.html" > Particle< / a >
< / li >
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Particles.html" > Particles< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Particles.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Particles.Arcade.Emitter.html" > Emitter< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Physics.html" > Physics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Physics.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Arcade.Body.html" > Body< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-3" >
2015-08-24 14:43:45 +00:00
< a href = "Phaser.Physics.Arcade.TilemapCollision.html" > TilemapCollision< / a >
2015-03-23 23:46:30 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.html" > Ninja< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.AABB.html" > AABB< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Circle.html" > Circle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.html" > P2< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.BodyDebug.html" > BodyDebug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.DistanceConstraint.html" > DistanceConstraint< / a >
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.FixtureList.html" > FixtureList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.GearConstraint.html" > GearConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.InversePointProxy.html" > InversePointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.LockConstraint.html" > LockConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Material.html" > Material< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PointProxy.html" > PointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PrismaticConstraint.html" > PrismaticConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.RevoluteConstraint.html" > RevoluteConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.RotationalSpring.html" > RotationalSpring< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Spring.html" > Spring< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Plugin.html" > Plugin< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.PluginManager.html" > PluginManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Point.html" > Point< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Pointer.html" > Pointer< / a >
< / li >
2015-10-15 11:06:38 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.PointerMode.html" > PointerMode< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Polygon.html" > Polygon< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.QuadTree.html" > QuadTree< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.RandomDataGenerator.html" > RandomDataGenerator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Rectangle.html" > Rectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.RenderTexture.html" > RenderTexture< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.RequestAnimationFrame.html" > RequestAnimationFrame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.RetroFont.html" > RetroFont< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Rope.html" > Rope< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.RoundedRectangle.html" > RoundedRectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.ScaleManager.html" > ScaleManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Signal.html" > Signal< / a >
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.SignalBinding.html" > SignalBinding< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.SinglePad.html" > SinglePad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Sound.html" > Sound< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.SoundManager.html" > SoundManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Sprite.html" > Sprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.SpriteBatch.html" > SpriteBatch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Stage.html" > Stage< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.State.html" > State< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.StateManager.html" > StateManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Text.html" > Text< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tilemap.html" > Tilemap< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapLayer.html" > TilemapLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapParser.html" > TilemapParser< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tileset.html" > Tileset< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TileSprite.html" > TileSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Time.html" > Time< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Timer.html" > Timer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.TimerEvent.html" > TimerEvent< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Touch.html" > Touch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tween.html" > Tween< / a >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.TweenData.html" > TweenData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TweenManager.html" > TweenManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Utils.html" > Utils< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Utils.Debug.html" > Debug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "Phaser.Video.html" > Video< / a >
2013-11-28 15:57:09 +00:00
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "Phaser.World.html" > World< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "PIXI.AbstractFilter.html" > AbstractFilter< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "PIXI.BaseTexture.html" > BaseTexture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasBuffer.html" > CanvasBuffer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasGraphics.html" > CanvasGraphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasMaskManager.html" > CanvasMaskManager< / a >
< / li >
2015-08-24 14:43:45 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.CanvasPool.html" > CanvasPool< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.CanvasRenderer.html" > CanvasRenderer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasTinter.html" > CanvasTinter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ComplexPrimitiveShader.html" > ComplexPrimitiveShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DisplayObject.html" > DisplayObject< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DisplayObjectContainer.html" > DisplayObjectContainer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Event.html" > Event< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.EventTarget.html" > EventTarget< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.FilterTexture.html" > FilterTexture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Graphics.html" > Graphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.GraphicsData.html" > GraphicsData< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PIXI.html" > PIXI< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PixiFastShader.html" > PixiFastShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PixiShader.html" > PixiShader< / a >
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.PolyK.html" > PolyK< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.PrimitiveShader.html" > PrimitiveShader< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.RenderTexture.html" > RenderTexture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Rope.html" > Rope< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Sprite.html" > Sprite< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.SpriteBatch.html" > SpriteBatch< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Strip.html" > Strip< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.StripShader.html" > StripShader< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Texture.html" > Texture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.TilingSprite.html" > TilingSprite< / a >
2014-11-15 20:01:46 +00:00
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLBlendModeManager.html" > WebGLBlendModeManager< / a >
2014-11-25 00:23:44 +00:00
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLFastSpriteBatch.html" > WebGLFastSpriteBatch< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLFilterManager.html" > WebGLFilterManager< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLRenderer.html" > WebGLRenderer< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< / ul >
< / li >
< li class = "dropdown" >
< a href = "global.html" class = "dropdown-toggle" data-toggle = "dropdown" > Global< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#AUTO" > AUTO< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BITMAPDATA" > BITMAPDATA< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BITMAPTEXT" > BITMAPTEXT< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#blendModes" > blendModes< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BUTTON" > BUTTON< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CANVAS" > CANVAS< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CANVAS_FILTER" > CANVAS_FILTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CIRCLE" > CIRCLE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CREATURE" > CREATURE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#DOWN" > DOWN< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ELLIPSE" > ELLIPSE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#EMITTER" > EMITTER< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#GAMES" > GAMES< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#GRAPHICS" > GRAPHICS< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#GROUP" > GROUP< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#HEADLESS" > HEADLESS< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#IMAGE" > IMAGE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#LEFT" > LEFT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#LINE" > LINE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#MATRIX" > MATRIX< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#NONE" > NONE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#POINT" > POINT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#POINTER" > POINTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#POLYGON" > POLYGON< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RECTANGLE" > RECTANGLE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RENDERTEXTURE" > RENDERTEXTURE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RETROFONT" > RETROFONT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RIGHT" > RIGHT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ROPE" > ROPE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ROUNDEDRECTANGLE" > ROUNDEDRECTANGLE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#scaleModes" > scaleModes< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#SPRITE" > SPRITE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#SPRITEBATCH" > SPRITEBATCH< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TEXT" > TEXT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILEMAP" > TILEMAP< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILEMAPLAYER" > TILEMAPLAYER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILESPRITE" > TILESPRITE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#UP" > UP< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#VERSION" > VERSION< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#VIDEO" > VIDEO< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#WEBGL" > WEBGL< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#WEBGL_FILTER" > WEBGL_FILTER< / a >
2014-11-15 20:01:46 +00:00
< / li >
2013-11-28 15:57:09 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
2014-11-15 20:01:46 +00:00
< li class = "dropdown" >
2014-11-25 00:23:44 +00:00
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Core< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Game.html" > Game< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Group.html" > Group< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.World.html" > World< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Loader.html" > Loader< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Cache.html" > Cache< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Time.html" > Time< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Camera.html" > Camera< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.StateManager.html" > State Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TweenManager.html" > Tween Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.SoundManager.html" > Sound Manager< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Input.html" > Input Manager< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.ScaleManager.html" > Scale Manager< / a > < / li >
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Game Objects< b class = "caret" > < / b > < / a >
2014-11-15 20:01:46 +00:00
< ul class = "dropdown-menu " >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.GameObjectFactory.html" > Factory (game.add)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.GameObjectCreator.html" > Creator (game.make)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sprite.html" > Sprite< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Image.html" > Image< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sound.html" > Sound< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Video.html" > Video< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particles.Arcade.Emitter.html" > Particle Emitter< / a > < / li >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particle.html" > Particle< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Text.html" > Text< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tween.html" > Tween< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapText.html" > BitmapText< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tilemap.html" > Tilemap< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapData.html" > BitmapData< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RetroFont.html" > RetroFont< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Button.html" > Button< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Animation.html" > Animation< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Graphics.html" > Graphics< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RenderTexture.html" > RenderTexture< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TileSprite.html" > TileSprite< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Geometry< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Circle.html" > Circle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Ellipse.html" > Ellipse< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Line.html" > Line< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Matrix.html" > Matrix< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Point.html" > Point< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Polygon.html" > Polygon< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Rectangle.html" > Rectangle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RoundedRectangle.html" > Rounded Rectangle< / a > < / li >
2014-11-25 00:23:44 +00:00
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Physics< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Arcade.html" > Arcade Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Arcade.Body.html" > Body< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Physics.P2.html" > P2 Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Body.html" > Body< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Spring.html" > Spring< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Ninja.html" > Ninja Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Body.html" > Body< / a > < / li >
2014-11-15 20:01:46 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Input< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.InputHandler.html" > Input Handler< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Pointer.html" > Pointer< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.DeviceButton.html" > Device Button< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Mouse.html" > Mouse< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Keyboard.html" > Keyboard< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Key.html" > Key< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Gamepad.html" > Gamepad< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Community< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io" > Phaser Web Site< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser" > Phaser Github< / a > < / li >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/examples" > Phaser Examples< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser-plugins" > Phaser Plugins< / a > < / li >
< li class = "class-depth-1" > < a href = "http://www.html5gamedevs.com/forum/14-phaser/" > Forum< / a > < / li >
< li class = "class-depth-1" > < a href = "http://stackoverflow.com/questions/tagged/phaser-framework" > Stack Overflow< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/learn" > Tutorials< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://confirmsubscription.com/h/r/369DE48E3E86AF1E" > Newsletter< / a > < / li >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/community/twitter" > Twitter< / a > < / li >
< li class = "class-depth-1" > < a href = "http://phaser.io/community/irc" > IRC< / a > < / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-1" > < a href = "https://www.codeandweb.com/texturepacker/phaser" > Texture Packer< / a > < / li >
2014-11-25 00:23:44 +00:00
< / ul >
< / li >
2013-11-28 15:57:09 +00:00
< / ul >
< / div >
< / div >
< div class = "row-fluid" >
< div class = "span12" >
< div id = "main" >
2015-03-23 23:46:30 +00:00
< h1 class = "page-title" > Source: src/gameobjects/BitmapData.js< / h1 >
2013-11-28 15:57:09 +00:00
< section >
< article >
< pre class = "sunlight-highlight-javascript linenums" > /**
* @author Richard Davey < rich@photonstorm.com>
2015-03-23 23:46:30 +00:00
* @copyright 2015 Photon Storm Ltd.
2013-11-28 15:57:09 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
2014-10-09 15:12:53 +00:00
* A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations.
* A single BitmapData can be used as the texture for one or many Images/Sprites.
* So if you need to dynamically create a Sprite texture then they are a good choice.
2013-11-28 15:57:09 +00:00
*
* @class Phaser.BitmapData
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
2015-07-22 14:31:30 +00:00
* @param {string} key - Internal Phaser reference key for the BitmapData.
* @param {number} [width=256] - The width of the BitmapData in pixels. If undefined or zero it's set to a default value.
* @param {number} [height=256] - The height of the BitmapData in pixels. If undefined or zero it's set to a default value.
2013-11-28 15:57:09 +00:00
*/
2014-02-08 07:24:22 +00:00
Phaser.BitmapData = function (game, key, width, height) {
2013-11-28 15:57:09 +00:00
2015-07-22 14:31:30 +00:00
if (width === undefined || width === 0) { width = 256; }
if (height === undefined || height === 0) { height = 256; }
2013-11-28 15:57:09 +00:00
/**
2014-03-28 01:42:49 +00:00
* @property {Phaser.Game} game - A reference to the currently running game.
2013-11-28 15:57:09 +00:00
*/
this.game = game;
/**
2014-02-08 07:24:22 +00:00
* @property {string} key - The key of the BitmapData in the Cache, if stored there.
2013-11-28 15:57:09 +00:00
*/
2014-02-08 07:24:22 +00:00
this.key = key;
2013-11-28 15:57:09 +00:00
/**
* @property {number} width - The width of the BitmapData in pixels.
*/
this.width = width;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {number} height - The height of the BitmapData in pixels.
*/
this.height = height;
/**
* @property {HTMLCanvasElement} canvas - The canvas to which this BitmapData draws.
* @default
*/
2015-08-24 14:43:45 +00:00
// this.canvas = Phaser.Canvas.create(width, height, '', true);
this.canvas = PIXI.CanvasPool.create(this, width, height);
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
* @default
*/
2014-12-03 10:39:11 +00:00
this.context = this.canvas.getContext('2d', { alpha: true });
2013-11-28 15:57:09 +00:00
2014-02-18 03:01:51 +00:00
/**
* @property {CanvasRenderingContext2D} ctx - A reference to BitmapData.context.
*/
this.ctx = this.context;
2013-11-28 15:57:09 +00:00
/**
2014-04-29 14:39:02 +00:00
* @property {ImageData} imageData - The context image data.
2015-08-24 14:43:45 +00:00
* Please note that a call to BitmapData.draw() or BitmapData.copy() does not update immediately this property for performance reason. Use BitmapData.update() to do so.
* This property is updated automatically after the first game loop, according to the dirty flag property.
2013-11-28 15:57:09 +00:00
*/
this.imageData = this.context.getImageData(0, 0, width, height);
2014-05-20 09:12:48 +00:00
/**
2015-07-22 14:31:30 +00:00
* A Uint8ClampedArray view into BitmapData.buffer.
* Note that this is unavailable in some browsers (such as Epic Browser due to its security restrictions)
* @property {Uint8ClampedArray} data
2014-05-20 09:12:48 +00:00
*/
2015-07-22 14:31:30 +00:00
this.data = null;
if (this.imageData)
{
this.data = this.imageData.data;
}
2014-05-20 09:12:48 +00:00
/**
* @property {Uint32Array} pixels - An Uint32Array view into BitmapData.buffer.
*/
this.pixels = null;
2013-11-28 15:57:09 +00:00
/**
2014-04-29 14:39:02 +00:00
* @property {ArrayBuffer} buffer - An ArrayBuffer the same size as the context ImageData.
2013-11-28 15:57:09 +00:00
*/
2015-07-22 14:31:30 +00:00
if (this.data)
2013-11-28 15:57:09 +00:00
{
2015-07-22 14:31:30 +00:00
if (this.imageData.data.buffer)
2014-05-20 09:12:48 +00:00
{
2015-07-22 14:31:30 +00:00
this.buffer = this.imageData.data.buffer;
2014-05-20 09:12:48 +00:00
this.pixels = new Uint32Array(this.buffer);
}
else
{
2015-07-22 14:31:30 +00:00
if (window['ArrayBuffer'])
{
this.buffer = new ArrayBuffer(this.imageData.data.length);
this.pixels = new Uint32Array(this.buffer);
}
else
{
this.pixels = this.imageData.data;
}
2014-05-20 09:12:48 +00:00
}
2013-11-28 15:57:09 +00:00
}
/**
* @property {PIXI.BaseTexture} baseTexture - The PIXI.BaseTexture.
* @default
*/
this.baseTexture = new PIXI.BaseTexture(this.canvas);
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {PIXI.Texture} texture - The PIXI.Texture.
* @default
*/
this.texture = new PIXI.Texture(this.baseTexture);
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {Phaser.Frame} textureFrame - The Frame this BitmapData uses for rendering.
* @default
*/
2015-07-22 14:31:30 +00:00
this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'bitmapData');
2013-11-28 15:57:09 +00:00
2014-07-10 19:31:11 +00:00
this.texture.frame = this.textureFrame;
2013-11-28 15:57:09 +00:00
/**
* @property {number} type - The const type of this object.
* @default
*/
this.type = Phaser.BITMAPDATA;
2014-04-29 14:39:02 +00:00
/**
* @property {boolean} disableTextureUpload - If disableTextureUpload is true this BitmapData will never send its image data to the GPU when its dirty flag is true.
*/
this.disableTextureUpload = false;
2014-03-24 12:41:45 +00:00
/**
* @property {boolean} dirty - If dirty this BitmapData will be re-rendered.
*/
this.dirty = false;
2013-11-28 15:57:09 +00:00
2014-04-29 14:39:02 +00:00
// Aliases
this.cls = this.clear;
2014-09-09 14:36:56 +00:00
/**
* @property {number} _image - Internal cache var.
* @private
*/
this._image = null;
/**
* @property {Phaser.Point} _pos - Internal cache var.
* @private
*/
this._pos = new Phaser.Point();
/**
* @property {Phaser.Point} _size - Internal cache var.
* @private
*/
this._size = new Phaser.Point();
/**
* @property {Phaser.Point} _scale - Internal cache var.
* @private
*/
this._scale = new Phaser.Point();
/**
* @property {number} _rotate - Internal cache var.
* @private
*/
this._rotate = 0;
/**
2014-12-03 10:39:11 +00:00
* @property {object} _alpha - Internal cache var.
2014-09-09 14:36:56 +00:00
* @private
*/
this._alpha = { prev: 1, current: 1 };
/**
* @property {Phaser.Point} _anchor - Internal cache var.
* @private
*/
this._anchor = new Phaser.Point();
2014-04-29 14:39:02 +00:00
/**
* @property {number} _tempR - Internal cache var.
* @private
*/
this._tempR = 0;
/**
* @property {number} _tempG - Internal cache var.
* @private
*/
this._tempG = 0;
/**
* @property {number} _tempB - Internal cache var.
* @private
*/
this._tempB = 0;
2014-10-09 15:12:53 +00:00
/**
* @property {Phaser.Circle} _circle - Internal cache var.
* @private
*/
this._circle = new Phaser.Circle();
2015-07-22 14:31:30 +00:00
/**
* @property {HTMLCanvasElement} _swapCanvas - A swap canvas.
* @private
*/
2015-08-24 14:43:45 +00:00
this._swapCanvas = PIXI.CanvasPool.create(this, width, height);
2015-07-22 14:31:30 +00:00
2014-03-28 01:42:49 +00:00
};
2013-11-28 15:57:09 +00:00
Phaser.BitmapData.prototype = {
/**
2015-07-22 14:31:30 +00:00
* Shifts the contents of this BitmapData by the distances given.
*
2015-10-15 11:06:38 +00:00
* The image will wrap-around the edges on all sides if the wrap argument is true (the default).
2015-07-22 14:31:30 +00:00
*
* @method Phaser.BitmapData#move
* @param {integer} x - The amount of pixels to horizontally shift the canvas by. Use a negative value to shift to the left, positive to the right.
* @param {integer} y - The amount of pixels to vertically shift the canvas by. Use a negative value to shift up, positive to shift down.
2015-10-15 11:06:38 +00:00
* @param {boolean} [wrap=true] - Wrap the content of the BitmapData.
2015-07-22 14:31:30 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
2015-10-15 11:06:38 +00:00
move: function (x, y, wrap) {
2015-07-22 14:31:30 +00:00
if (x !== 0)
{
2015-10-15 11:06:38 +00:00
this.moveH(x, wrap);
2015-07-22 14:31:30 +00:00
}
if (y !== 0)
{
2015-10-15 11:06:38 +00:00
this.moveV(y, wrap);
2015-07-22 14:31:30 +00:00
}
return this;
},
/**
* Shifts the contents of this BitmapData horizontally.
*
2015-10-15 11:06:38 +00:00
* The image will wrap-around the sides if the wrap argument is true (the default).
2015-07-22 14:31:30 +00:00
*
* @method Phaser.BitmapData#moveH
* @param {integer} distance - The amount of pixels to horizontally shift the canvas by. Use a negative value to shift to the left, positive to the right.
2015-10-15 11:06:38 +00:00
* @param {boolean} [wrap=true] - Wrap the content of the BitmapData.
2015-07-22 14:31:30 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
2015-10-15 11:06:38 +00:00
moveH: function (distance, wrap) {
if (wrap === undefined) { wrap = true; }
2015-07-22 14:31:30 +00:00
var c = this._swapCanvas;
var ctx = c.getContext('2d');
var h = this.height;
var src = this.canvas;
ctx.clearRect(0, 0, this.width, this.height);
if (distance < 0)
{
distance = Math.abs(distance);
// Moving to the left
var w = this.width - distance;
// Left-hand chunk
2015-10-15 11:06:38 +00:00
if (wrap)
{
ctx.drawImage(src, 0, 0, distance, h, w, 0, distance, h);
}
2015-07-22 14:31:30 +00:00
// Rest of the image
ctx.drawImage(src, distance, 0, w, h, 0, 0, w, h);
}
else
{
// Moving to the right
var w = this.width - distance;
// Right-hand chunk
2015-10-15 11:06:38 +00:00
if (wrap)
{
ctx.drawImage(src, w, 0, distance, h, 0, 0, distance, h);
}
2015-07-22 14:31:30 +00:00
// Rest of the image
ctx.drawImage(src, 0, 0, w, h, distance, 0, w, h);
}
this.clear();
return this.copy(this._swapCanvas);
},
/**
* Shifts the contents of this BitmapData vertically.
*
2015-10-15 11:06:38 +00:00
* The image will wrap-around the sides if the wrap argument is true (the default).
2015-07-22 14:31:30 +00:00
*
* @method Phaser.BitmapData#moveV
* @param {integer} distance - The amount of pixels to vertically shift the canvas by. Use a negative value to shift up, positive to shift down.
2015-10-15 11:06:38 +00:00
* @param {boolean} [wrap=true] - Wrap the content of the BitmapData.
2015-07-22 14:31:30 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
2015-10-15 11:06:38 +00:00
moveV: function (distance, wrap) {
if (wrap === undefined) { wrap = true; }
2015-07-22 14:31:30 +00:00
var c = this._swapCanvas;
var ctx = c.getContext('2d');
var w = this.width;
var src = this.canvas;
ctx.clearRect(0, 0, this.width, this.height);
if (distance < 0)
{
distance = Math.abs(distance);
// Moving up
var h = this.height - distance;
// Top chunk
2015-10-15 11:06:38 +00:00
if (wrap)
{
ctx.drawImage(src, 0, 0, w, distance, 0, h, w, distance);
}
2015-07-22 14:31:30 +00:00
// Rest of the image
ctx.drawImage(src, 0, distance, w, h, 0, 0, w, h);
}
else
{
// Moving down
var h = this.height - distance;
// Bottom chunk
2015-10-15 11:06:38 +00:00
if (wrap)
{
ctx.drawImage(src, 0, h, w, distance, 0, 0, w, distance);
}
2015-07-22 14:31:30 +00:00
// Rest of the image
ctx.drawImage(src, 0, 0, w, h, 0, distance, w, h);
}
this.clear();
return this.copy(this._swapCanvas);
},
/**
* Updates the given objects so that they use this BitmapData as their texture.
* This will replace any texture they will currently have set.
2014-03-28 01:42:49 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.BitmapData#add
2014-02-18 03:01:51 +00:00
* @param {Phaser.Sprite|Phaser.Sprite[]|Phaser.Image|Phaser.Image[]} object - Either a single Sprite/Image or an Array of Sprites/Images.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-02-18 03:01:51 +00:00
add: function (object) {
2013-11-28 15:57:09 +00:00
2014-02-18 03:01:51 +00:00
if (Array.isArray(object))
2013-11-28 15:57:09 +00:00
{
2014-02-18 03:01:51 +00:00
for (var i = 0; i < object.length; i++)
2013-11-28 15:57:09 +00:00
{
2014-02-18 03:01:51 +00:00
if (object[i]['loadTexture'])
{
object[i].loadTexture(this);
}
2013-11-28 15:57:09 +00:00
}
}
2014-02-18 03:01:51 +00:00
else
{
object.loadTexture(this);
}
2013-11-28 15:57:09 +00:00
2014-09-09 14:36:56 +00:00
return this;
2013-11-28 15:57:09 +00:00
},
2014-07-10 19:31:11 +00:00
/**
* Takes the given Game Object, resizes this BitmapData to match it and then draws it into this BitmapDatas canvas, ready for further processing.
* The source game object is not modified by this operation.
2014-09-09 14:36:56 +00:00
* If the source object uses a texture as part of a Texture Atlas or Sprite Sheet, only the current frame will be used for sizing.
2014-07-10 19:31:11 +00:00
* If a string is given it will assume it's a cache key and look in Phaser.Cache for an image key matching the string.
*
* @method Phaser.BitmapData#load
2014-10-22 20:49:44 +00:00
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} source - The object that will be used to populate this BitmapData. If you give a string it will try and find the Image in the Game.Cache first.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-07-10 19:31:11 +00:00
*/
load: function (source) {
if (typeof source === 'string')
{
source = this.game.cache.getImage(source);
}
2014-09-09 14:36:56 +00:00
if (source)
2014-07-10 19:31:11 +00:00
{
2014-09-09 14:36:56 +00:00
this.resize(source.width, source.height);
this.cls();
2014-07-10 19:31:11 +00:00
}
else
{
2014-09-09 14:36:56 +00:00
return;
2014-07-10 19:31:11 +00:00
}
2014-09-09 14:36:56 +00:00
this.draw(source);
2014-07-10 19:31:11 +00:00
this.update();
2014-09-09 14:36:56 +00:00
return this;
2014-07-10 19:31:11 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2014-04-29 14:39:02 +00:00
* Clears the BitmapData context using a clearRect.
*
* @method Phaser.BitmapData#cls
*/
/**
* Clears the BitmapData context using a clearRect.
*
2015-07-22 14:31:30 +00:00
* You can optionally define the area to clear.
* If the arguments are left empty it will clear the entire canvas.
*
2013-11-28 15:57:09 +00:00
* @method Phaser.BitmapData#clear
2015-07-22 14:31:30 +00:00
* @param {number} [x=0] - The x coordinate of the top-left of the area to clear.
* @param {number} [y=0] - The y coordinate of the top-left of the area to clear.
* @param {number} [width] - The width of the area to clear. If undefined it will use BitmapData.width.
* @param {number} [height] - The height of the area to clear. If undefined it will use BitmapData.height.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2013-11-28 15:57:09 +00:00
*/
2015-07-22 14:31:30 +00:00
clear: function (x, y, width, height) {
if (x === undefined) { x = 0; }
if (y === undefined) { y = 0; }
if (width === undefined) { width = this.width; }
if (height === undefined) { height = this.height; }
2013-11-28 15:57:09 +00:00
2015-07-22 14:31:30 +00:00
this.context.clearRect(x, y, width, height);
2014-03-28 01:42:49 +00:00
2015-10-15 11:06:38 +00:00
this.update();
2014-03-24 12:41:45 +00:00
this.dirty = true;
2013-11-28 15:57:09 +00:00
2014-09-09 14:36:56 +00:00
return this;
2013-11-28 15:57:09 +00:00
},
2014-02-18 03:01:51 +00:00
/**
2014-04-29 14:39:02 +00:00
* Fills the BitmapData with the given color.
*
* @method Phaser.BitmapData#fill
* @param {number} r - The red color value, between 0 and 0xFF (255).
* @param {number} g - The green color value, between 0 and 0xFF (255).
* @param {number} b - The blue color value, between 0 and 0xFF (255).
* @param {number} [a=1] - The alpha color value, between 0 and 1.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
fill: function (r, g, b, a) {
2015-07-22 14:31:30 +00:00
if (a === undefined) { a = 1; }
2014-04-29 14:39:02 +00:00
this.context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
this.context.fillRect(0, 0, this.width, this.height);
this.dirty = true;
2014-09-09 14:36:56 +00:00
return this;
2014-04-29 14:39:02 +00:00
},
2015-07-22 14:31:30 +00:00
/**
* Creates a new Image element by converting this BitmapDatas canvas into a dataURL.
*
* The image is then stored in the image Cache using the key given.
*
* Finally a PIXI.Texture is created based on the image and returned.
*
* You can apply the texture to a sprite or any other supporting object by using either the
* key or the texture. First call generateTexture:
*
* `var texture = bitmapdata.generateTexture('ball');`
*
* Then you can either apply the texture to a sprite:
*
* `game.add.sprite(0, 0, texture);`
*
* or by using the string based key:
*
* `game.add.sprite(0, 0, 'ball');`
*
* @method Phaser.BitmapData#generateTexture
* @param {string} key - The key which will be used to store the image in the Cache.
* @return {PIXI.Texture} The newly generated texture.
*/
generateTexture: function (key) {
var image = new Image();
image.src = this.canvas.toDataURL("image/png");
var obj = this.game.cache.addImage(key, '', image);
return new PIXI.Texture(obj.base);
},
2014-04-29 14:39:02 +00:00
/**
* Resizes the BitmapData. This changes the size of the underlying canvas and refreshes the buffer.
*
2014-02-18 03:01:51 +00:00
* @method Phaser.BitmapData#resize
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-02-18 03:01:51 +00:00
*/
resize: function (width, height) {
if (width !== this.width || height !== this.height)
{
this.width = width;
this.height = height;
2014-07-10 19:31:11 +00:00
2014-02-18 03:01:51 +00:00
this.canvas.width = width;
this.canvas.height = height;
2014-07-10 19:31:11 +00:00
2015-07-22 14:31:30 +00:00
this._swapCanvas.width = width;
this._swapCanvas.height = height;
2014-07-10 19:31:11 +00:00
this.baseTexture.width = width;
this.baseTexture.height = height;
2014-02-18 03:01:51 +00:00
this.textureFrame.width = width;
this.textureFrame.height = height;
2014-07-10 19:31:11 +00:00
this.texture.width = width;
this.texture.height = height;
2014-07-18 11:45:51 +00:00
this.texture.crop.width = width;
this.texture.crop.height = height;
2014-09-09 14:36:56 +00:00
this.update();
2014-07-10 19:31:11 +00:00
this.dirty = true;
2014-02-18 03:01:51 +00:00
}
2014-03-28 01:42:49 +00:00
2014-09-09 14:36:56 +00:00
return this;
2014-02-18 03:01:51 +00:00
},
/**
2014-04-29 14:39:02 +00:00
* This re-creates the BitmapData.imageData from the current context.
* It then re-builds the ArrayBuffer, the data Uint8ClampedArray reference and the pixels Int32Array.
* If not given the dimensions defaults to the full size of the context.
*
* @method Phaser.BitmapData#update
* @param {number} [x=0] - The x coordinate of the top-left of the image data area to grab from.
* @param {number} [y=0] - The y coordinate of the top-left of the image data area to grab from.
2015-07-22 14:31:30 +00:00
* @param {number} [width=1] - The width of the image data area.
* @param {number} [height=1] - The height of the image data area.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
2014-09-09 14:36:56 +00:00
update: function (x, y, width, height) {
2014-04-29 14:39:02 +00:00
2015-07-22 14:31:30 +00:00
if (x === undefined) { x = 0; }
if (y === undefined) { y = 0; }
if (width === undefined) { width = Math.max(1, this.width); }
if (height === undefined) { height = Math.max(1, this.height); }
2014-04-29 14:39:02 +00:00
this.imageData = this.context.getImageData(x, y, width, height);
2014-05-20 09:12:48 +00:00
this.data = this.imageData.data;
2014-04-29 14:39:02 +00:00
if (this.imageData.data.buffer)
{
this.buffer = this.imageData.data.buffer;
2014-05-20 09:12:48 +00:00
this.pixels = new Uint32Array(this.buffer);
2014-04-29 14:39:02 +00:00
}
else
{
2014-05-20 09:12:48 +00:00
if (window['ArrayBuffer'])
{
this.buffer = new ArrayBuffer(this.imageData.data.length);
this.pixels = new Uint32Array(this.buffer);
}
else
{
this.pixels = this.imageData.data;
}
2014-04-29 14:39:02 +00:00
}
2014-09-09 14:36:56 +00:00
return this;
2014-04-29 14:39:02 +00:00
},
/**
* Scans through the area specified in this BitmapData and sends a color object for every pixel to the given callback.
* The callback will be sent a color object with 6 properties: `{ r: number, g: number, b: number, a: number, color: number, rgba: string }`.
* Where r, g, b and a are integers between 0 and 255 representing the color component values for red, green, blue and alpha.
* The `color` property is an Int32 of the full color. Note the endianess of this will change per system.
* The `rgba` property is a CSS style rgba() string which can be used with context.fillStyle calls, among others.
* The callback will also be sent the pixels x and y coordinates respectively.
* The callback must return either `false`, in which case no change will be made to the pixel, or a new color object.
* If a new color object is returned the pixel will be set to the r, g, b and a color values given within it.
*
* @method Phaser.BitmapData#processPixelRGB
* @param {function} callback - The callback that will be sent each pixel color object to be processed.
* @param {object} callbackContext - The context under which the callback will be called.
* @param {number} [x=0] - The x coordinate of the top-left of the region to process from.
* @param {number} [y=0] - The y coordinate of the top-left of the region to process from.
* @param {number} [width] - The width of the region to process.
* @param {number} [height] - The height of the region to process.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
processPixelRGB: function (callback, callbackContext, x, y, width, height) {
2015-07-22 14:31:30 +00:00
if (x === undefined) { x = 0; }
if (y === undefined) { y = 0; }
if (width === undefined) { width = this.width; }
if (height === undefined) { height = this.height; }
2014-04-29 14:39:02 +00:00
var w = x + width;
var h = y + height;
var pixel = Phaser.Color.createColor();
var result = { r: 0, g: 0, b: 0, a: 0 };
var dirty = false;
for (var ty = y; ty < h; ty++)
{
for (var tx = x; tx < w; tx++)
{
Phaser.Color.unpackPixel(this.getPixel32(tx, ty), pixel);
result = callback.call(callbackContext, pixel, tx, ty);
2015-03-23 23:46:30 +00:00
if (result !== false & & result !== null & & result !== undefined)
2014-04-29 14:39:02 +00:00
{
this.setPixel32(tx, ty, result.r, result.g, result.b, result.a, false);
dirty = true;
}
}
}
if (dirty)
{
this.context.putImageData(this.imageData, 0, 0);
this.dirty = true;
}
2014-09-09 14:36:56 +00:00
return this;
2014-04-29 14:39:02 +00:00
},
/**
* Scans through the area specified in this BitmapData and sends the color for every pixel to the given callback along with its x and y coordinates.
* Whatever value the callback returns is set as the new color for that pixel, unless it returns the same color, in which case it's skipped.
* Note that the format of the color received will be different depending on if the system is big or little endian.
* It is expected that your callback will deal with endianess. If you'd rather Phaser did it then use processPixelRGB instead.
* The callback will also be sent the pixels x and y coordinates respectively.
*
* @method Phaser.BitmapData#processPixel
* @param {function} callback - The callback that will be sent each pixel color to be processed.
* @param {object} callbackContext - The context under which the callback will be called.
* @param {number} [x=0] - The x coordinate of the top-left of the region to process from.
* @param {number} [y=0] - The y coordinate of the top-left of the region to process from.
* @param {number} [width] - The width of the region to process.
* @param {number} [height] - The height of the region to process.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
processPixel: function (callback, callbackContext, x, y, width, height) {
2015-07-22 14:31:30 +00:00
if (x === undefined) { x = 0; }
if (y === undefined) { y = 0; }
if (width === undefined) { width = this.width; }
if (height === undefined) { height = this.height; }
2014-04-29 14:39:02 +00:00
var w = x + width;
var h = y + height;
var pixel = 0;
var result = 0;
var dirty = false;
for (var ty = y; ty < h; ty++)
{
for (var tx = x; tx < w; tx++)
{
pixel = this.getPixel32(tx, ty);
result = callback.call(callbackContext, pixel, tx, ty);
if (result !== pixel)
{
this.pixels[ty * this.width + tx] = result;
dirty = true;
}
}
}
if (dirty)
{
this.context.putImageData(this.imageData, 0, 0);
this.dirty = true;
}
2014-09-09 14:36:56 +00:00
return this;
2014-04-29 14:39:02 +00:00
},
/**
* Replaces all pixels matching one color with another. The color values are given as two sets of RGBA values.
* An optional region parameter controls if the replacement happens in just a specific area of the BitmapData or the entire thing.
*
* @method Phaser.BitmapData#replaceRGB
* @param {number} r1 - The red color value to be replaced. Between 0 and 255.
* @param {number} g1 - The green color value to be replaced. Between 0 and 255.
* @param {number} b1 - The blue color value to be replaced. Between 0 and 255.
* @param {number} a1 - The alpha color value to be replaced. Between 0 and 255.
* @param {number} r2 - The red color value that is the replacement color. Between 0 and 255.
* @param {number} g2 - The green color value that is the replacement color. Between 0 and 255.
* @param {number} b2 - The blue color value that is the replacement color. Between 0 and 255.
* @param {number} a2 - The alpha color value that is the replacement color. Between 0 and 255.
* @param {Phaser.Rectangle} [region] - The area to perform the search over. If not given it will replace over the whole BitmapData.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
replaceRGB: function (r1, g1, b1, a1, r2, g2, b2, a2, region) {
var sx = 0;
var sy = 0;
var w = this.width;
var h = this.height;
var source = Phaser.Color.packPixel(r1, g1, b1, a1);
2015-03-23 23:46:30 +00:00
if (region !== undefined & & region instanceof Phaser.Rectangle)
2014-04-29 14:39:02 +00:00
{
sx = region.x;
sy = region.y;
w = region.width;
h = region.height;
}
for (var y = 0; y < h; y++)
{
for (var x = 0; x < w; x++)
{
if (this.getPixel32(sx + x, sy + y) === source)
{
this.setPixel32(sx + x, sy + y, r2, g2, b2, a2, false);
}
}
}
this.context.putImageData(this.imageData, 0, 0);
this.dirty = true;
2014-09-09 14:36:56 +00:00
return this;
2014-04-29 14:39:02 +00:00
},
/**
* Sets the hue, saturation and lightness values on every pixel in the given region, or the whole BitmapData if no region was specified.
*
* @method Phaser.BitmapData#setHSL
* @param {number} [h=null] - The hue, in the range 0 - 1.
* @param {number} [s=null] - The saturation, in the range 0 - 1.
* @param {number} [l=null] - The lightness, in the range 0 - 1.
* @param {Phaser.Rectangle} [region] - The area to perform the operation on. If not given it will run over the whole BitmapData.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
setHSL: function (h, s, l, region) {
2015-07-22 14:31:30 +00:00
if (h === undefined || h === null) { h = false; }
if (s === undefined || s === null) { s = false; }
if (l === undefined || l === null) { l = false; }
2014-04-29 14:39:02 +00:00
2015-03-23 23:46:30 +00:00
if (!h & & !s & & !l)
2014-04-29 14:39:02 +00:00
{
return;
}
2015-07-22 14:31:30 +00:00
if (region === undefined)
2014-04-29 14:39:02 +00:00
{
region = new Phaser.Rectangle(0, 0, this.width, this.height);
}
var pixel = Phaser.Color.createColor();
for (var y = region.y; y < region.bottom; y++)
{
for (var x = region.x; x < region.right; x++)
{
Phaser.Color.unpackPixel(this.getPixel32(x, y), pixel, true);
if (h)
{
pixel.h = h;
}
if (s)
{
pixel.s = s;
}
if (l)
{
pixel.l = l;
}
Phaser.Color.HSLtoRGB(pixel.h, pixel.s, pixel.l, pixel);
this.setPixel32(x, y, pixel.r, pixel.g, pixel.b, pixel.a, false);
}
}
this.context.putImageData(this.imageData, 0, 0);
this.dirty = true;
2014-09-09 14:36:56 +00:00
return this;
2014-04-29 14:39:02 +00:00
},
/**
* Shifts any or all of the hue, saturation and lightness values on every pixel in the given region, or the whole BitmapData if no region was specified.
* Shifting will add the given value onto the current h, s and l values, not replace them.
* The hue is wrapped to keep it within the range 0 to 1. Saturation and lightness are clamped to not exceed 1.
*
* @method Phaser.BitmapData#shiftHSL
* @param {number} [h=null] - The amount to shift the hue by.
* @param {number} [s=null] - The amount to shift the saturation by.
* @param {number} [l=null] - The amount to shift the lightness by.
* @param {Phaser.Rectangle} [region] - The area to perform the operation on. If not given it will run over the whole BitmapData.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-02-18 03:01:51 +00:00
*/
2014-04-29 14:39:02 +00:00
shiftHSL: function (h, s, l, region) {
2013-11-28 15:57:09 +00:00
2015-07-22 14:31:30 +00:00
if (h === undefined || h === null) { h = false; }
if (s === undefined || s === null) { s = false; }
if (l === undefined || l === null) { l = false; }
2013-11-28 15:57:09 +00:00
2015-03-23 23:46:30 +00:00
if (!h & & !s & & !l)
2014-04-29 14:39:02 +00:00
{
return;
}
2015-07-22 14:31:30 +00:00
if (region === undefined)
2014-04-29 14:39:02 +00:00
{
region = new Phaser.Rectangle(0, 0, this.width, this.height);
}
var pixel = Phaser.Color.createColor();
for (var y = region.y; y < region.bottom; y++)
{
for (var x = region.x; x < region.right; x++)
{
Phaser.Color.unpackPixel(this.getPixel32(x, y), pixel, true);
if (h)
{
pixel.h = this.game.math.wrap(pixel.h + h, 0, 1);
}
if (s)
{
pixel.s = this.game.math.limitValue(pixel.s + s, 0, 1);
}
if (l)
{
pixel.l = this.game.math.limitValue(pixel.l + l, 0, 1);
}
Phaser.Color.HSLtoRGB(pixel.h, pixel.s, pixel.l, pixel);
this.setPixel32(x, y, pixel.r, pixel.g, pixel.b, pixel.a, false);
}
}
this.context.putImageData(this.imageData, 0, 0);
this.dirty = true;
2013-11-28 15:57:09 +00:00
2014-09-09 14:36:56 +00:00
return this;
2013-11-28 15:57:09 +00:00
},
/**
* Sets the color of the given pixel to the specified red, green, blue and alpha values.
2014-04-29 14:39:02 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.BitmapData#setPixel32
2014-04-29 14:39:02 +00:00
* @param {number} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {number} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
2013-11-28 15:57:09 +00:00
* @param {number} red - The red color value, between 0 and 0xFF (255).
* @param {number} green - The green color value, between 0 and 0xFF (255).
* @param {number} blue - The blue color value, between 0 and 0xFF (255).
* @param {number} alpha - The alpha color value, between 0 and 0xFF (255).
2014-04-29 14:39:02 +00:00
* @param {boolean} [immediate=true] - If `true` the context.putImageData will be called and the dirty flag set.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-04-29 14:39:02 +00:00
setPixel32: function (x, y, red, green, blue, alpha, immediate) {
2015-07-22 14:31:30 +00:00
if (immediate === undefined) { immediate = true; }
2013-11-28 15:57:09 +00:00
2015-03-23 23:46:30 +00:00
if (x >= 0 & & x < = this.width & & y >= 0 & & y < = this.height)
2013-11-28 15:57:09 +00:00
{
2014-04-29 14:39:02 +00:00
if (Phaser.Device.LITTLE_ENDIAN)
2013-11-28 15:57:09 +00:00
{
2014-04-29 14:39:02 +00:00
this.pixels[y * this.width + x] = (alpha < < 24) | (blue < < 16) | (green < < 8) | red;
2013-11-28 15:57:09 +00:00
}
else
{
2014-04-29 14:39:02 +00:00
this.pixels[y * this.width + x] = (red < < 24) | (green < < 16) | (blue < < 8) | alpha;
2013-11-28 15:57:09 +00:00
}
2014-04-29 14:39:02 +00:00
if (immediate)
{
this.context.putImageData(this.imageData, 0, 0);
this.dirty = true;
}
2013-11-28 15:57:09 +00:00
}
2014-09-09 14:36:56 +00:00
return this;
2013-11-28 15:57:09 +00:00
},
/**
* Sets the color of the given pixel to the specified red, green and blue values.
2014-02-21 15:37:26 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.BitmapData#setPixel
2014-04-29 14:39:02 +00:00
* @param {number} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {number} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {number} red - The red color value, between 0 and 0xFF (255).
* @param {number} green - The green color value, between 0 and 0xFF (255).
* @param {number} blue - The blue color value, between 0 and 0xFF (255).
* @param {boolean} [immediate=true] - If `true` the context.putImageData will be called and the dirty flag set.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-04-29 14:39:02 +00:00
setPixel: function (x, y, red, green, blue, immediate) {
2013-11-28 15:57:09 +00:00
2014-09-09 14:36:56 +00:00
return this.setPixel32(x, y, red, green, blue, 255, immediate);
2013-11-28 15:57:09 +00:00
},
/**
2014-04-29 14:39:02 +00:00
* Get the color of a specific pixel in the context into a color object.
2014-05-20 09:12:48 +00:00
* If you have drawn anything to the BitmapData since it was created you must call BitmapData.update to refresh the array buffer,
* otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist.
2014-02-21 15:37:26 +00:00
*
2014-04-29 14:39:02 +00:00
* @method Phaser.BitmapData#getPixel
* @param {number} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {number} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {object} [out] - An object into which 4 properties will be created: r, g, b and a. If not provided a new object will be created.
* @return {object} An object with the red, green, blue and alpha values set in the r, g, b and a properties.
2013-11-28 15:57:09 +00:00
*/
2014-04-29 14:39:02 +00:00
getPixel: function (x, y, out) {
2013-11-28 15:57:09 +00:00
2014-04-29 14:39:02 +00:00
if (!out)
{
out = Phaser.Color.createColor();
}
var index = ~~(x + (y * this.width));
index *= 4;
2014-07-10 19:31:11 +00:00
out.r = this.data[index];
out.g = this.data[++index];
out.b = this.data[++index];
out.a = this.data[++index];
2013-11-28 15:57:09 +00:00
2014-04-29 14:39:02 +00:00
return out;
2013-11-28 15:57:09 +00:00
},
/**
2014-02-21 15:37:26 +00:00
* Get the color of a specific pixel including its alpha value.
2014-05-20 09:12:48 +00:00
* If you have drawn anything to the BitmapData since it was created you must call BitmapData.update to refresh the array buffer,
* otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist.
2014-04-29 14:39:02 +00:00
* Note that on little-endian systems the format is 0xAABBGGRR and on big-endian the format is 0xRRGGBBAA.
2014-02-21 15:37:26 +00:00
*
2014-04-29 14:39:02 +00:00
* @method Phaser.BitmapData#getPixel32
* @param {number} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {number} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
2013-11-28 15:57:09 +00:00
* @return {number} A native color value integer (format: 0xAARRGGBB)
*/
getPixel32: function (x, y) {
2015-03-23 23:46:30 +00:00
if (x >= 0 & & x < = this.width & & y >= 0 & & y < = this.height)
2013-11-28 15:57:09 +00:00
{
2014-04-29 14:39:02 +00:00
return this.pixels[y * this.width + x];
2013-11-28 15:57:09 +00:00
}
},
2014-04-29 14:39:02 +00:00
/**
* Get the color of a specific pixel including its alpha value as a color object containing r,g,b,a and rgba properties.
2014-05-20 09:12:48 +00:00
* If you have drawn anything to the BitmapData since it was created you must call BitmapData.update to refresh the array buffer,
* otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist.
2014-04-29 14:39:02 +00:00
*
* @method Phaser.BitmapData#getPixelRGB
* @param {number} x - The x coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {number} y - The y coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.
* @param {object} [out] - An object into which 3 properties will be created: r, g and b. If not provided a new object will be created.
* @param {boolean} [hsl=false] - Also convert the rgb values into hsl?
* @param {boolean} [hsv=false] - Also convert the rgb values into hsv?
* @return {object} An object with the red, green and blue values set in the r, g and b properties.
*/
getPixelRGB: function (x, y, out, hsl, hsv) {
return Phaser.Color.unpackPixel(this.getPixel32(x, y), out, hsl, hsv);
},
2013-11-28 15:57:09 +00:00
/**
2014-02-21 15:37:26 +00:00
* Gets all the pixels from the region specified by the given Rectangle object.
*
2014-04-29 14:39:02 +00:00
* @method Phaser.BitmapData#getPixels
2014-02-21 15:37:26 +00:00
* @param {Phaser.Rectangle} rect - The Rectangle region to get.
2014-04-29 14:39:02 +00:00
* @return {ImageData} Returns a ImageData object containing a Uint8ClampedArray data property.
2013-11-28 15:57:09 +00:00
*/
getPixels: function (rect) {
return this.context.getImageData(rect.x, rect.y, rect.width, rect.height);
},
2014-10-22 20:49:44 +00:00
/**
* Scans the BitmapData, pixel by pixel, until it encounters a pixel that isn't transparent (i.e. has an alpha value > 0).
2015-07-22 14:31:30 +00:00
* It then stops scanning and returns an object containing the color of the pixel in r, g and b properties and the location in the x and y properties.
2014-10-22 20:49:44 +00:00
*
* The direction parameter controls from which direction it should start the scan:
*
* 0 = top to bottom
* 1 = bottom to top
* 2 = left to right
* 3 = right to left
*
* @method Phaser.BitmapData#getFirstPixel
* @param {number} [direction=0] - The direction in which to scan for the first pixel. 0 = top to bottom, 1 = bottom to top, 2 = left to right and 3 = right to left.
2015-07-22 14:31:30 +00:00
* @return {object} Returns an object containing the color of the pixel in the `r`, `g` and `b` properties and the location in the `x` and `y` properties.
2014-10-22 20:49:44 +00:00
*/
getFirstPixel: function (direction) {
2015-07-22 14:31:30 +00:00
if (direction === undefined) { direction = 0; }
2014-10-22 20:49:44 +00:00
var pixel = Phaser.Color.createColor();
var x = 0;
var y = 0;
var v = 1;
var scan = false;
if (direction === 1)
{
v = -1;
y = this.height;
}
else if (direction === 3)
{
v = -1;
x = this.width;
}
do {
Phaser.Color.unpackPixel(this.getPixel32(x, y), pixel);
if (direction === 0 || direction === 1)
{
// Top to Bottom / Bottom to Top
x++;
if (x === this.width)
{
x = 0;
y += v;
if (y >= this.height || y < = 0)
{
scan = true;
}
}
}
else if (direction === 2 || direction === 3)
{
// Left to Right / Right to Left
y++;
if (y === this.height)
{
y = 0;
x += v;
if (x >= this.width || x < = 0)
{
scan = true;
}
}
}
}
2015-03-23 23:46:30 +00:00
while (pixel.a === 0 & & !scan);
2014-10-22 20:49:44 +00:00
pixel.x = x;
pixel.y = y;
return pixel;
},
/**
* Scans the BitmapData and calculates the bounds. This is a rectangle that defines the extent of all non-transparent pixels.
2015-07-22 14:31:30 +00:00
* The rectangle returned will extend from the top-left of the image to the bottom-right, excluding transparent pixels.
2014-10-22 20:49:44 +00:00
*
* @method Phaser.BitmapData#getBounds
* @param {Phaser.Rectangle} [rect] - If provided this Rectangle object will be populated with the bounds, otherwise a new object will be created.
* @return {Phaser.Rectangle} A Rectangle whose dimensions encompass the full extent of non-transparent pixels in this BitmapData.
*/
getBounds: function (rect) {
2015-07-22 14:31:30 +00:00
if (rect === undefined) { rect = new Phaser.Rectangle(); }
2014-10-22 20:49:44 +00:00
rect.x = this.getFirstPixel(2).x;
// If we hit this, there's no point scanning any more, the image is empty
if (rect.x === this.width)
{
return rect.setTo(0, 0, 0, 0);
}
rect.y = this.getFirstPixel(0).y;
rect.width = (this.getFirstPixel(3).x - rect.x) + 1;
rect.height = (this.getFirstPixel(1).y - rect.y) + 1;
return rect;
},
2014-07-10 19:31:11 +00:00
/**
* Creates a new Phaser.Image object, assigns this BitmapData to be its texture, adds it to the world then returns it.
*
* @method Phaser.BitmapData#addToWorld
2014-09-09 14:36:56 +00:00
* @param {number} [x=0] - The x coordinate to place the Image at.
* @param {number} [y=0] - The y coordinate to place the Image at.
* @param {number} [anchorX=0] - Set the x anchor point of the Image. A value between 0 and 1, where 0 is the top-left and 1 is bottom-right.
* @param {number} [anchorY=0] - Set the y anchor point of the Image. A value between 0 and 1, where 0 is the top-left and 1 is bottom-right.
* @param {number} [scaleX=1] - The horizontal scale factor of the Image. A value of 1 means no scaling. 2 would be twice the size, and so on.
* @param {number} [scaleY=1] - The vertical scale factor of the Image. A value of 1 means no scaling. 2 would be twice the size, and so on.
2014-07-10 19:31:11 +00:00
* @return {Phaser.Image} The newly added Image object.
*/
2014-09-09 14:36:56 +00:00
addToWorld: function (x, y, anchorX, anchorY, scaleX, scaleY) {
2014-07-10 19:31:11 +00:00
2014-09-09 14:36:56 +00:00
scaleX = scaleX || 1;
scaleY = scaleY || 1;
2014-07-10 19:31:11 +00:00
2014-09-09 14:36:56 +00:00
var image = this.game.add.image(x, y, this);
2014-07-10 19:31:11 +00:00
2014-09-09 14:36:56 +00:00
image.anchor.set(anchorX, anchorY);
image.scale.set(scaleX, scaleY);
2013-11-28 15:57:09 +00:00
2014-09-09 14:36:56 +00:00
return image;
2014-02-21 15:37:26 +00:00
2014-09-09 14:36:56 +00:00
},
2014-07-10 19:31:11 +00:00
2014-09-09 14:36:56 +00:00
/**
* Copies a rectangular area from the source object to this BitmapData. If you give `null` as the source it will copy from itself.
* You can optionally resize, translate, rotate, scale, alpha or blend as it's drawn.
* All rotation, scaling and drawing takes place around the regions center point by default, but can be changed with the anchor parameters.
* Note that the source image can also be this BitmapData, which can create some interesting effects.
*
* This method has a lot of parameters for maximum control.
* You can use the more friendly methods like `copyRect` and `draw` to avoid having to remember them all.
*
* @method Phaser.BitmapData#copy
2014-10-22 20:49:44 +00:00
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} [source] - The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.
2014-09-09 14:36:56 +00:00
* @param {number} [x=0] - The x coordinate representing the top-left of the region to copy from the source image.
* @param {number} [y=0] - The y coordinate representing the top-left of the region to copy from the source image.
* @param {number} [width] - The width of the region to copy from the source image. If not specified it will use the full source image width.
* @param {number} [height] - The height of the region to copy from the source image. If not specified it will use the full source image height.
2015-01-06 06:57:25 +00:00
* @param {number} [tx] - The x coordinate to translate to before drawing. If not specified it will default to the `x` parameter. If `null` and `source` is a Display Object, it will default to `source.x`.
* @param {number} [ty] - The y coordinate to translate to before drawing. If not specified it will default to the `y` parameter. If `null` and `source` is a Display Object, it will default to `source.y`.
2014-09-09 14:36:56 +00:00
* @param {number} [newWidth] - The new width of the block being copied. If not specified it will default to the `width` parameter.
* @param {number} [newHeight] - The new height of the block being copied. If not specified it will default to the `height` parameter.
* @param {number} [rotate=0] - The angle in radians to rotate the block to before drawing. Rotation takes place around the center by default, but can be changed with the `anchor` parameters.
* @param {number} [anchorX=0] - The anchor point around which the block is rotated and scaled. A value between 0 and 1, where 0 is the top-left and 1 is bottom-right.
* @param {number} [anchorY=0] - The anchor point around which the block is rotated and scaled. A value between 0 and 1, where 0 is the top-left and 1 is bottom-right.
* @param {number} [scaleX=1] - The horizontal scale factor of the block. A value of 1 means no scaling. 2 would be twice the size, and so on.
* @param {number} [scaleY=1] - The vertical scale factor of the block. A value of 1 means no scaling. 2 would be twice the size, and so on.
* @param {number} [alpha=1] - The alpha that will be set on the context before drawing. A value between 0 (fully transparent) and 1, opaque.
2015-07-22 14:31:30 +00:00
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
2014-09-09 14:36:56 +00:00
* @param {boolean} [roundPx=false] - Should the x and y values be rounded to integers before drawing? This prevents anti-aliasing in some instances.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
copy: function (source, x, y, width, height, tx, ty, newWidth, newHeight, rotate, anchorX, anchorY, scaleX, scaleY, alpha, blendMode, roundPx) {
2015-07-22 14:31:30 +00:00
if (source === undefined || source === null) { source = this; }
2014-09-09 14:36:56 +00:00
this._image = source;
2015-08-24 14:43:45 +00:00
if (source instanceof Phaser.Sprite || source instanceof Phaser.Image || source instanceof Phaser.Text || source instanceof PIXI.Sprite)
2014-07-10 19:31:11 +00:00
{
2014-09-09 14:36:56 +00:00
// Copy over sprite values
this._pos.set(source.texture.crop.x, source.texture.crop.y);
this._size.set(source.texture.crop.width, source.texture.crop.height);
this._scale.set(source.scale.x, source.scale.y);
this._anchor.set(source.anchor.x, source.anchor.y);
this._rotate = source.rotation;
this._alpha.current = source.alpha;
this._image = source.texture.baseTexture.source;
2015-07-22 14:31:30 +00:00
if (tx === undefined || tx === null) { tx = source.x; }
if (ty === undefined || ty === null) { ty = source.y; }
2015-01-06 06:57:25 +00:00
2014-09-09 14:36:56 +00:00
if (source.texture.trim)
{
// Offset the translation coordinates by the trim amount
tx += source.texture.trim.x - source.anchor.x * source.texture.trim.width;
ty += source.texture.trim.y - source.anchor.y * source.texture.trim.height;
}
2014-10-09 15:12:53 +00:00
if (source.tint !== 0xFFFFFF)
{
if (source.cachedTint !== source.tint)
{
source.cachedTint = source.tint;
source.tintedTexture = PIXI.CanvasTinter.getTintedTexture(source, source.tint);
}
this._image = source.tintedTexture;
}
2014-07-10 19:31:11 +00:00
}
else
2014-02-21 15:37:26 +00:00
{
2014-09-09 14:36:56 +00:00
// Reset
this._pos.set(0);
this._scale.set(1);
this._anchor.set(0);
this._rotate = 0;
this._alpha.current = 1;
2014-07-10 19:31:11 +00:00
if (source instanceof Phaser.BitmapData)
{
2014-09-09 14:36:56 +00:00
this._image = source.canvas;
}
else if (typeof source === 'string')
{
source = this.game.cache.getImage(source);
if (source === null)
{
return;
}
else
{
this._image = source;
}
2014-07-10 19:31:11 +00:00
}
2014-09-09 14:36:56 +00:00
this._size.set(this._image.width, this._image.height);
2014-02-21 15:37:26 +00:00
}
2014-09-09 14:36:56 +00:00
// The source region to copy from
2015-07-22 14:31:30 +00:00
if (x === undefined || x === null) { x = 0; }
if (y === undefined || y === null) { y = 0; }
2014-07-10 19:31:11 +00:00
2014-09-09 14:36:56 +00:00
// If they set a width/height then we override the frame values with them
if (width)
{
this._size.x = width;
}
2014-04-29 14:39:02 +00:00
2014-09-09 14:36:56 +00:00
if (height)
{
this._size.y = height;
}
2014-02-21 15:37:26 +00:00
2014-09-09 14:36:56 +00:00
// The destination region to copy to
2015-07-22 14:31:30 +00:00
if (tx === undefined || tx === null) { tx = x; }
if (ty === undefined || ty === null) { ty = y; }
if (newWidth === undefined || newWidth === null) { newWidth = this._size.x; }
if (newHeight === undefined || newHeight === null) { newHeight = this._size.y; }
2014-04-29 14:39:02 +00:00
2014-09-09 14:36:56 +00:00
// Rotation - if set this will override any potential Sprite value
if (typeof rotate === 'number')
{
this._rotate = rotate;
}
2014-02-21 15:37:26 +00:00
2014-09-09 14:36:56 +00:00
// Anchor - if set this will override any potential Sprite value
if (typeof anchorX === 'number')
2014-02-21 15:37:26 +00:00
{
2014-09-09 14:36:56 +00:00
this._anchor.x = anchorX;
2014-02-21 15:37:26 +00:00
}
2014-09-09 14:36:56 +00:00
if (typeof anchorY === 'number')
{
this._anchor.y = anchorY;
}
2014-07-10 19:31:11 +00:00
2014-09-09 14:36:56 +00:00
// Scaling - if set this will override any potential Sprite value
if (typeof scaleX === 'number')
2014-02-21 15:37:26 +00:00
{
2014-09-09 14:36:56 +00:00
this._scale.x = scaleX;
2014-07-10 19:31:11 +00:00
}
2014-09-09 14:36:56 +00:00
if (typeof scaleY === 'number')
2014-07-10 19:31:11 +00:00
{
2014-09-09 14:36:56 +00:00
this._scale.y = scaleY;
}
// Effects
if (typeof alpha === 'number')
{
this._alpha.current = alpha;
}
2014-07-10 19:31:11 +00:00
2015-07-22 14:31:30 +00:00
if (blendMode === undefined) { blendMode = null; }
if (roundPx === undefined) { roundPx = false; }
2014-09-09 14:36:56 +00:00
if (this._alpha.current < = 0 || this._scale.x === 0 || this._scale.y === 0 || this._size.x === 0 || this._size.y === 0)
{
// Why bother wasting CPU cycles drawing something you can't see?
return;
2014-02-21 15:37:26 +00:00
}
2015-08-24 14:43:45 +00:00
var ctx = this.context;
this._alpha.prev = ctx.globalAlpha;
2014-07-10 19:31:11 +00:00
2015-08-24 14:43:45 +00:00
ctx.save();
2014-09-09 14:36:56 +00:00
2015-08-24 14:43:45 +00:00
ctx.globalAlpha = this._alpha.current;
2014-09-09 14:36:56 +00:00
if (blendMode)
{
2015-08-24 14:43:45 +00:00
this.op = blendMode;
2014-09-09 14:36:56 +00:00
}
if (roundPx)
{
tx |= 0;
ty |= 0;
}
2015-08-24 14:43:45 +00:00
ctx.translate(tx, ty);
2014-09-09 14:36:56 +00:00
2015-08-24 14:43:45 +00:00
ctx.scale(this._scale.x, this._scale.y);
2014-09-09 14:36:56 +00:00
2015-08-24 14:43:45 +00:00
ctx.rotate(this._rotate);
2014-09-09 14:36:56 +00:00
2015-08-24 14:43:45 +00:00
ctx.drawImage(this._image, this._pos.x + x, this._pos.y + y, this._size.x, this._size.y, -newWidth * this._anchor.x, -newHeight * this._anchor.y, newWidth, newHeight);
2014-09-09 14:36:56 +00:00
2015-08-24 14:43:45 +00:00
ctx.restore();
2014-09-09 14:36:56 +00:00
2015-08-24 14:43:45 +00:00
ctx.globalAlpha = this._alpha.prev;
2014-07-10 19:31:11 +00:00
2014-04-29 14:39:02 +00:00
this.dirty = true;
2014-09-09 14:36:56 +00:00
return this;
2014-04-29 14:39:02 +00:00
},
/**
2014-09-09 14:36:56 +00:00
* Copies the area defined by the Rectangle parameter from the source image to this BitmapData at the given location.
2014-04-29 14:39:02 +00:00
*
2014-09-09 14:36:56 +00:00
* @method Phaser.BitmapData#copyRect
2014-10-22 20:49:44 +00:00
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|string} source - The Image to copy from. If you give a string it will try and find the Image in the Game.Cache.
2014-09-09 14:36:56 +00:00
* @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
* @param {number} x - The destination x coordinate to copy the image to.
* @param {number} y - The destination y coordinate to copy the image to.
* @param {number} [alpha=1] - The alpha that will be set on the context before drawing. A value between 0 (fully transparent) and 1, opaque.
2015-07-22 14:31:30 +00:00
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
2014-09-09 14:36:56 +00:00
* @param {boolean} [roundPx=false] - Should the x and y values be rounded to integers before drawing? This prevents anti-aliasing in some instances.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
2014-09-09 14:36:56 +00:00
copyRect: function (source, area, x, y, alpha, blendMode, roundPx) {
2014-04-29 14:39:02 +00:00
2014-09-09 14:36:56 +00:00
return this.copy(source, area.x, area.y, area.width, area.height, x, y, area.width, area.height, 0, 0, 0, 1, 1, alpha, blendMode, roundPx);
2014-04-29 14:39:02 +00:00
2014-02-21 15:37:26 +00:00
},
/**
2014-09-09 14:36:56 +00:00
* Draws the given Phaser.Sprite, Phaser.Image or Phaser.Text to this BitmapData at the coordinates specified.
* You can use the optional width and height values to 'stretch' the sprite as it is drawn. This uses drawImage stretching, not scaling.
* When drawing it will take into account the Sprites rotation, scale and alpha values.
2014-02-21 15:37:26 +00:00
*
2014-09-09 14:36:56 +00:00
* @method Phaser.BitmapData#draw
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text} source - The Sprite, Image or Text object to draw onto this BitmapData.
* @param {number} [x=0] - The x coordinate to translate to before drawing. If not specified it will default to `source.x`.
* @param {number} [y=0] - The y coordinate to translate to before drawing. If not specified it will default to `source.y`.
* @param {number} [width] - The new width of the Sprite being copied. If not specified it will default to `source.width`.
* @param {number} [height] - The new height of the Sprite being copied. If not specified it will default to `source.height`.
2015-07-22 14:31:30 +00:00
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
2014-09-09 14:36:56 +00:00
* @param {boolean} [roundPx=false] - Should the x and y values be rounded to integers before drawing? This prevents anti-aliasing in some instances.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-02-21 15:37:26 +00:00
*/
2014-09-09 14:36:56 +00:00
draw: function (source, x, y, width, height, blendMode, roundPx) {
2014-02-21 15:37:26 +00:00
2014-09-09 14:36:56 +00:00
// By specifying null for most parameters it will tell `copy` to use the Sprite values instead, which is what we want here
return this.copy(source, null, null, null, null, x, y, width, height, null, null, null, null, null, null, blendMode, roundPx);
2014-02-21 15:37:26 +00:00
2014-09-09 14:36:56 +00:00
},
2013-11-28 15:57:09 +00:00
2015-01-06 06:57:25 +00:00
/**
* Draws the immediate children of a Phaser.Group to this BitmapData.
* Children are only drawn if they have their `exists` property set to `true`.
* The children will be drawn at their `x` and `y` world space coordinates. If this is outside the bounds of the BitmapData they won't be drawn.
* When drawing it will take into account the child's rotation, scale and alpha values.
* No iteration takes place. Groups nested inside other Groups will not be iterated through.
*
* @method Phaser.BitmapData#drawGroup
* @param {Phaser.Group} group - The Group to draw onto this BitmapData.
2015-07-22 14:31:30 +00:00
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
2015-01-06 06:57:25 +00:00
* @param {boolean} [roundPx=false] - Should the x and y values be rounded to integers before drawing? This prevents anti-aliasing in some instances.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
drawGroup: function (group, blendMode, roundPx) {
if (group.total > 0)
{
group.forEachExists(this.copy, this, null, null, null, null, null, null, null, null, null, null, null, null, null, null, blendMode, roundPx);
}
return this;
},
2015-08-24 14:43:45 +00:00
/**
* Draws the Game Object or Group to this BitmapData and then recursively iterates through all of its children.
*
* If a child has an `exists` property then it (and its children) will be only be drawn if exists is `true`.
*
* The children will be drawn at their `x` and `y` world space coordinates. If this is outside the bounds of the BitmapData
* they won't be drawn. Depending on your requirements you may need to resize the BitmapData in advance to match the
* bounds of the top-level Game Object.
*
* When drawing it will take into account the child's world rotation, scale and alpha values.
*
* It's perfectly valid to pass in `game.world` as the parent object, and it will iterate through the entire display list.
*
* Note: If you are trying to grab your entire game at the start of a State then you should ensure that at least 1 full update
* has taken place before doing so, otherwise all of the objects will render with incorrect positions and scales. You can
* trigger an update yourself by calling `stage.updateTransform()` before calling `drawFull`.
*
* @method Phaser.BitmapData#drawFull
* @param {Phaser.World|Phaser.Group|Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapText} parent - The Game Object to draw onto this BitmapData and then recursively draw all of its children.
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
* @param {boolean} [roundPx=false] - Should the x and y values be rounded to integers before drawing? This prevents anti-aliasing in some instances.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
drawFull: function (parent, blendMode, roundPx) {
if (parent.worldVisible === false || parent.worldAlpha === 0 || (parent.hasOwnProperty('exists') & & parent.exists === false))
{
return this;
}
if (parent.type !== Phaser.GROUP & & parent.type !== Phaser.EMITTER & & parent.type !== Phaser.BITMAPTEXT)
{
if (parent.type === Phaser.GRAPHICS)
{
var bounds = parent.getBounds();
this.ctx.save();
this.ctx.translate(bounds.x, bounds.y);
PIXI.CanvasGraphics.renderGraphics(parent, this.ctx);
this.ctx.restore();
}
else
{
this.copy(parent, null, null, null, null, parent.worldPosition.x, parent.worldPosition.y, null, null, parent.worldRotation, null, null, parent.worldScale.x, parent.worldScale.y, parent.worldAlpha, blendMode, roundPx);
}
}
if (parent.children)
{
for (var i = 0; i < parent.children.length; i++)
{
this.drawFull(parent.children[i], blendMode, roundPx);
}
}
return this;
},
2014-10-09 15:12:53 +00:00
/**
* Sets the shadow properties of this BitmapDatas context which will affect all draw operations made to it.
* You can cancel an existing shadow by calling this method and passing no parameters.
* Note: At the time of writing (October 2014) Chrome still doesn't support shadowBlur used with drawImage.
*
* @method Phaser.BitmapData#shadow
* @param {string} color - The color of the shadow, given in a CSS format, i.e. `#000000` or `rgba(0,0,0,1)`. If `null` or `undefined` the shadow will be reset.
* @param {number} [blur=5] - The amount the shadow will be blurred by. Low values = a crisp shadow, high values = a softer shadow.
* @param {number} [x=10] - The horizontal offset of the shadow in pixels.
* @param {number} [y=10] - The vertical offset of the shadow in pixels.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
shadow: function (color, blur, x, y) {
2015-08-24 14:43:45 +00:00
var ctx = this.context;
2015-07-22 14:31:30 +00:00
if (color === undefined || color === null)
2014-10-09 15:12:53 +00:00
{
2015-08-24 14:43:45 +00:00
ctx.shadowColor = 'rgba(0,0,0,0)';
2014-10-09 15:12:53 +00:00
}
else
{
2015-08-24 14:43:45 +00:00
ctx.shadowColor = color;
ctx.shadowBlur = blur || 5;
ctx.shadowOffsetX = x || 10;
ctx.shadowOffsetY = y || 10;
2014-10-09 15:12:53 +00:00
}
},
2014-09-09 14:36:56 +00:00
/**
* Draws the image onto this BitmapData using an image as an alpha mask.
*
* @method Phaser.BitmapData#alphaMask
2014-10-22 20:49:44 +00:00
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} source - The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} [mask] - The object to be used as the mask. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself. If you don't provide a mask it will use this BitmapData as the mask.
2014-10-09 15:12:53 +00:00
* @param {Phaser.Rectangle} [sourceRect] - A Rectangle where x/y define the coordinates to draw the Source image to and width/height define the size.
* @param {Phaser.Rectangle} [maskRect] - A Rectangle where x/y define the coordinates to draw the Mask image to and width/height define the size.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
2014-10-09 15:12:53 +00:00
alphaMask: function (source, mask, sourceRect, maskRect) {
2015-07-22 14:31:30 +00:00
if (maskRect === undefined || maskRect === null)
2014-10-09 15:12:53 +00:00
{
this.draw(mask).blendSourceAtop();
}
else
{
this.draw(mask, maskRect.x, maskRect.y, maskRect.width, maskRect.height).blendSourceAtop();
}
2014-07-10 19:31:11 +00:00
2015-07-22 14:31:30 +00:00
if (sourceRect === undefined || sourceRect === null)
2014-10-09 15:12:53 +00:00
{
this.draw(source).blendReset();
}
else
{
this.draw(source, sourceRect.x, sourceRect.y, sourceRect.width, sourceRect.height).blendReset();
}
return this;
2014-04-29 14:39:02 +00:00
},
/**
* Scans this BitmapData for all pixels matching the given r,g,b values and then draws them into the given destination BitmapData.
2014-07-10 19:31:11 +00:00
* The original BitmapData remains unchanged.
* The destination BitmapData must be large enough to receive all of the pixels that are scanned unless the 'resize' parameter is true.
2014-04-29 14:39:02 +00:00
* Although the destination BitmapData is returned from this method, it's actually modified directly in place, meaning this call is perfectly valid:
* `picture.extract(mask, r, g, b)`
2014-07-10 19:31:11 +00:00
* You can specify optional r2, g2, b2 color values. If given the pixel written to the destination bitmap will be of the r2, g2, b2 color.
* If not given it will be written as the same color it was extracted. You can provide one or more alternative colors, allowing you to tint
* the color during extraction.
2014-04-29 14:39:02 +00:00
*
* @method Phaser.BitmapData#extract
2014-09-09 14:36:56 +00:00
* @param {Phaser.BitmapData} destination - The BitmapData that the extracted pixels will be drawn to.
2014-04-29 14:39:02 +00:00
* @param {number} r - The red color component, in the range 0 - 255.
* @param {number} g - The green color component, in the range 0 - 255.
* @param {number} b - The blue color component, in the range 0 - 255.
2014-07-10 19:31:11 +00:00
* @param {number} [a=255] - The alpha color component, in the range 0 - 255 that the new pixel will be drawn at.
* @param {boolean} [resize=false] - Should the destination BitmapData be resized to match this one before the pixels are copied?
* @param {number} [r2] - An alternative red color component to be written to the destination, in the range 0 - 255.
* @param {number} [g2] - An alternative green color component to be written to the destination, in the range 0 - 255.
* @param {number} [b2] - An alternative blue color component to be written to the destination, in the range 0 - 255.
2014-04-29 14:39:02 +00:00
* @returns {Phaser.BitmapData} The BitmapData that the extract pixels were drawn on.
*/
2014-07-10 19:31:11 +00:00
extract: function (destination, r, g, b, a, resize, r2, g2, b2) {
2014-04-29 14:39:02 +00:00
2015-07-22 14:31:30 +00:00
if (a === undefined) { a = 255; }
if (resize === undefined) { resize = false; }
if (r2 === undefined) { r2 = r; }
if (g2 === undefined) { g2 = g; }
if (b2 === undefined) { b2 = b; }
2014-07-10 19:31:11 +00:00
if (resize)
{
destination.resize(this.width, this.height);
}
2014-04-29 14:39:02 +00:00
this.processPixelRGB(
2014-07-10 19:31:11 +00:00
function (pixel, x, y)
{
2015-03-23 23:46:30 +00:00
if (pixel.r === r & & pixel.g === g & & pixel.b === b)
2014-04-29 14:39:02 +00:00
{
2014-07-10 19:31:11 +00:00
destination.setPixel32(x, y, r2, g2, b2, a, false);
2014-04-29 14:39:02 +00:00
}
return false;
},
this);
destination.context.putImageData(destination.imageData, 0, 0);
destination.dirty = true;
return destination;
},
2014-05-20 09:12:48 +00:00
/**
* Draws a filled Rectangle to the BitmapData at the given x, y coordinates and width / height in size.
*
* @method Phaser.BitmapData#rect
* @param {number} x - The x coordinate of the top-left of the Rectangle.
* @param {number} y - The y coordinate of the top-left of the Rectangle.
* @param {number} width - The width of the Rectangle.
* @param {number} height - The height of the Rectangle.
* @param {string} [fillStyle] - If set the context fillStyle will be set to this value before the rect is drawn.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-05-20 09:12:48 +00:00
*/
rect: function (x, y, width, height, fillStyle) {
if (typeof fillStyle !== 'undefined')
{
this.context.fillStyle = fillStyle;
}
this.context.fillRect(x, y, width, height);
2014-09-09 14:36:56 +00:00
return this;
2014-05-20 09:12:48 +00:00
},
2015-03-23 23:46:30 +00:00
/**
* Draws text to the BitmapData in the given font and color.
* The default font is 14px Courier, so useful for quickly drawing debug text.
* If you need to do a lot of font work to this BitmapData we'd recommend implementing your own text draw method.
*
* @method Phaser.BitmapData#text
* @param {string} text - The text to write to the BitmapData.
* @param {number} x - The x coordinate of the top-left of the text string.
* @param {number} y - The y coordinate of the top-left of the text string.
* @param {string} [font='14px Courier'] - The font. This is passed directly to Context.font, so anything that can support, this can.
* @param {string} [color='rgb(255,255,255)'] - The color the text will be drawn in.
* @param {boolean} [shadow=true] - Draw a single pixel black shadow below the text (offset by text.x/y + 1)
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
text: function (text, x, y, font, color, shadow) {
2015-07-22 14:31:30 +00:00
if (x === undefined) { x = 0; }
if (y === undefined) { y = 0; }
if (font === undefined) { font = '14px Courier'; }
if (color === undefined) { color = 'rgb(255,255,255)'; }
if (shadow === undefined) { shadow = true; }
2015-03-23 23:46:30 +00:00
2015-08-24 14:43:45 +00:00
var ctx = this.context;
var prevFont = ctx.font;
2015-03-23 23:46:30 +00:00
2015-08-24 14:43:45 +00:00
ctx.font = font;
2015-03-23 23:46:30 +00:00
if (shadow)
{
2015-08-24 14:43:45 +00:00
ctx.fillStyle = 'rgb(0,0,0)';
ctx.fillText(text, x + 1, y + 1);
2015-03-23 23:46:30 +00:00
}
2015-08-24 14:43:45 +00:00
ctx.fillStyle = color;
ctx.fillText(text, x, y);
2015-03-23 23:46:30 +00:00
2015-08-24 14:43:45 +00:00
ctx.font = prevFont;
2015-03-23 23:46:30 +00:00
},
2014-04-29 14:39:02 +00:00
/**
* Draws a filled Circle to the BitmapData at the given x, y coordinates and radius in size.
*
* @method Phaser.BitmapData#circle
2014-05-20 09:12:48 +00:00
* @param {number} x - The x coordinate to draw the Circle at. This is the center of the circle.
* @param {number} y - The y coordinate to draw the Circle at. This is the center of the circle.
* @param {number} radius - The radius of the Circle in pixels. The radius is half the diameter.
2014-04-29 14:39:02 +00:00
* @param {string} [fillStyle] - If set the context fillStyle will be set to this value before the circle is drawn.
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2014-04-29 14:39:02 +00:00
*/
circle: function (x, y, radius, fillStyle) {
2015-08-24 14:43:45 +00:00
var ctx = this.context;
if (fillStyle !== undefined)
2014-04-29 14:39:02 +00:00
{
2015-08-24 14:43:45 +00:00
ctx.fillStyle = fillStyle;
2014-04-29 14:39:02 +00:00
}
2015-08-24 14:43:45 +00:00
ctx.beginPath();
ctx.arc(x, y, radius, 0, Math.PI * 2, false);
ctx.closePath();
ctx.fill();
return this;
},
/**
* Draws a line between the coordinates given in the color and thickness specified.
*
* @method Phaser.BitmapData#line
* @param {number} x1 - The x coordinate to start the line from.
* @param {number} y1 - The y coordinate to start the line from.
* @param {number} x2 - The x coordinate to draw the line to.
* @param {number} y2 - The y coordinate to draw the line to.
* @param {string} [color='#fff'] - The stroke color that the line will be drawn in.
* @param {number} [width=1] - The line thickness.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
line: function (x1, y1, x2, y2, color, width) {
if (color === undefined) { color = '#fff'; }
if (width === undefined) { width = 1; }
var ctx = this.context;
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
2014-04-29 14:39:02 +00:00
2015-08-24 14:43:45 +00:00
ctx.lineWidth = width;
ctx.strokeStyle = color;
ctx.stroke();
ctx.closePath();
2014-04-29 14:39:02 +00:00
2014-09-09 14:36:56 +00:00
return this;
2013-11-28 15:57:09 +00:00
},
2014-10-09 15:12:53 +00:00
/**
* Takes the given Line object and image and renders it to this BitmapData as a repeating texture line.
*
* @method Phaser.BitmapData#textureLine
* @param {Phaser.Line} line - A Phaser.Line object that will be used to plot the start and end of the line.
2014-10-22 20:49:44 +00:00
* @param {string|Image} image - The key of an image in the Phaser.Cache to use as the texture for this line, or an actual Image.
2014-10-09 15:12:53 +00:00
* @param {string} [repeat='repeat-x'] - The pattern repeat mode to use when drawing the line. Either `repeat`, `repeat-x` or `no-repeat`.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
textureLine: function (line, image, repeat) {
2015-07-22 14:31:30 +00:00
if (repeat === undefined) { repeat = 'repeat-x'; }
2014-10-09 15:12:53 +00:00
if (typeof image === 'string')
{
image = this.game.cache.getImage(image);
if (!image)
{
return;
}
}
var width = line.length;
2015-03-23 23:46:30 +00:00
if (repeat === 'no-repeat' & & width > image.width)
2014-10-09 15:12:53 +00:00
{
width = image.width;
}
2015-08-24 14:43:45 +00:00
var ctx = this.context;
ctx.fillStyle = ctx.createPattern(image, repeat);
2014-10-09 15:12:53 +00:00
this._circle = new Phaser.Circle(line.start.x, line.start.y, image.height);
this._circle.circumferencePoint(line.angle - 1.5707963267948966, false, this._pos);
2015-08-24 14:43:45 +00:00
ctx.save();
ctx.translate(this._pos.x, this._pos.y);
ctx.rotate(line.angle);
ctx.fillRect(0, 0, width, image.height);
ctx.restore();
2014-10-09 15:12:53 +00:00
this.dirty = true;
return this;
},
2013-11-28 15:57:09 +00:00
/**
* If the game is running in WebGL this will push the texture up to the GPU if it's dirty.
* This is called automatically if the BitmapData is being used by a Sprite, otherwise you need to remember to call it in your render function.
2014-04-29 14:39:02 +00:00
* If you wish to suppress this functionality set BitmapData.disableTextureUpload to `true`.
2014-02-21 15:37:26 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.BitmapData#render
2014-09-09 14:36:56 +00:00
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
2013-11-28 15:57:09 +00:00
*/
render: function () {
2015-03-23 23:46:30 +00:00
if (!this.disableTextureUpload & & this.dirty)
2013-11-28 15:57:09 +00:00
{
2014-10-22 20:49:44 +00:00
this.baseTexture.dirty();
2014-03-24 12:41:45 +00:00
this.dirty = false;
2013-11-28 15:57:09 +00:00
}
2014-09-09 14:36:56 +00:00
return this;
},
2015-08-24 14:43:45 +00:00
/**
* Destroys this BitmapData and puts the canvas it was using back into the canvas pool for re-use.
*
* @method Phaser.BitmapData#destroy
*/
destroy: function () {
PIXI.CanvasPool.remove(this);
},
2014-09-09 14:36:56 +00:00
/**
* Resets the blend mode (effectively sets it to 'source-over')
*
* @method Phaser.BitmapData#blendReset
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendReset: function () {
2015-08-24 14:43:45 +00:00
this.op = 'source-over';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'source-over'
*
* @method Phaser.BitmapData#blendSourceOver
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendSourceOver: function () {
2015-08-24 14:43:45 +00:00
this.op = 'source-over';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'source-in'
*
* @method Phaser.BitmapData#blendSourceIn
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendSourceIn: function () {
2015-08-24 14:43:45 +00:00
this.op = 'source-in';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'source-out'
*
* @method Phaser.BitmapData#blendSourceOut
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendSourceOut: function () {
2015-08-24 14:43:45 +00:00
this.op = 'source-out';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'source-atop'
*
* @method Phaser.BitmapData#blendSourceAtop
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendSourceAtop: function () {
2015-08-24 14:43:45 +00:00
this.op = 'source-atop';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'destination-over'
*
* @method Phaser.BitmapData#blendDestinationOver
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendDestinationOver: function () {
2015-08-24 14:43:45 +00:00
this.op = 'destination-over';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'destination-in'
*
* @method Phaser.BitmapData#blendDestinationIn
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendDestinationIn: function () {
2015-08-24 14:43:45 +00:00
this.op = 'destination-in';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'destination-out'
*
* @method Phaser.BitmapData#blendDestinationOut
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendDestinationOut: function () {
2015-08-24 14:43:45 +00:00
this.op = 'destination-out';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'destination-atop'
*
* @method Phaser.BitmapData#blendDestinationAtop
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendDestinationAtop: function () {
2015-08-24 14:43:45 +00:00
this.op = 'destination-atop';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'xor'
*
* @method Phaser.BitmapData#blendXor
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendXor: function () {
2015-08-24 14:43:45 +00:00
this.op = 'xor';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'lighter'
*
* @method Phaser.BitmapData#blendAdd
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendAdd: function () {
2015-08-24 14:43:45 +00:00
this.op = 'lighter';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'multiply'
*
* @method Phaser.BitmapData#blendMultiply
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendMultiply: function () {
2015-08-24 14:43:45 +00:00
this.op = 'multiply';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'screen'
*
* @method Phaser.BitmapData#blendScreen
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendScreen: function () {
2015-08-24 14:43:45 +00:00
this.op = 'screen';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'overlay'
*
* @method Phaser.BitmapData#blendOverlay
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendOverlay: function () {
2015-08-24 14:43:45 +00:00
this.op = 'overlay';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'darken'
*
* @method Phaser.BitmapData#blendDarken
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendDarken: function () {
2015-08-24 14:43:45 +00:00
this.op = 'darken';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'lighten'
*
* @method Phaser.BitmapData#blendLighten
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendLighten: function () {
2015-08-24 14:43:45 +00:00
this.op = 'lighten';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'color-dodge'
*
* @method Phaser.BitmapData#blendColorDodge
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendColorDodge: function () {
2015-08-24 14:43:45 +00:00
this.op = 'color-dodge';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'color-burn'
*
* @method Phaser.BitmapData#blendColorBurn
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendColorBurn: function () {
2015-08-24 14:43:45 +00:00
this.op = 'color-burn';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'hard-light'
*
* @method Phaser.BitmapData#blendHardLight
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendHardLight: function () {
2015-08-24 14:43:45 +00:00
this.op = 'hard-light';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'soft-light'
*
* @method Phaser.BitmapData#blendSoftLight
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendSoftLight: function () {
2015-08-24 14:43:45 +00:00
this.op = 'soft-light';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'difference'
*
* @method Phaser.BitmapData#blendDifference
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendDifference: function () {
2015-08-24 14:43:45 +00:00
this.op = 'difference';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'exclusion'
*
* @method Phaser.BitmapData#blendExclusion
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendExclusion: function () {
2015-08-24 14:43:45 +00:00
this.op = 'exclusion';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'hue'
*
* @method Phaser.BitmapData#blendHue
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendHue: function () {
2015-08-24 14:43:45 +00:00
this.op = 'hue';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'saturation'
*
* @method Phaser.BitmapData#blendSaturation
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendSaturation: function () {
2015-08-24 14:43:45 +00:00
this.op = 'saturation';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'color'
*
* @method Phaser.BitmapData#blendColor
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendColor: function () {
2015-08-24 14:43:45 +00:00
this.op = 'color';
2014-09-09 14:36:56 +00:00
return this;
},
/**
* Sets the blend mode to 'luminosity'
*
* @method Phaser.BitmapData#blendLuminosity
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
blendLuminosity: function () {
2015-08-24 14:43:45 +00:00
this.op = 'luminosity';
2014-09-09 14:36:56 +00:00
return this;
2013-11-28 15:57:09 +00:00
}
2014-02-05 06:29:17 +00:00
};
2014-09-09 14:36:56 +00:00
/**
2015-03-23 23:46:30 +00:00
* @memberof Phaser.BitmapData
2014-09-09 14:36:56 +00:00
* @property {boolean} smoothed - Gets or sets this BitmapData.contexts smoothing enabled value.
*/
Object.defineProperty(Phaser.BitmapData.prototype, "smoothed", {
get: function () {
Phaser.Canvas.getSmoothingEnabled(this.context);
},
set: function (value) {
Phaser.Canvas.setSmoothingEnabled(this.context, value);
}
});
2015-08-24 14:43:45 +00:00
/**
* @memberof Phaser.BitmapData
* @property {string} op - A short-hand code to get or set the global composite operation of the BitmapDatas canvas.
*/
Object.defineProperty(Phaser.BitmapData.prototype, "op", {
get: function () {
return this.context.globalCompositeOperation;
},
set: function (value) {
this.context.globalCompositeOperation = value;
}
});
2014-09-09 14:36:56 +00:00
/**
* Gets a JavaScript object that has 6 properties set that are used by BitmapData in a transform.
*
* @method Phaser.BitmapData.getTransform
* @param {number} translateX - The x translate value.
* @param {number} translateY - The y translate value.
* @param {number} scaleX - The scale x value.
* @param {number} scaleY - The scale y value.
* @param {number} skewX - The skew x value.
* @param {number} skewY - The skew y value.
2014-12-03 10:39:11 +00:00
* @return {object} A JavaScript object containing all of the properties BitmapData needs for transforms.
2014-09-09 14:36:56 +00:00
*/
Phaser.BitmapData.getTransform = function (translateX, translateY, scaleX, scaleY, skewX, skewY) {
if (typeof translateX !== 'number') { translateX = 0; }
if (typeof translateY !== 'number') { translateY = 0; }
if (typeof scaleX !== 'number') { scaleX = 1; }
if (typeof scaleY !== 'number') { scaleY = 1; }
if (typeof skewX !== 'number') { skewX = 0; }
if (typeof skewY !== 'number') { skewY = 0; }
return { sx: scaleX, sy: scaleY, scaleX: scaleX, scaleY: scaleY, skewX: skewX, skewY: skewY, translateX: translateX, translateY: translateY, tx: translateX, ty: translateY };
};
2014-02-05 06:29:17 +00:00
Phaser.BitmapData.prototype.constructor = Phaser.BitmapData;
2013-11-28 15:57:09 +00:00
< / pre >
< / article >
< / section >
< / div >
< div class = "clearfix" > < / div >
< footer >
< span class = "copyright" >
2015-03-23 23:46:30 +00:00
Phaser Copyright © 2012-2015 Photon Storm Ltd.
2013-11-28 15:57:09 +00:00
< / span >
< br / >
< span class = "jsdoc-message" >
2015-08-24 14:43:45 +00:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.3.2< / a >
2015-10-15 11:06:38 +00:00
on Thu Oct 15 2015 12:04:56 GMT+0100 (GMT Daylight Time) using the < a href = "https://github.com/terryweiss/docstrap" > DocStrap template< / a > .
2013-11-28 15:57:09 +00:00
< / span >
< / footer >
< / div >
< br clear = "both" >
< / div >
< / div >
< script src = "scripts/sunlight.js" > < / script >
< script src = "scripts/sunlight.javascript.js" > < / script >
< script src = "scripts/sunlight-plugin.doclinks.js" > < / script >
< script src = "scripts/sunlight-plugin.linenumbers.js" > < / script >
< script src = "scripts/sunlight-plugin.menu.js" > < / script >
< script src = "scripts/jquery.min.js" > < / script >
< script src = "scripts/jquery.scrollTo.js" > < / script >
< script src = "scripts/jquery.localScroll.js" > < / script >
< script src = "scripts/bootstrap-dropdown.js" > < / script >
< script src = "scripts/toc.js" > < / script >
< script > Sunlight . highlightAll ( { lineNumbers : true , showMenu : true , enableDoclinks : true } ) ; < / script >
< script >
$( function () {
$( "#toc" ).toc( {
2014-04-10 22:13:43 +00:00
anchorName : function(i, heading, prefix) {
2014-03-14 06:36:05 +00:00
return $(heading).attr("id") || ( prefix + i );
},
2013-11-28 15:57:09 +00:00
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
< / script >
< / body >
< / html >