WIP: camp de base https://docs.gtk.org/gio/method.Icon.serialize.html GtkImage > GIcon > serialize
This commit is contained in:
parent
dbe087167d
commit
62aa327e3a
|
@ -81,16 +81,17 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
|
||||||
|
|
||||||
struct TreeNode_t *aaa0 = widget_create_user_tree_node("speak"); widget_add_child_node(aaa, aaa0);
|
struct TreeNode_t *aaa0 = widget_create_user_tree_node("speak"); widget_add_child_node(aaa, aaa0);
|
||||||
struct TreeNode_t *aaa1 = widget_create_user_tree_node("question"); widget_add_child_node(aaa, aaa1);
|
struct TreeNode_t *aaa1 = widget_create_user_tree_node("question"); widget_add_child_node(aaa, aaa1);
|
||||||
|
struct TreeNode_t *aaa2 = widget_create_user_tree_node("learn"); widget_add_child_node(aaa, aaa2);
|
||||||
struct TreeNode_t *aaaa = widget_create_user_tree_node("read"); widget_add_child_node(aaa, aaaa);
|
struct TreeNode_t *aaaa = widget_create_user_tree_node("read"); widget_add_child_node(aaa, aaaa);
|
||||||
struct TreeNode_t *aaab = widget_create_user_tree_node("write"); widget_add_child_node(aaa, aaab);
|
struct TreeNode_t *aaab = widget_create_user_tree_node("write"); widget_add_child_node(aaa, aaab);
|
||||||
struct TreeNode_t *aaac = widget_create_user_tree_node("compute"); widget_add_child_node(aaa, aaac);
|
struct TreeNode_t *aaac = widget_create_user_tree_node("compute"); widget_add_child_node(aaa, aaac);
|
||||||
struct TreeNode_t *aaad = widget_create_user_tree_node("code"); widget_add_child_node(aaa, aaad);
|
struct TreeNode_t *aaad = widget_create_user_tree_node("code"); widget_add_child_node(aaa, aaad);
|
||||||
struct TreeNode_t *aaae = widget_create_user_tree_node("interact"); widget_add_child_node(aaa, aaae);
|
// struct TreeNode_t *aaae = widget_create_user_tree_node("interact"); widget_add_child_node(aaa, aaae);
|
||||||
|
|
||||||
struct TreeNode_t *aaaco = widget_create_user_tree_node("copy"); widget_add_child_node(aaaa, aaaco);
|
struct TreeNode_t *aaaco = widget_create_user_tree_node("copy"); widget_add_child_node(aaaa, aaaco);
|
||||||
|
|
||||||
struct TreeNode_t *aaadx = widget_create_user_tree_node("edit"); widget_add_child_node(aaae, aaadx);
|
struct TreeNode_t *aaae = widget_create_user_tree_node("edit"); widget_add_child_node(aaab, aaae);
|
||||||
struct TreeNode_t *aaadb = widget_create_user_tree_node("publish"); widget_add_child_node(aaae, aaadb);
|
struct TreeNode_t *aaaf = widget_create_user_tree_node("publish"); widget_add_child_node(aaab, aaaf);
|
||||||
// struct TreeNode_t *aaada = widget_create_user_tree_node("manifest"); widget_add_child_node(aaad, aaada);
|
// struct TreeNode_t *aaada = widget_create_user_tree_node("manifest"); widget_add_child_node(aaad, aaada);
|
||||||
|
|
||||||
struct TreeNode_t *aaba = widget_create_user_tree_node("learn"); widget_add_child_node(aab, aaba);
|
struct TreeNode_t *aaba = widget_create_user_tree_node("learn"); widget_add_child_node(aab, aaba);
|
||||||
|
|
|
@ -98,15 +98,6 @@ static GtkWidget *peek(Stack *stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// 2024-08-01 neox dixit :
|
|
||||||
// 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.
|
|
||||||
// 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 trouves un outil dans GTK pour ce type d'opération.
|
|
||||||
// C'est le cas de toute bibliothèque externe que tu utilises :
|
|
||||||
// Tu n'as pas le droit de faire d'assomptions sur les espaces mémoires externes.
|
|
||||||
|
|
||||||
// J'imagine un tableau de vignettes, toutes de même taille.
|
// J'imagine un tableau de vignettes, toutes de même taille.
|
||||||
// https://en.wikipedia.org/wiki/Color_depth 24 * 256 * 256 * 2 = 3 145 728
|
// https://en.wikipedia.org/wiki/Color_depth 24 * 256 * 256 * 2 = 3 145 728
|
||||||
// Aucun utilisateur ne comparera toutes les règles une à une. 🤔️
|
// Aucun utilisateur ne comparera toutes les règles une à une. 🤔️
|
||||||
|
@ -121,6 +112,15 @@ static GtkWidget *peek(Stack *stack)
|
||||||
// mais toute règle n'aura pas nécessairement de vignette. 🤔️
|
// mais toute règle n'aura pas nécessairement de vignette. 🤔️
|
||||||
// Donc une application injective & non-surjective.
|
// Donc une application injective & non-surjective.
|
||||||
//
|
//
|
||||||
|
// 2024-08-01 neox dixit :
|
||||||
|
// 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.
|
||||||
|
// 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 trouves un outil dans GTK pour ce type d'opération.
|
||||||
|
// C'est le cas de toute bibliothèque externe que tu utilises :
|
||||||
|
// Tu n'as pas le droit de faire d'assomptions sur les espaces mémoires externes.
|
||||||
|
|
||||||
// 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
|
// https://docs.gtk.org/gtk4/class.Image.html
|
||||||
// Sometimes an application will want to avoid depending on external data files,
|
// Sometimes an application will want to avoid depending on external data files,
|
||||||
|
@ -135,6 +135,11 @@ static GtkWidget *peek(Stack *stack)
|
||||||
// https://docs.gtk.org/gdk4/iface.Paintable.html
|
// https://docs.gtk.org/gdk4/iface.Paintable.html
|
||||||
// GdkPaintable is a simple interface used by GTK to represent content that can be painted.
|
// 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.
|
// In order to implement Paintable, your type must inherit fromGObject.
|
||||||
|
//
|
||||||
|
// https://docs.gtk.org/gio/method.Icon.serialize.html << autre piste ?
|
||||||
|
// Serializes a GIcon into a GVariant. An equivalent GIcon can be retrieved back
|
||||||
|
// by calling g_icon_deserialize() on the returned value.
|
||||||
|
// Oui mais : comment obtenir une GIcon à partir d'une GtkImage ?
|
||||||
|
|
||||||
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);
|
static GtkWidget *do_rtfd (Stack stack_b);
|
||||||
|
@ -195,8 +200,11 @@ static GtkWidget *do_rtfd (Stack stack)
|
||||||
gtk_image_set_pixel_size (image_insuline, 256);
|
gtk_image_set_pixel_size (image_insuline, 256);
|
||||||
GtkImageType image_insuline_storage_type = gtk_image_get_storage_type (image_insuline);
|
GtkImageType image_insuline_storage_type = gtk_image_get_storage_type (image_insuline);
|
||||||
// gtk_image_set_from_paintable (image_insuline, ? GdkPaintable* paintable);
|
// gtk_image_set_from_paintable (image_insuline, ? GdkPaintable* paintable);
|
||||||
GdkPaintable* paintable_insulin
|
// GdkPaintable* paintable_insulin
|
||||||
= gdk_paintable_get_current_image (GDK_PAINTABLE (image_insuline));
|
// = gdk_paintable_get_current_image (GDK_PAINTABLE (image_insuline));
|
||||||
|
// Gdk-CRITICAL **: 06:20:06.154: gdk_paintable_get_current_image:
|
||||||
|
// assertion 'GDK_IS_PAINTABLE (paintable)' failed
|
||||||
|
GIcon *hello_dream = G_ICON (image_insuline);
|
||||||
GtkWidget *widget_insuline = GTK_WIDGET (image_insuline);
|
GtkWidget *widget_insuline = GTK_WIDGET (image_insuline);
|
||||||
if (image_insuline_storage_type == GTK_IMAGE_ICON_NAME)
|
if (image_insuline_storage_type == GTK_IMAGE_ICON_NAME)
|
||||||
printf("insuline image now at : %p storage_type : %s\n",
|
printf("insuline image now at : %p storage_type : %s\n",
|
||||||
|
|
Loading…
Reference in New Issue