Erase a part of a bitmap

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Erase a part of a bitmap

Postby Thej0sepH » Tue Aug 25, 2009 7:20 pm

Hello people, i need to find the way to erase pixels from a bitmap using Canvas without dropping your FPS to 0.
I Tried to draw a circle using bitmap.setPixel(x,y,Color.Transparent)
But i get like 1 second lag after a little 50 pixels radius circle is erased from the bigger bitmap.
Have someone found any method?
By the way ive already tried to create a new Canvas(BitmapIneedtoErase) and use the .drawCircle method, it works with any color but no transparent.

This is the code im using right now.
Code: Select all
                   int c = 0;      
      int d = 0;
      float contanteAngulo = 360;
      float angulin = 0;   
               float piX = (float)(posX+mapa.getPosX());
               float piY = (float)(posY+mapa.getPosY());
               float pfX = (float)(piX+(tankcito.getBunge())*Math.cos(angulin/180*Math.PI));
               float pfY = (float)(piY+(tankcito.getBunge())*Math.sin(angulin/180*Math.PI));
                 float distanciaX = pfX - piX;
                 float distanciaY = pfY - piY;   
                 float cx = piX;
                 float cy = piY;
                     if(mapa.getSobremapa().getPixel((int)(cx-mapa.getPosX()),(int)(cy-mapa.getPosY()))==0 ){
                 c = c+1;

I really need to find a solution soon thank to everybody who tries to help.
Posts: 3
Joined: Thu Apr 02, 2009 5:47 am


Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest