Re: Question about android graphics.

2009-04-14 Thread tom



On 3月31日, 下午5时27分, Dianne Hackborn hack...@android.com wrote:
 2009/3/31 waterblood guoyin.c...@gmail.com

  if so, the Layer must have information about its position in display.
  But I only see it is created as the code below:
 Layer* layer = new Layer(this, display, client, id);
 status_t err = layer-setBuffers(client, w, h, format, flags);

  so layer only knows the windows size w,h, and format. How it knows it
  is relative position in display?

 Well there are APIs to change the layer's values.  Just look at the Surface
 APIs to see them at the Java level.

refer to LayerBase::setPosition(x, y)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
android-framework group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~--~~~~--~~--~--~---



Re: Question about android graphics.

2009-03-31 Thread Dianne Hackborn
2009/3/31 waterblood guoyin.c...@gmail.com

 1. As a multi windows systems, each window whill hold two buffers
 (front buffer, back buffer in surface). Is all the buffer size
 determined by the windows size or the display pannel size? If its size
 is same as the window'size, whether surface will destroyed and
 recreated if we resize it?


It's the size of the window.  The buffer is resized when the window resizes;
the surface is not destroyed.


 2. How to control the z-order of Layer in surface? everytime a new
 Layer created, it will be added to the top in surfaceflinger. So if we
 want jump to another exist windows, how to updat the z-order of the
 former window, jump-to window?


Don't use surface flinger directly, use the window manager; it takes care of
Z-ordering.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
android-framework group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~--~~~~--~~--~--~---



Re: Question about android graphics.

2009-03-31 Thread waterblood



On 4月1日, 上午10时10分, Dianne Hackborn hack...@android.com wrote:
 2009/3/31 waterblood guoyin.c...@gmail.com

  1. As a multi windows systems, each window whill hold two buffers
  (front buffer, back buffer in surface). Is all the buffer size
  determined by the windows size or the display pannel size? If its size
  is same as the window'size, whether surface will destroyed and
  recreated if we resize it?

 It's the size of the window.  The buffer is resized when the window resizes;
 the surface is not destroyed.


if so, the Layer must have information about its position in display.
But I only see it is created as the code below:
Layer* layer = new Layer(this, display, client, id);
status_t err = layer-setBuffers(client, w, h, format, flags);

so layer only knows the windows size w,h, and format. How it knows it
is relative position in display?

  2. How to control the z-order of Layer in surface? everytime a new
  Layer created, it will be added to the top in surfaceflinger. So if we
  want jump to another exist windows, how to updat the z-order of the
  former window, jump-to window?

 Don't use surface flinger directly, use the window manager; it takes care of
 Z-ordering.

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
android-framework group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~--~~~~--~~--~--~---



Re: Question about android graphics.

2009-03-31 Thread Dianne Hackborn
2009/3/31 waterblood guoyin.c...@gmail.com

 if so, the Layer must have information about its position in display.
 But I only see it is created as the code below:
Layer* layer = new Layer(this, display, client, id);
status_t err = layer-setBuffers(client, w, h, format, flags);

 so layer only knows the windows size w,h, and format. How it knows it
 is relative position in display?


Well there are APIs to change the layer's values.  Just look at the Surface
APIs to see them at the Java level.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
android-framework group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~--~~~~--~~--~--~---



Question about android graphics.

2009-03-27 Thread waterblood

Hi All,

  I am tring to analyse the android graphics. After reading the source
in android, I still have no idea how it works. Here I list a few
questions. Any reply will be welcome.

1.  what is the relationship between ViewRoot and View class. As my
understanding, in each window, there is only one ViewRoot, even though
there are mutil View or ViewGroup shows in that window. The showing
route is started by WindowManagerService as below:
ViewRoot::handleAppVisibility()--ViewRoot::handleAppVisibility()--
ViewRoot::performTraversals()��--ViewRoot::draw()--view::draw()
In view::draw, it will draw its data to its canvas and dispatch draw
calling to its children's view.
Is all view ,its children's view and their viewRoot share the same
canvas for draw?


2. What is the relationship within View, canvas and Surface.  To my
thinking, every view will be attached a canvas and surface. And a
canvas hold the bitmap for view, will the actual view drawn data will
be in canvas' bitmap. After View draw its data to canvas, ViewRoot
will call surface.unlockCanvasAndPost(canvas) to schedule
surfaceFlinger::composeSurfaces() which do the actually display to
display panel.

Where is the drawn data in canvas transfer to surface front buffer or
backbuffer? I cannot find the code to do that.

Do different views within the same ViewRoot share the same surface?

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
android-framework group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~--~~~~--~~--~--~---



Re: Question about android graphics.

2009-03-27 Thread Romain Guy

 1.  what is the relationship between ViewRoot and View class.

The ViewRoot is the root of each view hierarchy. Like you said, there
is one ViewRoot per window. The ViewRoot is responsible to handling
the layout and drawing of the view hierarchy. The view hierarchy is
made of Views and ViewGroups. A ViewGroup is a special View that can
contain other Views.

 Is all view ,its children's view and their viewRoot share the same
 canvas for draw?

Yes, but that Canvas might change on every drawing operation. The
ViewRoot acquires a Canvas from the underlying Surface and hands that
Canvas to the top-level View.

 2. What is the relationship within View, canvas and Surface.  To my
 thinking, every view will be attached a canvas and surface.

No, the Views are not attached to the Canvas nor the Surface. The
window is tied to a Surface and the ViewRoot asks the Surface for a
Canvas that is then used by the Views to draw onto.

 canvas hold the bitmap for view, will the actual view drawn data will
 be in canvas' bitmap.

Yes.

 After View draw its data to canvas, ViewRoot
 will call surface.unlockCanvasAndPost(canvas) to schedule
 surfaceFlinger::composeSurfaces() which do the actually display to
 display panel.

Yes.

 Where is the drawn data in canvas transfer to surface front buffer or
 backbuffer? I cannot find the code to do that.

It's done by SurfaceFlinger.

 Do different views within the same ViewRoot share the same surface?

Yes, except for SurfaceViews.

-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
android-framework group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~--~~~~--~~--~--~---