Stacking multiple bitmaps set transparency to black - actionscript-3

I've been trying to figure it out but can't find the right way to do this.
I render a swc file to get a Bitmap, it's a simple circle. It works fine, but when I stack multiple instances of this Bitmap (~50 instances), I can see transparency being replaced by solid black. It's on a particle system, so I tried it with a simple loop stacking multiple transparent images, and I have the exact same issue. Is there any workaround?
Thanks!

Related

as3 Clearing all colors but one

I am creating a vector drawing painting app and I have created a button that clears all the graphics (drawings) on the canvas. So basically, I just want to use pure white to "erase" all the drawings. Now I know there's other methods, but using this method is very important for future purposes. Now I want to clear the board of all graphics but the color,white, is this possible?
I feel like the best way to do this is to have two graphics you draw in, one for white, and one for everything else, that way you only clear the one. Not sure what you mean exactly since if the board is white, and you can already erase with white, what you are trying to accomplish by not clearing the white. Anyways add some more details if my suggestion doesn't work for you problem.

Circle shaped texture libGdx

I've been searching for answer for about 2 hours now and I haven't found my desired answer. My question is, Is it possible, and how, to draw a circle-shaped texture, so that outside the circle, texture would be transparent, is it even possible?
Thanks in advance! This site has been a great help so far!
The easiest way is to open a program like Photoshop and make an image with an alpha-channel. That means: Start with a completely transparent image and draw a circle on it. Then save it as .png
You can then just load it in your game and render it using a SpriteBatch. It (or better your graphics card) knows how to handle the alphachannel and will keep everything but the circle completely invisible.
This way you do not have to manipulate any pixmaps at runtime and you are not limited to simple shapes like circles.
If the portion of the texture you want to see in the circle is not meant to change during execution, the easiest way is to open Photoshop, make what you want, export it as an image and then load it in a Texture or a Sprite object in your code.
But this can also be done at runtime, via OpenGL using a Stencil test. This is the only solution if the portion displayed in the circle will have to be alterable during execution.
pixmap use this link if u are using other than .png format for your images
Apart form it if you are using png images then just draw the cirlce. Outside the circle will remain transparent.

How to properly clear all images that were "blitted" onscreen using pygame?

I was wondering how does pygame.blit manages the images blitted on screen. When I blit an multiple images on the screen, I see that each image is stacked on top the previous one.
How do I clear all these images? Wouldn't(somehow) there be a big problem when there are LOTS of images stacking on top of each other on the screen? Currently, I'm just blitting a white bg or custom bg on the whole screen to "clear" the screen. So far no problems or anything since the app I am working on is very small.
When you blit an image to a surface, it basicly draws it on the surface. The location of the blitting or the object blitted is not saved and cannot be changed. It's like if you were painting the images onto a canvas. The new ones would go over the old ones and there would be no way to get rid of one image if it were colliding with another image.
The most common approach to solving this is to just completly clear the screen using surface.fill(), and redraw the images each frame.
To answer your question about if there woudl be problems when there are lots of images, no. The window will only be saved as each individual pixel being a certain color, much like a regular picture you would take a camera, so no matter how many objects you blit, the game will always take the same amount of time.
There are multiple approaches:
Clean the whole background, as you are doing.
If the computer keeps up with the fps, perhaps it's better to leave it like this.
Clean only the areas where you blitted objects (see pygame.sprite.RenderUpdates)
In your case, if you have many stacked objects, perhaps it's better to write your own solution, trying to find the union between colliding rectangles, to avoid reblitting the same background over and over.

AS3 : how can i use sprites with green background in flash

I noticed that many of the sprites on the internet has a solid color background and not transparent i am sure there is a reason behind that but what is it ?
like this one :
http://www.spriters-resource.com/gameboy_advance/gs2/sheet/47045
I can remove the bg using photoshop but if this was the purpose why people didn't save it as transparent png in the first place.
what is the easier way to use this sprites in flash it doesn't make sense to me to cut each one and put it in a separate frame i am sure there is an easier way.
Sprite sheets are not meant to be sliced up into different images before compilation. Rather, they are mainly used for a technique called blitting which involves copying the pixels from the spritesheet onto the display at runtime (traditionally done for a performance gain over the standard Flash display list rendering).
You can read up on blitting here: http://www.8bitrocket.com/2008/7/2/Tutorial-AS3-The-basics-of-tile-sheet-animation-or-blitting/
And on how to actually remove the background when blitting: http://active.tutsplus.com/tutorials/animation/blitting-with-as3-removing-a-bitmaps-background-color/

Fill HTML canvas excluding arbitrary (possibly overlapping) circles

Given an HTML canvas that has already been drawn to, what's the best way to shade the whole canvas except given circular regions? (in context: shadows except where are there light sources)
I was hoping it would be as simple as a rect() followed by subsequent arc()s, but AFAIK there's no way to "remove" those circular sections after the fact. I can get close ( http://jsfiddle.net/mW8D3/2/), but the overlapping regions of circles end up shaded (in XOR fashion, whereas I want OR). Using clip() has the same problem.
I've also tried using globalCompositeOperation but can't quite seem to achieve what I want.
Any ideas?
You could first create the shadow image on a second canvas and knock out holes from it with globalCompositeOperation 'copy' and a transparent fillStyle.
Like this: http://jsfiddle.net/mW8D3/4/