Re.: GtkDrawingArea size request

2017-06-22 Thread Rúben Rodrigues
Solved.

Someone have a example of how to create a custom widget with cairo in C?
Thanks

 Mensagem original 
Assunto: Fwd: GtkDrawingArea size request
De: Rúben Rodrigues
Para: gtk-app-devel-list@gnome.org
CC:

Someone received my question?

Thanks


 Mensagem reencaminhada 
Assunto:GtkDrawingArea size request
Data:   Wed, 21 Jun 2017 10:08:15 +0100
De: Rúben Rodrigues 
Para:   gtk-app-devel-list@gnome.org 




Hi,

I create a drawing area to draw a circular gauge with cairo.

GtkWidget *drawing_area = gtk_drawing_area_new ();
gtk_widget_set_size_request (drawing_area, 100, 100);
gtk_box_pack_start (GTK_BOX(gtk_builder_get_object(builder,
"box30")),drawing_area,FALSE,TRUE,0);

The problem is that the drawing area is not 100x100 but the entire of
screen.

This is the callback function:



gboolean on_circular_gauge_draw(GtkWidget *widget, cairo_t *cr,
gpointer user_data)
{

  int width, height;
  gint percentage, linewidth;

  width = gtk_widget_get_allocated_width (widget);
  height = gtk_widget_get_allocated_height (widget);


  linewidth = (MIN (width, height) / 2.0 * 30.0) / 100.0;

  cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6);
  cairo_set_line_width (cr, linewidth);
  cairo_arc(cr, width/2.0, height/2.0,  MIN (width, height) / 2.0 -
linewidth, angle1, angle2);
  cairo_stroke (cr);

  cairo_set_source_rgba (cr, 0.0, 0.9, 0.0, 1.0);
  cairo_set_line_width (cr, linewidth);
  cairo_arc(cr, width/2.0, height/2.0, MIN (width, height) / 2.0  -
linewidth, 180.0  * (M_PI/180.0),315.0  * (M_PI/180.0) );
  cairo_stroke (cr);



  return FALSE;
}



[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]
  Sem vírus. 
www.avast.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkDrawingArea size request

2017-06-22 Thread Eric Cashon via gtk-app-devel-list

 
Hi Ruben, 

You might consider allowing the gauge to expand with the window size. This 
makes the gauge a lot more flexible. When drawing a gauge it is useful to get a 
general coordinate drawing on screen that you can check your gauge drawing 
with. Both cartesian coordinates and radial coordinates are useful to check 
your drawing. There is a general layout drawing in the following.

https://github.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/gears2.c

You can use set sizes if you want to also. To keep your drawing area window 
size a set size check your vexpand and hexpand properties. Make sure they are 
false. Try using a GtkGrid instead of a GtkBox. Put the drawing area in a 
scrolled window and put that in the grid.

I have done some work drawing gauges and have a couple packaged as widgets. 
There are also some drawings of clocks, gauges, gems and gears in the above 
github cairo_drawings folder. Some resize as circles and some as ellipses. They 
might be helpful getting something that you can test a gauge drawing with.

Eric

 


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


Re: GtkDrawingArea size

2012-03-08 Thread Tadej Borovšak
Hello.

2012/3/7 Christopher Howard christopher.how...@frigidcode.com:
 Hello again. So, I recently started a project to create a certain board
 game (in C) using gtk+, and I just started learning gtk+. I was planning
 to draw the board graphics, pieces, etc. all into one GtkDrawingArea.
 So, how do I fix the size of the drawing area so it doesn't get larger
 or smaller than my graphics?

I would add a wrapper GtkAlignment around my drawing area, set it's
xalign and yalign propertes to 0.5, it's xscale and yscale to 0, pack
GtkDrawingArea inside it and fix it's size using
gtk_window_set_size_request().

Have a look at this simple app:

#include gtk/gtk.h

#define WIDTH  300
#define HEIGHT 400

static gboolean
cb_draw (GtkWidget  *w,
 GdkEventExpose *e)
{
  cairo_t *cr = gdk_cairo_create (e-window);
  cairo_set_source_rgb (cr, 1.0, 1.0, 0.0);
  cairo_paint (cr);
  cairo_destroy (cr);

  return TRUE;
}

int
main (intargc,
  char **argv)
{
  GtkWidget *window,
*align,
*area;

  gtk_init (argc, argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, destroy, gtk_main_quit, NULL);

  align = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_container_add (GTK_CONTAINER (window), align);

  area = gtk_drawing_area_new ();
  gtk_widget_set_size_request (area, WIDTH, HEIGHT);
  g_signal_connect (area, expose-event, G_CALLBACK (cb_draw), NULL);
  gtk_container_add (GTK_CONTAINER (align), area);

  gtk_widget_show_all (window);

  gtk_main ();

  return 0;
}

Cheers,
Tadej

-- 
Tadej Borovšak
tadeboro.blogspot.com
tadeb...@gmail.com
tadej.borov...@gmail.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GtkDrawingArea size

2012-03-08 Thread Christopher Howard
On 03/08/2012 01:54 AM, Tadej Borovšak wrote:
 Hello.
 
 2012/3/7 Christopher Howard christopher.how...@frigidcode.com:
 Hello again. So, I recently started a project to create a certain board
 game (in C) using gtk+, and I just started learning gtk+. I was planning
 to draw the board graphics, pieces, etc. all into one GtkDrawingArea.
 So, how do I fix the size of the drawing area so it doesn't get larger
 or smaller than my graphics?
 
 I would add a wrapper GtkAlignment around my drawing area, set it's
 xalign and yalign propertes to 0.5, it's xscale and yscale to 0, pack
 GtkDrawingArea inside it and fix it's size using
 gtk_window_set_size_request().
 
 Have a look at this simple app:
 
 #include gtk/gtk.h
 
 #define WIDTH  300
 #define HEIGHT 400
 
 static gboolean
 cb_draw (GtkWidget  *w,
  GdkEventExpose *e)
 {
   cairo_t *cr = gdk_cairo_create (e-window);
   cairo_set_source_rgb (cr, 1.0, 1.0, 0.0);
   cairo_paint (cr);
   cairo_destroy (cr);
 
   return TRUE;
 }
 
 int
 main (intargc,
   char **argv)
 {
   GtkWidget *window,
 *align,
 *area;
 
   gtk_init (argc, argv);
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   g_signal_connect (window, destroy, gtk_main_quit, NULL);
 
   align = gtk_alignment_new (0.5, 0.5, 0, 0);
   gtk_container_add (GTK_CONTAINER (window), align);
 
   area = gtk_drawing_area_new ();
   gtk_widget_set_size_request (area, WIDTH, HEIGHT);
   g_signal_connect (area, expose-event, G_CALLBACK (cb_draw), NULL);
   gtk_container_add (GTK_CONTAINER (align), area);
 
   gtk_widget_show_all (window);
 
   gtk_main ();
 
   return 0;
 }
 
 Cheers,
 Tadej
 

Thanks for the help. Is there a way to turn off the small resizing
graphic that appears at the bottom right of the window? (It looks like
three small diagonal lines.) Even if this did not actually prevent
resizing it would make sense in my case not to have it showing.

-- 
frigidcode.com
indicium.us

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

Re: GtkDrawingArea size

2012-03-07 Thread Christopher Howard
On 03/06/2012 02:08 PM, Christopher Howard wrote:
 Hello again. So, I recently started a project to create a certain board
 game (in C) using gtk+, and I just started learning gtk+. I was planning
 to draw the board graphics, pieces, etc. all into one GtkDrawingArea.
 So, how do I fix the size of the drawing area so it doesn't get larger
 or smaller than my graphics?
 
 The alternative, I suppose, would be to scale everything against the
 actual size of the drawing area (cairo can resize bitmap images, no?)
 but presumably that would be a lot more complicated to code, and I would
 still need to constrain the proportions of width to height.
 
 
 
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Bump.

I'm trying to look through some other projects to see how this is done,
but I would appreciate it if anyone happens to know of the top of their
head.

-- 
frigidcode.com
indicium.us

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

Re: GtkDrawingArea size

2012-03-07 Thread Bernhard Schuster
If you did not yet start implementing it, goocanvas might be another
option to the bare stuff. goocanvas allows you to set a fixed paper
size.


Am 7. März 2012 19:44 schrieb Christopher Howard
christopher.how...@frigidcode.com:
 On 03/06/2012 02:08 PM, Christopher Howard wrote:
 Hello again. So, I recently started a project to create a certain board
 game (in C) using gtk+, and I just started learning gtk+. I was planning
 to draw the board graphics, pieces, etc. all into one GtkDrawingArea.
 So, how do I fix the size of the drawing area so it doesn't get larger
 or smaller than my graphics?

 The alternative, I suppose, would be to scale everything against the
 actual size of the drawing area (cairo can resize bitmap images, no?)
 but presumably that would be a lot more complicated to code, and I would
 still need to constrain the proportions of width to height.




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

 Bump.

 I'm trying to look through some other projects to see how this is done,
 but I would appreciate it if anyone happens to know of the top of their
 head.

 --
 frigidcode.com
 indicium.us


 ___
 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

Re: GtkDrawingArea size

2012-03-07 Thread Christopher Howard
On 03/07/2012 11:37 AM, Bernhard Schuster wrote:
 If you did not yet start implementing it, goocanvas might be another
 option to the bare stuff. goocanvas allows you to set a fixed paper
 size.
 
 

I think the halign and valign properties are what I was looking for. It
seems that, if I do an align center, that the widget never grows larger
than its requested size, though it still can shrink.

code:
--
gtk_widget_set_size_request (my_widget, 256, 256);

gtk_widget_set_halign(my_widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign(my_widget, GTK_ALIGN_CENTER);
--

-- 
frigidcode.com
indicium.us

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

Re: GtkDrawingArea size

2012-03-07 Thread Stefan Salewski
On Wed, 2012-03-07 at 09:44 -0900, Christopher Howard wrote:
X
 
 Bump.
 
 I'm trying to look through some other projects to see how this is done,
 but I would appreciate it if anyone happens to know of the top of their
 head.

I guess you can have a drawingarea of fixed size if you put it in a
container of fixed size, ie. make the window fixed size, see

http://developer.gnome.org/gtk3/stable/GtkWindow.html#GtkWindow--resizable

With cairo it is easy to scale your graphics, and you get all these nice
stuff like anti-aliasing, transparency and much more. But cairo is not
very fast -- for my current toy project
(http://www.ssalewski.de/PetEd.html.de) I had to carefully figure out
which redraw operation is really necessary for updating the display. A
complete redraw can take more than 100ms -- but now I have fixed that by
using bounding boxes for each elements, and redrawing only what has
changed. But for fast action games OpenGL may be a better choice. When
your application does not need fast graphics, then you may also consider
other languages than C -- I am using Ruby currently, next time I may
give Vala a try...




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


Re: GtkDrawingArea mouse events

2007-01-17 Thread John Cupitt
On 1/17/07, Jim George [EMAIL PROTECTED] wrote:
 1) I am currently trapping the configure-event signal and resizing
 the array there. Is this the best approach? In my past life, I used to

Yes, this is correct.

 2) I had a bug in my program in which I would occasionally get a mouse
 cursor position outside the drawing area (for eg: the last time
 configure-event was called, I got a 400x400 window, but I'd get pixel
 values of, say, x = 403). I handle these by bounds-checking before I
 access the array, but why would I get such values in the first place?

