RE: issue with snapshot capture and comparisons using gtk



> > Now when i am trying to do the same for a nautilus/eog window which
> > loads a png file ( any image file) and i do record and playback,
> > most of the times the result is a pass where as when i try to do
> > this comparison after resizing the nautilus/eog window which has a
> > png loaded, it always fails.
> 
> What seems to me to be the obvious first step is to figure out
> what the differences are between the two screenshots. Getting
> a visual diff between two images should be straightforward
> using the GIMP or the 'composite' tool from the ImageMagick
> package.

Oh!! there is no visual difference between the two snapshots ( they differ by few pixels for eg. for a pixel size of some 100,000 there are only 400 pixels difference). But this issue i could figure out and it was the problem with the comparison logic. I tried capturing the GdkImage in the two cases and saw that they were same where as the pixbuf comparisons were failing. The way i was doing the comparison was to take the rowstride value and use that to compare the pixels i.e
for ( i = 0; i < rowstride; i++ ) {
if ( basepixels[i] != newpixels[i])
...
}
which was wrong. I understood this by checking the code as to how the pixel values in pixbuf is filled from the gdkimage pixels.( rgbconvert code, in my case it got into rgb888msb())
I changed the logic to
( for i =0; i < (width *3); i++) { /* width*3 because the pixbuf is formed with 24-bit depth */
...
...
}
And then i move to the next row by incrementing using the rowstride value. ( i think thats correct but if you can second this, i will be more comfortable).
With this logic, as long as the GdkImage are same, the pixbuf comparisons work fine and i get better results during resize ( there are less failures now) 
But i have an issue with focused widgets still i.e if i try to 'highlight' the 'Open' window in eog ( moving my mouse cursor to the top of the 'Open' window) and i take the snapshots ( as described in the above process) I see that the gdkImage are also different ( and the snapshots also fail). I would like to know whether this is the correct behavior or why should the GdkImage differ when the window is highlighted? If this could be something wrong that i am doing, then i would like to rectify it to make the tool more reliable. If this is some inherent limitation ( Xserver issues, gtk issues etc.) then i can put it as 'tool limitation' and move forward.
regards
bharat

> 
> Regards,
>                                         Owen
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]