Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to use devg-flat in gf_dev_attach?: (6 Items)
   
How to use devg-flat in gf_dev_attach?  
I am trying to read a .png file, modify it and write a back to the file system.  In order to do that, my understanding 
is, that I need to use both gf and img libraries.  I don't want to use any specific HW to attach to as I don't need to 
display my .png file.  All I want to do is to be able to create surface so that I can modify my .png file.

In order to create a surface, I need to first attach to a device.  My understanding is that I can use devg-flat as a 
device.  However I am not sure, how to install devg-flat driver and related files into my IDE and target.  I also don't 
know how to use devg-flat in the call gf_dev_attach() call?  I have already added libffb.so to extra libraries section 
of IDE.

I appreciate it if anyone can give me some pointers on this.

Regards,

Reza.
Re: How to use devg-flat in gf_dev_attach?  
If you just want to encode/decode image data you don't need GF. You can either pass or get a pointer to the img data by 
just using libimg.
Re: How to use devg-flat in gf_dev_attach?  
Thanks Joel.  But, my understanding was that in order to modify the image data, I will have to first attach it to a gf 
surface, modify it, and then save it.  Just so I understand, if I only need need to modify a .png file (not display it),
 I don't need to use gf at all?  In other words, I don't need to attach and great a gf surface at all?  Basically, below
 is what I am trying to do:
1.  Read a .png file from the file system (i.e. /tmp/test.png)
2.  Modify this file with some algorithm to draw an ellipse
3.  Same the result from #2 as /tmp/new_image.png

Thanks,

Reza.
RE: How to use devg-flat in gf_dev_attach?  
Do you want to modify the img data using gf rendering or just via a pointer in software? If you don't plan on using gf 
rendering, then there's no need for a gf surface.

-Joel

-----Original Message-----
From: Reza Salehi [mailto:community-noreply@qnx.com] 
Sent: May 24, 2011 3:02 PM
To: advanced-graphics
Subject: Re: How to use devg-flat in gf_dev_attach?

Thanks Joel.  But, my understanding was that in order to modify the image data, I will have to first attach it to a gf 
surface, modify it, and then save it.  Just so I understand, if I only need need to modify a .png file (not display it),
 I don't need to use gf at all?  In other words, I don't need to attach and great a gf surface at all?  Basically, below
 is what I am trying to do:
1.  Read a .png file from the file system (i.e. /tmp/test.png)
2.  Modify this file with some algorithm to draw an ellipse
3.  Same the result from #2 as /tmp/new_image.png

Thanks,

Reza.



_______________________________________________

Advanced Graphics
http://community.qnx.com/sf/go/post86093
Re: RE: How to use devg-flat in gf_dev_attach?  
Well, I think my problem is that I am not familiar enough with the graphic sub-systems of QNX to know what I want to do 
:).  Basically, I have some graphic artists that are providing me base .png files.   I need to draw an ellipse based on 
some dynamic data and save the result as another .png file.  So, whatever is the fastest to accomplish this would work 
for me.

I appreciate it if you have any suggestion or code snippet to help me get started.

Thanks,

Reza
Re: RE: How to use devg-flat in gf_dev_attach?  
Hi Joel,

I tried to use the direct pointer approach, but my system hangs.  Below is a code snipet where it hangs:
img_t	img_day;
if ((rc = img_lib_attach(&ilib)) != IMG_ERR_OK) {
			fprintf(stderr, "img_lib_attach() failed: %d\n", rc);
			return rc;
		}

img_day.flags = 0;
img_day.flags |= IMG_DIRECT;

// /tmp/stop.png is the location of the file on the target VM system
img_template_file_Day = "/tmp/stop.png";

// The code hangs after making the call below.  If I don't set the IMG_DIRECT flag, it works.
if ((rc = img_load_file(ilib, img_template_file_Day, NULL, &img_day)) != IMG_ERR_OK) {
fprintf(stderr, "img_load_file(%s) failed on Day Template: %d\n", img_template_file_Day, rc);
			// return rc;
		}