No idea :-) maybe you were sent a motion event half-way through the
resize? X is asynchronous under the hood, so strange things can happen
with respect to the timing and ordering of events.

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


Re: GtkDrawingArea initialization

2004-11-23 Thread sinsedrix
 How do I get a GtkDrawingArea to show some initial drawings when the GUI 
 starts...???  Specifically, I want a 2x2 rectangle pre-drawn at the 
 center of the DrawingArea so that when the program starts, you can 
 immediately see this center point...  The problem is, I have inserted the 
 drawing code in several places I think it would work (in a constructor -- 
 using gtkmm), but when I run my program, the rectangle does not show up... 
 Please help...
 
 all drawing in an on-screen drawable (like your DrawingArea) in all X
 Window related toolkits (including GTK) happens when handling an
 expose event. in GTK, that means you have to connect to the expose
 signal emitted by the drawing area, and draw from within the function
 that handles the signal.

 there are *no* exceptions to this rule. drawing anywhere other than
 in an expose handler is, at best, undefined in its effects.

So you should emit an exopose_event on your DrawingArea, there are
several ways to do it :
  g_signal_emit_by_name(darea, expose_event);
  gtk_widget_queue_draw_area(darea, x, y, w, h);
but I prefer this one :
  gtk_widget_queue_draw(darea);

these calls will make your area use the callback you connected to,
you can do it at anytime when your DrawingArea is created but it will
be really drawn only when the DrawingArea is realized.
Please don't draw directly to your area, you will encounter problems
with GraphicContexts, Colormaps ...

Sinsedrix ;o)

--

Faites un voeu et puis Voila ! www.voila.fr 


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkDrawingArea initialization

2004-11-23 Thread Sven Neumann
Hi,

[EMAIL PROTECTED] writes:

 So you should emit an exopose_event on your DrawingArea, there are
 several ways to do it :
   g_signal_emit_by_name(darea, expose_event);

That would be just as wrong as drawing outside the expose_event handler.

   gtk_widget_queue_draw_area(darea, x, y, w, h);
 but I prefer this one :
   gtk_widget_queue_draw(darea);

That is the right way of doing it.


Sven
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkDrawingArea initialization

2004-11-22 Thread Paul Davis
How do I get a GtkDrawingArea to show some initial drawings when the GUI 
starts...???  Specifically, I want a 2x2 rectangle pre-drawn at the 
center of the DrawingArea so that when the program starts, you can 
immediately see this center point...  The problem is, I have inserted the 
drawing code in several places I think it would work (in a constructor -- 
using gtkmm), but when I run my program, the rectangle does not show up... 
Please help...

all drawing in an on-screen drawable (like your DrawingArea) in all X
Window related toolkits (including GTK) happens when handling an
expose event. in GTK, that means you have to connect to the expose
signal emitted by the drawing area, and draw from within the function
that handles the signal.

there are *no* exceptions to this rule. drawing anywhere other than
in an expose handler is, at best, undefined in its effects.

--p

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GTKDrawingArea and GtkLabel

2004-07-03 Thread Jan-Marek Glogowski
Hi

Putting a GtkLabel inside a GtkDrawingArea doesn't make sense to me...

If you want to draw text look at pango:

Pango docs - Basic Pango Interfaces - Layout Objects - PangoLayout.

GDK docs - Drawing Primitives - gdk_draw_layout

HTH

Jan-Marek
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkDrawingArea and mouse clicks

2004-02-15 Thread Olexiy Avramchenko
Jeff Abrahamson wrote:

I have a Glade project that declares a GtkDrawingArea:

 child
widget class=GtkDrawingArea id=network_map
  property name=width_request600/property
  property name=height_request200/property
  property name=visibleTrue/property
  property name=can_defaultTrue/property
  property name=has_defaultTrue/property
  property name=can_focusTrue/property
  property name=has_focusTrue/property
  property name=extension_eventsGDK_EXTENSION_EVENTS_ALL/property
  signal name=button_release_event handler=on_network_map_button_release_event 
last_modification_time=Sun, 15 Feb 2004 18:40:17 GMT/
  signal name=button_press_event handler=on_network_map_button_press_event 
last_modification_time=Sun, 15 Feb 2004 18:48:36 GMT/
/widget
packing
  property name=padding0/property
  property name=expandTrue/property
  property name=fillTrue/property
/packing
 /child
But my callback functions don't get called when I click the mouse in
the GtkDrawingArea.
Other callbacks (for different objects) are working, so I guess I'm
not totally confused, just a little.
Any suggestions what to try next?
 

You have a zero events mask on your drawing area, GTK+ just doesnt call 
your handlers.
You should put GDK_BUTTON_PRESS_MASK and GDK_BUTTON_RELEASE_MASK to 
events field (Properties dialog, Common tab, Events entry in glade). 
GTK+ analog gtk_widget_add_events() and gtk_widget_set_events():
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-set-events
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-add-events

   Olexiy

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: gtkdrawingarea mouse signals

2002-11-16 Thread Olexiy Avramchenko
suzan Allen wrote:


Hi everyone,
I am new to this list and to gtk so please be patient with me.
My code contains a gtk window that contains a gtkdrawing area.I know 
how to draw on that area. But if I want to select a certain area 
within this drawing area to apply a certain action on it. How do I 
do that. I mean which event should the drawing area receive and how to 
get the coordinates of the choosen area (it should be rectangular).

There're motion-notify-event, button-press-event, 
button-release-event signals. Callbacks prototypes and all other stuff 
you need described here:
http://developer.gnome.org/doc/API/2.0/gtk/gtkwidget.html

You have to set events mask for you widget in order to receive events. 
This can be done with gtk_widget_set_events(), gtk_widget_add_events() 
functions.
There's an example, coming with gtk sources: scribble-simple (drawing 
area and mouse handling). Look also at gtkdial example - it shows how 
to deal with mouse events without processing all of them.

*NOTE* in GdkEventButton and GdkEventMotion structures fields *x* and 
*y* are of type gdouble.

Olexiy


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: gtkdrawingarea mouse signals

2002-11-16 Thread amitjain
you should go through with this document.
gtk1.2
http://developer.gnome.org/doc/API/gtk/gtkdrawingarea.html
gtk2.0
http://developer.gnome.org/doc/API/2.0/gtk/GtkDrawingArea.html
- Original Message -
From: suzan Allen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 16, 2002 5:49 PM
Subject: gtkdrawingarea mouse signals


 Hi everyone,
 I am new to this list and to gtk so please be patient with me.
 My code contains a gtk window that contains a gtkdrawing area.I know how
to
 draw on that area. But if I want to select a certain area within this
 drawing area to apply a certain action on it. How do I do that. I mean
 which event should the drawing area receive and how to get the coordinates
 of the choosen area (it should be rectangular).

 I appreciate all your help.

 Sue,







 _
 MSN 8 with e-mail virus protection service: 2 months FREE*
 http://join.msn.com/?page=features/virus

 ___
 gtk-list mailing list
 [EMAIL PROTECTED]
 http://mail.gnome.org/mailman/listinfo/gtk-list


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: gtkdrawingarea mouse signals

2002-11-16 Thread suzan Allen

I think I have enough resources now..Thanks everyone.
I will try to do it and see what we get..

sue,






From: amitjain [EMAIL PROTECTED]
To: suzan Allen [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: Re: gtkdrawingarea mouse signals
Date: Sat, 16 Nov 2002 18:14:50 +0530

you should go through with this document.
gtk1.2
http://developer.gnome.org/doc/API/gtk/gtkdrawingarea.html
gtk2.0
http://developer.gnome.org/doc/API/2.0/gtk/GtkDrawingArea.html
- Original Message -
From: suzan Allen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 16, 2002 5:49 PM
Subject: gtkdrawingarea mouse signals


 Hi everyone,
 I am new to this list and to gtk so please be patient with me.
 My code contains a gtk window that contains a gtkdrawing area.I know how
to
 draw on that area. But if I want to select a certain area within this
 drawing area to apply a certain action on it. How do I do that. I mean
 which event should the drawing area receive and how to get the 
coordinates
 of the choosen area (it should be rectangular).

 I appreciate all your help.

 Sue,







 _
 MSN 8 with e-mail virus protection service: 2 months FREE*
 http://join.msn.com/?page=features/virus

 ___
 gtk-list mailing list
 [EMAIL PROTECTED]
 http://mail.gnome.org/mailman/listinfo/gtk-list



_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkDrawingArea

2002-04-18 Thread Sven Neumann

Hi,

Jean-Yves Lamoureux [EMAIL PROTECTED] writes:

 I'm using a GtkDrawingArea to display some realtime graphics.
 I was wondering why even with setting GDK_RGB_DITHER_NONE, the display of my 
 picture seems to be 32bpp.   Is there a way to avoid all color conversions, 
 so I can do it myself ?

what color conversions are you speaking about? The drawing area has
the same color depth than the X-Server your application is running
at. Some X-Servers support multiple visuals and you might be able to
use a different visual than the system visual with some hackery, but I
doubt you want to do that.


Salut, Sven
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2002-04-18 Thread Jean-Yves Lamoureux

Le Jeudi 18 Avril 2002 12:22, vous avez écrit :

 what color conversions are you speaking about? The drawing area has
 the same color depth than the X-Server your application is running
 at. Some X-Servers support multiple visuals and you might be able to
 use a different visual than the system visual with some hackery, but I
 doubt you want to do that.

Yes, just noticed that in fact. dithering options confused me.
And what about displaying method ? Is  a drawing area using Xshm when 
available ?  Is there a way to do some dga stuff with it (don't think so) ?
What about screen resolution change ? (XF86VidModeSwitchToMode).

thanks



-- 
Jean-Yves Lamoureux
Software Developper
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2002-04-18 Thread Jean-Yves Lamoureux


Ok, found the reason :)
In the doc there is : 
  rgb_buf :
  The pixel data, represented as packed 
24-bit data.


So I was thinking buffer was dithered from 24 to XXbpp




-- 
Jean-Yves Lamoureux
Software Developper
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2002-04-18 Thread John . Cupitt

Jean-Yves Lamoureux wrote:
 Ok, found the reason :)
 In the doc there is : 
   rgb_buf :
   The pixel data, represented as packed 
 24-bit data.
 
 
 So I was thinking buffer was dithered from 24 to XXbpp

It will be dithered if you connect (eg.) to a 15bpp display. If your 
display is 24 or 32, it's passed through untouched. It also uses Xshm if 
it's available.

testrgb.c does some simple benchmarking of your system so you should be 
able to see if it's fast enough.

John



== 
Aelbert Cuyp 13 February - 12 May 2002 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/cuyp/
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2002-04-18 Thread Jean-Yves Lamoureux

Le Jeudi 18 Avril 2002 12:43, [EMAIL PROTECTED] a écrit :

 It will be dithered if you connect (eg.) to a 15bpp display. If your
 display is 24 or 32, it's passed through untouched. It also uses Xshm if
 it's available.

So what I said is right ?  If I display an rgb_image, it will be a 24bpp 
display. I want to draw a 15bpp image, so if what you say is right, I need to 
convert it to 24bpp, then gdk will convert it to 15bpp back again. It is a 
bit idiot, I think there must be another way to do that, no ?
thanks


-- 
Jean-Yves Lamoureux
Software Developper
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2002-04-18 Thread Sven Neumann

Hi,

Jean-Yves Lamoureux [EMAIL PROTECTED] writes:

 And what about displaying method ? Is  a drawing area using Xshm when 
 available ?  Is there a way to do some dga stuff with it (don't think so) ?
 What about screen resolution change ? (XF86VidModeSwitchToMode).

you can use a GdkImage of type GDK_IMAGE_FASTEST. If possible it will
be created as GDK_IMAGE_SHARED (which means it uses Xshm). You can
then write your pixel data to the image and blit it to the
drawing_area using gdk_draw_image.  That should be the fastest method
available if you need to draw pixel data. I wouldn't care too much
about the speed penalty of using GdkRGB however. It's pretty fast.

I'm not sure if there's a widget for DGA available. It's certainly not
part of the standard GTK+ distribution.


Salut, Sven
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2002-04-18 Thread Sven Neumann

Hi,

Jean-Yves Lamoureux [EMAIL PROTECTED] writes:

 So, I made some quick tests, the rbg_image is really 15bpp (my server display 
 depth). So the documentation is buggy, or there's something I've missed :)

it would help if you could explain what you are doing exactly. Perhaps 
a short code snippet so we don't have to guess what you are talking about.


Salut, Sven
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea signal

2002-04-12 Thread Steph

'clicked' is a gtkbutton signal.

mouse click signals are button press/release event signals.


