Introduction to BitmapData


(Nicole Brauer) #1

Hey, I have a few questions.

Firstly

I’m looking for a good introduction / tutorial on how BitmapData works. In the past I have come across a few problems while coding games in which it might have come in use, but I just don’t know how it works and haven’t found any good introductions to it, I’m also particularly interested in how it works in conjunction with FlashPunk (How to I get my BitmapData to display as a fp graphic).

Some examples of what I wanted to do: Have a image file with a font alphabet and copy parts of it into another image to write text. / Calculating a “landscape” with curves and then drawing the pixels and filing the shape accordingly to generate a level graphic. / Manipulating position of parts of an image or parts of an images color channel. / Changing color values of a spritemap (Like coloring everything white except the alpha channel)

It seems like BitmapData would be the right thing for it, I just don’t know where to start.

Secondly

I also would like to know how to manipulate the final output / screen render image (I dont know the proper word for it :D) of FlashPunk. What I want to do is a make a glitchy effect that affects everything that is on the screen.

Thank you.


(rostok) #2

Just quick tip:

var b:BitmapData;
var i:Image = new Image(b); // Image extends Graphic

to access Image’s BitmapData use source() method. Currently it has protected access modifier. If you have a need to update it manually you can always change it to public or do it in some other way.

To understand how FP renders things it is best to watch call stack in debugger:

someEntity::render someWorld::render someEngine::render Engine::onEnterFrame

So if you want to add some special effects overriding your instances of render in someWorld or someEngine would be a good start. Also note that there is public static FP.buffer of BitmapData type that is updated with every screen update.

Note that this is kind of hard way as you can use punk.fx. Take a look at this Separation Anxiety's Visual Effects


(Zachary Lewis) #3

Here’s what Adobe has to say about BitmapData.


[SOLVED] Creating a circular meter with code?
(Nicole Brauer) #4

Thank you. I think this should get me started. : )


(azrafe7) #5

And maybe this could help you if you need to use a BitmapFont: BitmapFont and BitmapText classes.