GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Solved] Problem with gdk_image_get_pixel()

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
croco



Joined: 04 Jan 2008
Posts: 4

PostPosted: Fri Jan 04, 2008 7:50 am    Post subject: [Solved] Problem with gdk_image_get_pixel() Reply with quote

Sorry, Murphy didn't change in 2008. 2 hours tracked for a bug, nothing found, posted the problem, 2 minutes later the bug was found ... I referred to a pixmap, not the image.

Anyway: What means this g_assert_not_reached incident in general? Has anybody an idea?

cu

Croco

-----------------------------------------------

Hi folks!

Glib 2.12, GTK 2.10 for Windows:

I'm quite new to GTK and about to work with 2D graphics in drawing areas. I have some trouble to readout single pixmap pixels (and to set their color as well). Hence I couldn't find some method to do this directly on pixmaps, I convert the pixmaps to images in order to use gdk_image_get_pixel() afterwards as it is described in an example code here in the forum. Unfortunatly GDK replies my effort with a strange message:

"Gdk-Error **: file gdkimage-win32.c: line 317 (gdk_image_get_pixel): should not be reached
aborting..."

Here the code:

Code: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Function omagtk_pixmap_getpixel(obj as tomagtk_pixmap ptr, x as integer, y as integer) as guint32

  dim as GdkImage ptr img
  dim as guint32 retval

  img=gdk_drawable_get_image(obj->pix,0,0,obj->nx,obj->ny)
  if (obj->pix=NULL) then brkmess("Error in omagtk_pixmap_getpixel(): pixmap not initialized")
  if (x<0 or x>obj->nx-1 or y<0 or y>obj->nx-1) then brkmess("Error in omagtk_pixmap_getpixel(): coordinates boundary error")
  retval= gdk_image_get_pixel(obj->pix, x , y )
  Function=retval

End Function


Has anybody an idea what's going wrong here? Thank you very much in advance!

Croco
Back to top
rdo
Familiar Face


Joined: 11 Dec 2007
Posts: 10
Location: Burleson, TX

PostPosted: Fri Jan 04, 2008 10:39 pm    Post subject: Reply with quote

Hi! You marked this as solved but I found some info on "g_assert_not_reached()"

From http://developer.gnome.org/doc/GGAD/cha-glib.html
g_assert_not_reached() should be used to mark "impossible" situations...

Also, what programming language is that? It looks like some form of basic.

Good luck.
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 505
Location: Portland, OR USA

PostPosted: Sat Jan 05, 2008 12:15 am    Post subject: Reply with quote

Oh that does look like Basic.... is there a basic wrapper for GTK I'm not aware of?
Back to top
croco



Joined: 04 Jan 2008
Posts: 4

PostPosted: Sat Jan 05, 2008 1:47 pm    Post subject: Reply with quote

It's Freebasic:
http://www.freebasic.net

Originally some kind of 32-bit successor of good old QuickBasic, it works on Linux as well and has now roughly the capabilities of C and there are binding for some dozen of libs like OpenGL, Newton, SDL, MySQL, Allegro, Lua, GTK and many more.

Cu

Croco
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP