Re: Display grayscale image

2007-08-31 Thread Jim George
On 8/30/07, Marco Brambilla [EMAIL PROTECTED] wrote:
 Hello everybody,

 Firs of all I'm a newbye both to GTK and to this mailing list, so I apologize 
 for the triviality of the post.
 I'm writing a very simple application (language: C) which should grab frames 
 from a ccd camera and show them on the screen.
 The ccd images are stored as a 1D array of unsigned char, single channel 
 grayscale images.
 Looking around inside the API docs, I tried to use something like:

 pixbuf = gtk_pixbuf_new_from_data(.);
 image = gtk_image_new_from_pixbuf(pixbuf);

 The problem is that this way, the displayed image is messed up, since (for 
 what I understand) gtk_pixbuf_new_from_data needs
 the three RGB channels.
 Is there a easy way of displaying such an image as is (single channel) ? Or 
 must I convert it each pixel to
 the a RGB triplet needed by gtk_pixbuf_new_from_data ?
 Any advice is very welcome.

 Thanks in advance to everybody.

 Marco

You could possibly use gdk_image, but it's easier to use a pixbuf and
just copy the grayscale value thrice into R, G and B. Remember to use
the rowstride, and not the width of the image when creating a pointer
to go from one row to the next.

-Jim
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Display grayscale image

2007-08-31 Thread jcupitt
On 8/31/07, Jim George [EMAIL PROTECTED] wrote:
 On 8/30/07, Marco Brambilla [EMAIL PROTECTED] wrote:
  Is there a easy way of displaying such an image as is (single channel) ? 
  Or must I convert it each pixel to
  the a RGB triplet needed by gtk_pixbuf_new_from_data ?

 You could possibly use gdk_image, but it's easier to use a pixbuf and
 just copy the grayscale value thrice into R, G and B. Remember to use

Another option (though a little harder) is to make a GtkDrawingArea,
connect to the expose signal, and use gdk_draw_gray_image() to paint
the damaged area from your stored 1-channel image. It ought to be
quite a bit faster.

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


libglade problems under win32

2007-08-31 Thread carlo
Hello all,

now that Glade-3 has entered into Debian testing repositories, it's time
for me to abandon the (long time) deprecated code generation and
definetely switch over to libglade.

The porting of application on which I'm currently working has been quite
straightforward under Linux; problems are arising when trying to run the
app - built with MSVC - under WinXP.

In more detail, I have at run time the following warnings:

1. a lot of: libglade-WARNING **: unknown widget class ...
2. a lot of: libglade-WARNING **: could not find signal handler ...


I have already managed to solve the signal handler warning under Linux,
by means of -export-dynamic linker flags, but I have no idea on how to
solve above issues under win32.

Any clue?

TIA,
Carlo
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How to convert a jpg image to a GtkImage ?

2007-08-31 Thread Gregory Hosler
Hi all,

I have an application, that amoung other things, is receiving a jpg file
from a network connection. Once that file is in memory (it's relatively
small), I wish to load it into a GtkImage (so that I can display it,
e.g. by adding the GtkImage to a vbox, or something like that).

I've been thru the Dev Help pages, and I have some questions:

1) If the image were in an actual file, I could load it e.g. with
   gtk_image_new_from_file(). It's not intuitive to me which
   function to use to load my in memory file into a GtkImage,
   and I am reluctant to save the image to a file, just to load it,
   and then delete the file...

2) I'm seeing the following fnctions, and, well, I'm confused.

I see GtkImage  the related gtk_image functions.
I see GdkPixbuf  the related gdk_pixbuf functions.
I see GtkPixmap  the related gtk_pixmap functions.

   When do I use which ?

(and in order to display my jpg image in a v/h-box, is GtkImage really
the proper widget to use ?)

Many thanks in advance,

-Greg

-- 
+-+

Please also check the log file at /dev/null for additional information.
(from /var/log/Xorg.setup.log)

| Greg Hosler   [EMAIL PROTECTED]|
+-+

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: libglade problems under win32

2007-08-31 Thread Eduardo M KALINOWSKI
carlo wrote:
 Hello all,

 now that Glade-3 has entered into Debian testing repositories, it's time
 for me to abandon the (long time) deprecated code generation and
 definetely switch over to libglade.

 The porting of application on which I'm currently working has been quite
 straightforward under Linux; problems are arising when trying to run the
 app - built with MSVC - under WinXP.

 In more detail, I have at run time the following warnings:

 1. a lot of: libglade-WARNING **: unknown widget class ...
 2. a lot of: libglade-WARNING **: could not find signal handler ...


 I have already managed to solve the signal handler warning under Linux,
 by means of -export-dynamic linker flags, but I have no idea on how to
 solve above issues under win32.
   

You need -export-dynamic, but you should also mark the signal function
prototypes with G_MODULE_EXPORT:

G_MODULE_EXPORT gboolean exit_cb(GtkWidget *widget, GdkEvent *event,
gpointer data);

Oh, yes, Windows sucks.

-- 
It's God.  No, not Richard Stallman, or Linus Torvalds, but God.
(By Matt Welsh)

Eduardo M KALINOWSKI
[EMAIL PROTECTED]
http://move.to/hpkb


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How to compile and link GTK2 Programms tobe compatibe with XFree86 and Xorg

2007-08-31 Thread [EMAIL PROTECTED]
Hello
I changed my developping system now the system openSuse uses
  Xorg  the old system used XFree86
Installed gtk 2.8 or

Building the exexutable now libraries from Xorg are included
like libXfixes.so.3 org
LivXinarema.so.1 or
libglitz.so.1

the executeable does not run under systems using XFree86
because auf missing lib.

Is there a compiler or linker switch to tell only to use
compatible calls. In simple examples like Hello World
the libXfixes.so.3 is not include this example runs under XFree86.

For linking I have to set -lgtk-x11-2.0 without all
gtk calls are refrenced as undefined symbols in linking.

Or may be I have to build my own gtk,gdk,glib,cairo,pango,atk
libs with special settings?

I hope there will be a possibility to build gtk programms
under newer Distibutions also runable under older Distributions.

Installing firefox under the older Distributions makes no problems
and i guess this is gtk applikation too.

Who knows about.
Thanks for help.




mfg
g.rapp

-- 
R=I+S  Rapp Informatik Systeme GmbH
   Rosenbühlstr. 24
   D-89182 Bernstadt
   Tel:  +49 (0)7348-7755
   Fax:  +49 (0)7348-6086
E-MAIL  mailto: [EMAIL PROTECTED]
WEB www.rapp-informatik.de

PS:
Senden Sie mir bitte keine Anhänge in Microsoft (.DOC, .PPT) Format
Bitte lesen Sie  http://www.fsf.org/philosophy/no-word-attachmentsi.de.html
Please don't send me any attachment in Microsoft (.DOC, .PPT) format please
Read http://www.fsf.org/philosophy/no-word-attachments.html




___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Simple question - accelerator keys

2007-08-31 Thread Stefan Kost
Hi,

I am currently trying to figure out something simillar. Unfortunately it seems
that accelerators are only used for menues in most applications. If you check
gnome-bugzilla - it has several open bugs for accelerators. I recently fixed one
and right now prepared a test program for another. Lets try to track those down
and propose fixes.

Stefan

Tomasz Sałaciński wrote:
 Hi there,
 
 Is there a possibility to simply bind a window-global accelerator key to
 a callback function? I am writing a GTK+ media player and I want to bind
 Left and Right arrow keys to seek media and F key to toggle fullscreen.
 I know that I can use gtk_widget_add_accelerator(), but then I have to
 create a new signal, which is, let's say, not so easy for me:)
 
 Cheers,
 Tom
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

How to detect display speed in custom widget?

2007-08-31 Thread Daniel Yek
Hi,

I'm wondering if anybody is experienced in writing smart widget that 
would react differently depending on whether the current display is 
local/fast for graphics animation or remote/slow where all animation 
should be kept to the minimum?

What techniques are suitable for drawing speed detection?

Thanks.

-- 
Daniel.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to compile and link GTK2 Programms tobe compatibe with XFree86 and Xorg

2007-08-31 Thread Daniel Yek
David Nečas (Yeti) wrote:
 On Fri, Aug 31, 2007 at 10:21:52PM +0200, [EMAIL PROTECTED] wrote:
   
 I changed my developping system now the system openSuse uses
   Xorg  the old system used XFree86
 Installed gtk 2.8 or

 Building the exexutable now libraries from Xorg are included
 like libXfixes.so.3 org
 LivXinarema.so.1 or
 libglitz.so.1

 the executeable does not run under systems using XFree86
 because auf missing lib.
 snip
 I hope there will be a possibility to build gtk programms
 under newer Distibutions also runable under older Distributions.
 

You are looking for LSB (which is probably not perfect, but it could be 
as good as you can get -- in my opinion, anyway):
http://www.linux-foundation.org/en/LSB

https://lists.linux-foundation.org/pipermail/lsb-discuss/.

-- 
Daniel Yek.
 Installing firefox under the older Distributions makes no problems
 and i guess this is gtk applikation too.
 

 Mozilla builds with old libraries, IIRC they build on
 something as ancient as RedHat 8.  To produce executables
 that run with library version X or newer build with library
 version X (assuming backward compatibility) -- to ensure
 your program actually works with version X, you need to
 build and test it with this version anyway (can be done for
 instance on a virtual machine).  The other possibility is to
 dlopen everything -- generally fragile. The third
 possibility is to bundle the libraries -- probably not an
 option with X.

 Yeti

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: How to convert a jpg image to a GtkImage ?

2007-08-31 Thread Mike Melanson
Gregory Hosler wrote:
 Hi all,
 
 I have an application, that amoung other things, is receiving a jpg file
 from a network connection. Once that file is in memory (it's relatively
 small), I wish to load it into a GtkImage (so that I can display it,
 e.g. by adding the GtkImage to a vbox, or something like that).
 
 I've been thru the Dev Help pages, and I have some questions:
 
 1) If the image were in an actual file, I could load it e.g. with
gtk_image_new_from_file(). It's not intuitive to me which
function to use to load my in memory file into a GtkImage,
and I am reluctant to save the image to a file, just to load it,
and then delete the file...
 
 2) I'm seeing the following fnctions, and, well, I'm confused.
 
   I see GtkImage  the related gtk_image functions.
   I see GdkPixbuf  the related gdk_pixbuf functions.
   I see GtkPixmap  the related gtk_pixmap functions.
 
When do I use which ?
 
 (and in order to display my jpg image in a v/h-box, is GtkImage really
 the proper widget to use ?)

My first impulse is that you will need to drag libjpeg into this (pretty
standard everywhere) and delegate image decoding over to that module.
Then create a new image in memory with gdk_image_new() and copy the
decoded RGB data over.

-- 
-Mike Melanson
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to convert a jpg image to a GtkImage ?

2007-08-31 Thread Yeti
On Fri, Aug 31, 2007 at 02:11:15PM -0700, Mike Melanson wrote:
  
  I have an application, that amoung other things, is receiving a jpg file
  from a network connection. Once that file is in memory (it's relatively
  small), I wish to load it into a GtkImage (so that I can display it,
  e.g. by adding the GtkImage to a vbox, or something like that).
  
  ...
 
 My first impulse is that you will need to drag libjpeg into this (pretty
 standard everywhere) and delegate image decoding over to that module.
 Then create a new image in memory with gdk_image_new() and copy the
 decoded RGB data over.

No, explicit use of libjpeg is not necessary.  Create a
GdkPixbufLoader, feed the in-memory image date to it with
gdk_pixbuf_loader_write() and if everything is all right
fetch the GdkPixbuf from it.  Then construct the GtkImage
with gtk_image_new_from_pixbuf().

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list