Is there any equivalent api to MIDP's graphics.copyArea()

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Is there any equivalent api to MIDP's graphics.copyArea()

Postby irobot » Tue Oct 07, 2008 2:52 pm

Hello,

I want to copy an area from the canvas. There is an api in midp - javax.microedition.lcdui.Graphics

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void copyArea(int x_src,
  2.  
  3.                      int y_src,
  4.  
  5.                      int width,
  6.  
  7.                      int height,
  8.  
  9.                      int x_dest,
  10.  
  11.                      int y_dest,
  12.  
  13.                      int anchor)
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Copies the contents of a rectangular area (x_src, y_src, width, height) to a destination area, whose anchor point identified by anchor is located at (x_dest, y_dest). The effect must be that the destination area contains an exact copy of the contents of the source area immediately prior to the invocation of this method. This result must occur even if the source and destination areas overlap.

For example, I want to copy a rectangular area oldx,oldy,oldw and oldh to new positions newx, newy one will write,

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  g.copyArea(oldx, oldy, oldw, oldh, newx, newx, g.TOP | g.LEFT);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Is there any equaivalent api for copyArea in android?

Thanks!
If at first you don't succeed, look in the trash for the instructions.
irobot
Freshman
Freshman
 
Posts: 5
Joined: Thu Mar 27, 2008 8:32 am
Location: Coimbatore, India

Top

Postby plusminus » Tue Oct 07, 2008 4:02 pm

If you have access to the Bitmap 'behind' the canvas, you could use the following:


static Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)
Returns an immutable bitmap from the specified subset of the source bitmap.


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby irobot » Fri Oct 10, 2008 3:24 pm

Thanks for your reply. Yes i can access to the canvas bitmap.


Also can you please look at this thread,
invoking_widgets_ondraw_from_custom_views_ondraw-t3020.html

I have my own view and in myview's onDraw() method i want to paint android widgets for example a edittext, textview or a progressbar.

Can i do it by just calling those widget's draw method which will invoke widget's onDraw() to draw the widget?

If i use a layout and add a progressbar in it and setcontentview of the layout then the same process will happen right? The implementation will call widget.draw() and that invoke widgets ondraw() method to draw the widget.

Thanks!
If at first you don't succeed, look in the trash for the instructions.
irobot
Freshman
Freshman
 
Posts: 5
Joined: Thu Mar 27, 2008 8:32 am
Location: Coimbatore, India

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 3 guests