Displaying certain parts of a bitmap

Problems with Canvas, OpenGL, etc...

Re: Displaying certain parts of a bitmap

Postby gskbyte » Mon Jun 07, 2010 11:19 pm

Ok, have a look at this ;).

Btw, BackgroundSurfaceThread needs a lot of cleanup, I just created it to test its performance.
Attachments
BackgroundSurfaceThread.java
(7.33 KiB) Downloaded 67 times
BackgroundSurfaceView.java
(2.33 KiB) Downloaded 68 times
gskbyte
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Tue Jan 12, 2010 1:51 pm

Top

Re: Displaying certain parts of a bitmap

Postby WWaldo » Tue Jun 08, 2010 7:21 pm

Alright, thanks, I got it to work almost to where I am done messing with it. The only thing I can't figure out now is how to make it so that it sets my down as an initial point, and if I move up or down or whatever from that point, it will go that direction until the screen is released or you move another direction. I messed around with making another update thing and it didn't do anything. Any ideas?
WWaldo
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Sun Feb 21, 2010 8:25 pm

Re: Displaying certain parts of a bitmap

Postby gskbyte » Tue Jun 08, 2010 7:33 pm

Just set bitmap rect's top=height-canvas_height and bottom = height.
gskbyte
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Tue Jan 12, 2010 1:51 pm

Re: Displaying certain parts of a bitmap

Postby WWaldo » Tue Jun 08, 2010 8:11 pm

I tried that, I am pretty sure it isn't working because there is no event going on so it isn't activating the onTouchEvent. I am assuming that is how it works the onTouchEvent works at least
WWaldo
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Sun Feb 21, 2010 8:25 pm

Re: Displaying certain parts of a bitmap

Postby gskbyte » Tue Jun 08, 2010 9:00 pm

Don't believe the emulator, it is slow as snail. If you want to test its performance, just do this in onDraw() method:


Code: Select all
   
    public void onDraw(Canvas canvas)
    {
        long t = System.curentTimeMillis();
        if(mCanvasHeight != canvas.getHeight())
            setCanvasSize(canvas.getWidth(), canvas.getHeight());
        canvas.drawBitmap(mBg, mOrgRect, mDstRect, mPaint);
        android.util.Log.e("DRAWTIME", System.curentTimeMillis()-t +"" );
    }


It will display draw times on logcat ;)
gskbyte
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Tue Jan 12, 2010 1:51 pm

Re: Displaying certain parts of a bitmap

Postby ringu » Sun Jun 20, 2010 10:58 am

Hey! I'am pretty interested in this code, but I can't make it working, could someone upload an Exported File from Ecpilse? That would be really nice! thanks!
ringu
Freshman
Freshman
 
Posts: 4
Joined: Sun Jun 20, 2010 10:55 am

Top

Re: Displaying certain parts of a bitmap

Postby gskbyte » Sun Jun 20, 2010 11:24 am

Here it is, I just created the Activity, it's quite simple...
Attachments
DrawingExample.zip
(603.06 KiB) Downloaded 76 times
gskbyte
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Tue Jan 12, 2010 1:51 pm

Top
Previous

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

Who is online

Users browsing this forum: No registered users and 5 guests