- Original Message - 
From: Jean-Yves Lamoureux [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 12, 2002 12:27 PM
Subject: GtkDrawingArea  signal


 Hi all
 
 I would like to get events on a GtkDrawingArea, especially the mouse clicks 
 and mouse position.
 I wrote that : 
 
   gtk_signal_connect (GTK_OBJECT (MyWindow-MyDrawingArea), clicked,  
 GTK_SIGNAL_FUNC (MyHandler), GTK_OBJECT (file_menu));  
   gtk_widget_set_events (GTK_OBJECT (MyWindow-MyDrawingArea), 0 );
 
 But gtk says that : 
 
 Gtk-WARNING **: gtk_signal_connect(): could not find signal clicked in the 
 `GtkDrawingArea' class ancestry
 
 Gtk-CRITICAL **: file gtkwidget.c: line 3824 (gtk_widget_set_events): 
 assertion `!GTK_WIDGET_REALIZED (widget)' failed.
 
 
 How can I fix that ? 
 -- 
 Jean-Yves Lamoureux
 Software Developper
 ___
 gtk-list mailing list
 [EMAIL PROTECTED]
 http://mail.gnome.org/mailman/listinfo/gtk-list

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea signal

2002-04-12 Thread Sven Neumann

Hi,

Jean-Yves Lamoureux [EMAIL PROTECTED] writes:

 I would like to get events on a GtkDrawingArea, especially the mouse clicks 
 and mouse position.
 I wrote that : 
 
   gtk_signal_connect (GTK_OBJECT (MyWindow-MyDrawingArea), clicked,  
 GTK_SIGNAL_FUNC (MyHandler), GTK_OBJECT (file_menu));  

you are trying to connect to the clicked signal but a GtkDrawingArea
doesn't have such a signal (GtkButton has for example).

   gtk_widget_set_events (GTK_OBJECT (MyWindow-MyDrawingArea), 0 );

huh? Why are you emptying the event_mask?

Have a look at the scribble-simple example in the gtk+ docs to see how 
button_press events are properly handled. Basically you need something
like:

 gtk_widget_add_events (widget, GDK_BUTTON_PRESS_MASK);
 gtk_signal_connect (widget, button_press_event, callback, data);

You can then access the pointer position thru the GdkEventButton that
is passed to your callback.


Salut, Sven
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea signal

2002-04-12 Thread Jean-Yves Lamoureux


Ok works great, thanks a lot

Le Vendredi 12 Avril 2002 13:44, Sven Neumann a écrit :
 Hi,

 Have a look at the scribble-simple example in the gtk+ docs to see how
 button_press events are properly handled. Basically you need something
 like:

  gtk_widget_add_events (widget, GDK_BUTTON_PRESS_MASK);
  gtk_signal_connect (widget, button_press_event, callback, data);

 You can then access the pointer position thru the GdkEventButton that
 is passed to your callback


-- 
Jean-Yves Lamoureux
Software Developper
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2001-07-17 Thread Thomas Nemeth

Le 17.07.01, Thomas Nemeth a tapoté :

| Hi,
|
| I'm looking for a way of drawing with the mouse in a
| GtkDrawingArea.

I forgot to say that my problem is for grabbing mouse events...


| So I added a function attached to an event :
|
| gtk_signal_connect (GTK_OBJECT (drawing_area), realize,
| GTK_SIGNAL_FUNC (set_events_da),
| NULL);

I also tried to use :

gtk_signal_connect (GTK_OBJECT (drawing_area), configure-event,
GTK_SIGNAL_FUNC (set_events_da),
NULL);

But nothing seems to happen...


-- 
 Sur frg ça se passe bien car les gens qui n'ont pas le permis sont
 assez tolérents entre eux sur les fautes de conduite, sur fufe ça
 tourne au massacre car les dino ne laissent pas les neuneus faire.
 -+- GR In Guide du Généalogiste Ereinté : Le choc des générations -+-


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2001-07-17 Thread Havoc Pennington


Thomas Nemeth [EMAIL PROTECTED] writes:
 
 I'm looking for a way of drawing with the mouse in a
 GtkDrawingArea.

Have you read the scribble example in the tutorial?

 gtk_widget_set_events (widget, -1);

Maybe this function allows a -1 argument, but I haven't ever seen
anyone do that. Anyway, you probably want gtk_widget_add_events()
instead.

Havoc


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea

2001-07-17 Thread Thomas Nemeth

Le 17.07.01, Havoc Pennington a tapoté :

| Thomas Nemeth [EMAIL PROTECTED] writes:
| 
|  I'm looking for a way of drawing with the mouse in a
|  GtkDrawingArea.
|
| Have you read the scribble example in the tutorial?

No :-/ I stopped at the tic tac toe example...


|  gtk_widget_set_events (widget, -1);
|
| Maybe this function allows a -1 argument, but I haven't ever seen
| anyone do that. Anyway, you probably want gtk_widget_add_events()
| instead.

Okay...
Thank you very much for all ! It works perfectly...

You're my savier ;-)


-- 
 Sur frg ça se passe bien car les gens qui n'ont pas le permis sont
 assez tolérents entre eux sur les fautes de conduite, sur fufe ça
 tourne au massacre car les dino ne laissent pas les neuneus faire.
 -+- GR In Guide du Généalogiste Ereinté : Le choc des générations -+-




___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: GtkDrawingArea...

2001-03-28 Thread Paolo Molaro

On 03/28/01 Arjan J. Molenaar wrote:
  I`m trying to switch from Perl-Tk to Perk-Gtk because
  Gtk has a lot more advantages in this case. I got only
  one problem and alas I did not find a sample program 
  which helps me.
  
  I`m trying to setup a Gtk::DrawingArea which should
  contain several pixmaps to be selected with the mouse
  and dragged within the drawing area. I also need to 
  get the new position of the dragged pixmaps.
  
  Any ideas, docu, samples... :-)
 
 Hi,
 
 Isn't it just a better idea to use the GnomeCanvas for that. I think
 it will have many advantages over using the drawingarea, for example
 event handling.

Yep, using Gnome::Canvas is the best way to do it: it does
all the event handling and flicker-free redrawing for you.

 BTW there are Perl bindings for Gnome, isn't it?

Yep, and for a long time. I just released a new version on CPAN:

http://www.cpan.org/authors/id/L/LU/LUPUS/Gtk-Perl-0.7006.tar.gz

BTW, there is a mailing list dedicated to gtk-perl:

http://mail.gnome.org/mailman/listinfo/gtk-perl-list

lupus

-- 
-
[EMAIL PROTECTED] debian/rules
[EMAIL PROTECTED] Monkeys do it better

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list