WIP: https://docs.gtk.org/gdk4/iface.Paintable.html GdkPaintable is a simple interface used by GTK to represent content that can be painted.
This commit is contained in:
parent
e01982e71d
commit
dbe087167d
|
@ -98,10 +98,10 @@ static GtkWidget *peek(Stack *stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// 2024-08-01
|
// 2024-08-01 neox dixit :
|
||||||
// GTK possède un espace mémoire où les widgets sont alloués/désalloués
|
// GTK possède un espace mémoire où les widgets sont alloués/désalloués
|
||||||
// Un widget ne conserve pas son pointeur. Son adresse peut changer.
|
// Un widget ne conserve pas son pointeur. Son adresse peut changer.
|
||||||
// Donc créer une stack de widget avec un outil hors GTK n'est pas faisable >>
|
// Créer une stack de widget avec un outil hors GTK n'est pas faisable. Donc :
|
||||||
// - soit tu traites les images hors de GTK,
|
// - soit tu traites les images hors de GTK,
|
||||||
// - soit tu trouves un outil dans GTK pour ce type d'opération.
|
// - soit tu trouves un outil dans GTK pour ce type d'opération.
|
||||||
// C'est le cas de toute bibliothèque externe que tu utilises :
|
// C'est le cas de toute bibliothèque externe que tu utilises :
|
||||||
|
@ -122,8 +122,22 @@ static GtkWidget *peek(Stack *stack)
|
||||||
// Donc une application injective & non-surjective.
|
// Donc une application injective & non-surjective.
|
||||||
//
|
//
|
||||||
// https://docs.gtk.org/gio/iface.ListModel.html?q=icon << TODO
|
// https://docs.gtk.org/gio/iface.ListModel.html?q=icon << TODO
|
||||||
|
// https://docs.gtk.org/gtk4/class.Image.html
|
||||||
|
// Sometimes an application will want to avoid depending on external data files,
|
||||||
|
// such as image files. See the documentation of GResource inside GIO, for details.
|
||||||
|
// In this case, GtkImage:resource, gtk_image_new_from_resource(),
|
||||||
|
// and gtk_image_set_from_resource() should be used.
|
||||||
|
// GtkImage displays its image as an icon, with a size that is determined by the application.
|
||||||
|
// See GtkPicture if you want to show an image at is actual size.
|
||||||
|
// https://docs.gtk.org/gtk4/ctor.Image.new_from_resource.html
|
||||||
|
// The storage type (see gtk_image_get_storage_type()) of the returned image is not defined,
|
||||||
|
// it will be whatever is appropriate for displaying the file.
|
||||||
|
// https://docs.gtk.org/gdk4/iface.Paintable.html
|
||||||
|
// GdkPaintable is a simple interface used by GTK to represent content that can be painted.
|
||||||
|
// In order to implement Paintable, your type must inherit fromGObject.
|
||||||
|
|
||||||
static void *push_images_onto_stack (Stack stack_b);
|
static void *push_images_onto_stack (Stack stack_b);
|
||||||
|
static GtkWidget *do_rtfd (Stack stack_b);
|
||||||
|
|
||||||
void *get_an_impression_of_what_a_rules_comparator_could_be(){
|
void *get_an_impression_of_what_a_rules_comparator_could_be(){
|
||||||
|
|
||||||
|
@ -136,6 +150,7 @@ void *get_an_impression_of_what_a_rules_comparator_could_be(){
|
||||||
initialize(&stack_b);
|
initialize(&stack_b);
|
||||||
|
|
||||||
// push_images_onto_stack (stack_b);
|
// push_images_onto_stack (stack_b);
|
||||||
|
do_rtfd (stack_b);
|
||||||
|
|
||||||
push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename
|
push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename
|
||||||
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutathione.png")));
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutathione.png")));
|
||||||
|
@ -171,9 +186,23 @@ void *get_an_impression_of_what_a_rules_comparator_could_be(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static GtkWidget *do_rtfd (Stack stack)
|
||||||
|
{
|
||||||
|
GtkImage *image_insuline = GTK_IMAGE (gtk_image_new_from_resource
|
||||||
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/insuline.png"));
|
||||||
|
gtk_image_set_from_resource (image_insuline,
|
||||||
|
"/home/jean/Gem-Graph/gem-graph-client/data/image/legumin.png");
|
||||||
|
gtk_image_set_pixel_size (image_insuline, 256);
|
||||||
|
GtkImageType image_insuline_storage_type = gtk_image_get_storage_type (image_insuline);
|
||||||
|
// gtk_image_set_from_paintable (image_insuline, ? GdkPaintable* paintable);
|
||||||
|
GdkPaintable* paintable_insulin
|
||||||
|
= gdk_paintable_get_current_image (GDK_PAINTABLE (image_insuline));
|
||||||
|
GtkWidget *widget_insuline = GTK_WIDGET (image_insuline);
|
||||||
|
if (image_insuline_storage_type == GTK_IMAGE_ICON_NAME)
|
||||||
|
printf("insuline image now at : %p storage_type : %s\n",
|
||||||
|
&image_insuline, "GTK_IMAGE_ICON_NAME");
|
||||||
|
return widget_insuline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue