Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Draw a bitmap with full screen by OpenVG: (4 Items)
   
Draw a bitmap with full screen by OpenVG  
Hi!Everyone!
I want to draw bitmap that with full screen by EGL and OpenVG.
step 1.eglGetDisplay
       2.eglInitialize
       3.eglChooseConfig
       4.create a window by OpenKode
       5.eglCreateWindowSurface
       6.eglCreateContext
       7.eglMakeCurrent
       8.vgCreateImage
       9.vgImageSubData
       10.vgSetPixels
       11.eglSwapBuffers

The size of data source :480*270
display resolution:640*480
The step of draw bitmap is correct?

I think of the process of drawing a bitmap with full screen that is :
       1.gf_dev_attach 
       2.eglGetDisplay
       3.eglInitialize
       4.eglChooseConfig
       5.create a window by OpenKode
       6.gf_3d_query_config
       7.gf_surface_create
       8.eglCreatePixmapSurface  
       9.eglCreateContext
       10.eglMakeCurrent
       11.vgCreateImage
       12.vgImageSubData
       13.vgSetPixels
       14.eglCopyBuffers
I cann't sure of the process is correct.
I don't know about between the window surface(by eglCreateWindowSurface) and the pixmap surface(by 
eglCreatePixmapSurface) difference.

What suggestion is about this?
Thank you very much!

 
  
RE: Draw a bitmap with full screen by OpenVG  
Hi,
	In the OpenVG scenario, the vgImageSubData call will put your bitmap data into the vgImage.  vgSetPixels can be used to
 put the Image pixels onto the drawing surface, but you can also use vgDrawImage to get an equivalent effect (and / or 
apply a transformation), depending on your needs.

	Also, don't forget to call eglBindAPI in your initial steps (right after eglInitialize is a good place for this).

	In the second scenario, I'm not quite sure what you are trying to achieve.  If the intent is to read the pixels from 
the surface, you can use vgReadPixels.  Furthermore, eglCopyBuffers isn't currently implemented and will always return 
EGL_FALSE, so it wouldn't be an option for now.

Cheers,
Gaétan

-----Original Message-----
From: hu xiaohua [mailto:community-noreply@qnx.com] 
Sent: June 21, 2009 10:49 PM
To: openvg-graphicsra
Subject: Draw a bitmap with full screen by OpenVG

Hi!Everyone!
I want to draw bitmap that with full screen by EGL and OpenVG.
step 1.eglGetDisplay
       2.eglInitialize
       3.eglChooseConfig
       4.create a window by OpenKode
       5.eglCreateWindowSurface
       6.eglCreateContext
       7.eglMakeCurrent
       8.vgCreateImage
       9.vgImageSubData
       10.vgSetPixels
       11.eglSwapBuffers

The size of data source :480*270
display resolution:640*480
The step of draw bitmap is correct?

I think of the process of drawing a bitmap with full screen that is :
       1.gf_dev_attach 
       2.eglGetDisplay
       3.eglInitialize
       4.eglChooseConfig
       5.create a window by OpenKode
       6.gf_3d_query_config
       7.gf_surface_create
       8.eglCreatePixmapSurface  
       9.eglCreateContext
       10.eglMakeCurrent
       11.vgCreateImage
       12.vgImageSubData
       13.vgSetPixels
       14.eglCopyBuffers
I cann't sure of the process is correct.
I don't know about between the window surface(by eglCreateWindowSurface) and the pixmap surface(by 
eglCreatePixmapSurface) difference.

What suggestion is about this?
Thank you very much!

 
  

_______________________________________________
OpenVG
http://community.qnx.com/sf/go/post32183
Re: RE: Draw a bitmap with full screen by OpenVG  
I'm very sorry that don't write my intent.
I want to draw a bitmap on the display .
But the size of bitmap data is 480*272,the resolution of my screen is 640*480.
I don't know how to  achieve.
Thank you very much!
RE: Draw a bitmap with full screen by OpenVG  
Hi,
	You can create a VGImage with size 480x272, and then copy your bits over to it using vgImageSubData.  Then set the 
VG_MATRIX_IMAGE_USER_TO_SURFACE matrix, and use vgScale to scale it using vgScale(640/480, 480/272).  Then use 
vgDrawImage to put the pixels on the surface.  So, just to recap the VG steps (you still need to create a surface and 
initialize EGL...):

1- vgCreateImage
2- vgImageSubData
3- vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE)
4- vgDrawImage

	You may also want to change VG_IMAGE_MODE (through vgSeti), depending on the effect you want to achieve.

	Note also that this will stretch your image, and the aspect ratio won't be preserved.  If you want to keep the AR, then
 simply use the same scale  in the x & y direction, and use vgTranslate to center the image accordingly.

Cheers,
Gaétan

-----Original Message-----
From: hu xiaohua [mailto:community-noreply@qnx.com] 
Sent: June 22, 2009 9:50 AM
To: openvg-graphics
Subject: Re: RE: Draw a bitmap with full screen by OpenVG

I'm very sorry that don't write my intent.
I want to draw a bitmap on the display .
But the size of bitmap data is 480*272,the resolution of my screen is 640*480.
I don't know how to  achieve.
Thank you very much!

_______________________________________________
OpenVG
http://community.qnx.com/sf/go/post32216