Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Vos tutoriels et astuces


Index du Forum » Vos tutoriels et astuces » Tutoriels d'utilisation de gint (commentaires)
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Tutoriels d'utilisation de gint (commentaires)

Posté le 15/07/2017 13:54

Les tutoriels d'utilisation de gint sont sur ce topic.

Pour garder les tutoriels ensemble dans les posts du topic d'origine (et surtout pas créer un topic par tuto...), je vous propose de poster vos questions/commentaires/etc ici. Merci !


Précédente 1, 2, 3 ··· 10 ··· 20, 21, 22, 23, 24, 25, 26 Suivante
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Citer : Posté le 19/10/2022 22:36 | #


Why did you choose to do rejection sampling instead of a modulo for random_randint()?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Calamari Hors ligne Membre Points: 229 Défis: 0 Message

Citer : Posté le 19/10/2022 22:37 | #


Because modulo introduces statistical bias.

Found a good explanation of the problem and the fix (you can see I'm doing something similar):
https://stackoverflow.com/questions/10984974/why-do-people-say-there-is-modulo-bias-when-using-a-random-number-generator
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 17/01/2023 14:55 | #


Hello!

I meet a problem and it seems that I haven't found it in previous topics.
I tried to use the regex experssion in "fxconv-metadata.txt"

*.png: type: bopti-image
name_regex:
(.*)\.png img_\1


it follows after the "example.png" codes and the sdk gives me the error message
[ 20%] Building FXCONV object CMakeFiles/myaddin.dir/assets-fx/example.png.o
error: invalid parameter (.*)\.png img_\1, ignoring

and i deleted the previous codes, with only this three lines left. Another error occured
error: invalid metadata: *.png: type: bopti-image appears before wildcard

I don't know what happened.
Slyvtt Hors ligne Maître du Puzzle Points: 2308 Défis: 17 Message

Citer : Posté le 17/01/2023 15:00 | #


be careful to split the first line in two lines, just like this :
and to merge lines 3 and 4

*.png:
type: bopti-image
name_regex: (.*)\.png img_\1


edit : you may also need to specify a profile for your image, for example :

*.png:
type: bopti-image
name_regex: (.*)\.png img_\1
profile: p8

There are only 10 types of people in the world: Those who understand binary, and those who don't ...
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Citer : Posté le 17/01/2023 15:22 | #


Did you maybe get this line break from a machine translator accidentally changing the spacing in the code block?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 18/01/2023 01:32 | #


Thanks for help!

It seems that some spaces are wrong. I have treated it as c codes...
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 23/01/2023 01:45 | #


Hello! I have another question now.
I want to import an older file into gint. It contains large contents of characters with binary images.
So I want to know how to display raw binary image.Is there any direct functions?
Or I can customize a bopti_image_t in my own. But I don't know how to define the 'profile' data. It seems that it should be created by fxconv.
I'm working with a fx-9750GII calculator, the old fx one.
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 23/01/2023 02:43 | #


By the way, I'm curious that what software do you usually use to make a calculator png?
I used to do it with the native "draw picture" on windows, but I don't think it's handy enough
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 23/01/2023 06:27 | #


Oh I have another question.
How to change the repeat time of key?
I tried to simply change the rep_standard_first in keydev_std but it doesn't work. Instead it banned repeat function.
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Citer : Posté le 23/01/2023 09:56 | #


Hi Zm!

Zm a écrit :
I want to import an older file into gint. It contains large contents of characters with binary images.
So I want to know how to display raw binary image.Is there any direct functions?

There are no direct functions. You can construct a bopti_image_t from the binary data if (1) the image is fully black-and-white (no transparency) and (2) rows are padded to full bytes. In this case the data format should match, and you can do something like this:

#include <gint/display.h>

// Instead of:
const unsigned char my_image[] = { <data> };

// Try this:
const bopti_image_t my_image = {
  .gray = 0,
  .profile = 0, // mono without alpha
  .width = <width in pixels>,
  .height = <height in pixels>,
  .data = { <data> },
}:

However, in the long run if these images are static it might be easier to decode them into PNGs and then use the normal fxSDK pipeline of converting the PNGs with fxconv.

Zm a écrit :
By the way, I'm curious that what software do you usually use to make a calculator png?
I used to do it with the native "draw picture" on windows, but I don't think it's handy enough

fxconv handles the PNGs. It's a program written in Python using the PIL library (specifically its fork Pillow). PIL allows you to open and decode images into arrays of pixels so you don't have to care about the format. Then fxconv converts and produces a bopti_image_t which is just a bitmap with special layout. If you want actual PNG files on the calculator, you can look into the libPNG port by SlyVTT, which is for fx-CG but could work on the fx-series too (topic and repository).

Zm a écrit :
How to change the repeat time of key?
I tried to simply change the rep_standard_first in keydev_std but it doesn't work. Instead it banned repeat function.

You can use the keydev_set_standard_repeats() function. Setting the members of the keydev structure bypasses the API, which is a bit risky. That said, it should probably have worked assuming you set a suitable value in microseconds. Let me know if you have any issue with it.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 24/01/2023 02:08 | #


It does work. Thank you!
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 28/01/2023 09:30 | #


HI! I'm here again....
I want to know how the raw data of bopti image is coded?
My old images are some kind of very direct codes.
the following codes work for the old 12 * 12 image
    for(int i = 0;i < 8;++i)
        for(int k = 0;k < 2;++k)
            for(int j = 0;j < 12;++j)
                if(test.data[k + 2 * j] & (0x80 >> i))
                    dpixel(50 + i, 20 + j, C_BLACK);

but it doesn't work with bopti image
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Citer : Posté le 28/01/2023 09:37 | #


There's documentation here: https://gitea.planet-casio.com/Lephenixnoir/gint/wiki/bopti-on-fx-9860G (the performance claim is not quite accurate as it actually depends on the surface; bopti gets faster as you blit larger images)

TL;DR: Data is grouped by packets of 32 bits so we can OR 32 bits with the VRAM at once, and for gray images or images with transparency the data is split into different channels, each of which has a specific operator (ie. an image with transparency has an alpha channel which is AND-ed on the VRAM and then a normal channel which is OR-ed afterwards).

I'm assuming here you just need to pad to 32 bits (ie. 32 pixels) instead of 8 bits (totaling 16 pixels), which I forgot about in my previous message.

Can you explain your use case in more detail? I'm wondering why you'd need both manual and bopti rendering. Maybe the API is missing something useful?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Slyvtt Hors ligne Maître du Puzzle Points: 2308 Défis: 17 Message

Citer : Posté le 28/01/2023 09:37 | #


The format is explained in "gint/image.h"

image_t has a member *data that contains the image data.

bopti_image_t is an alias for image_t for backward compatibility reason.


Sorry, didn't realize you are on fx9860G
There are only 10 types of people in the world: Those who understand binary, and those who don't ...
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 28/01/2023 15:30 | #


Emm...
manual rendering is just to find where goes wrong... in fact I just fix a charactor decoding problem before.
I'm a Chinese and there's some works in our forum years ago to draw Chinese characters.There are 8*8 ones and 12*12 ones, both pure binary character set file used in old platform. And I want to use them in the new complier.
So it's really hard to convert them to pngs. The 12*12 set file is about 20kb large. The old way is to read a specific 16 * 12 file, wrap and use Bdisp_DrawGraph. Also the file is sorted as GBK but linux gcc is UTF-8 for default ,so an additional command in complie is needed.

OK I add it to 32 * 12 with 0 filled and everything goes well, thank you.
I think the API is well enough I would prefer using fxconv if it's not a strange work like that. It's so handy, compared to using a software to convert a bmp to a long long char[]. Thanks for construct such a great platform
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Citer : Posté le 28/01/2023 18:13 | #


Oh, I see! Writing Chinese characters is something I would like to allow by default. Currently the dtext() function in gint supports Unicode (see for example these fonts), and I discussed the idea of using a Chinese-character font before on Cemetech. This way, rendering text in Chinese would be as easy as in English. However, that time I was told that there were too many characters and using a gint font would take too much memory. Instead, the user was looking to use the Chinese font in the OS.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 29/01/2023 05:08 | #


Wow, such fonts are great. I'm just wondering we don't have FONTCHARACTER now and need to draw some icon manually.
Yeh, it's not necessary to add such a big character set. There's more than 8000 characters in the set but only less than 1000 will be used daily, and even less at a single time. Most characters have really low using frequency, so the memory taken may be very unprofitable.
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Citer : Posté le 29/01/2023 10:37 | #


How do 8000 characters fit in a 20 kB file? Since 12×12 costs 18 bytes per character, that would make 144 kB? Is it compressed?

I'm sure there are possible tradeoffs. For instance, we could use compression to make the font smaller. We might also use fxconv to determine what Chinese characters in the source code and include only these ones in the font.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Zm Hors ligne Membre Points: 10 Défis: 0 Message

Citer : Posté le 29/01/2023 13:45 | #


Oh, I'm sorry
it's about 192kb, with 16*12bits * 8000+.

That's a good idea. Some programs may only use a few words and can eliminate the dependency.
But there's some problems.First if there're only few words in a program, I think ones would prefer draw them manully, because the 12*12 version is only standard but not beautiful.(take any word in chinese for example : 编译器 , which means compiler. you can imagine the ones in 12 * 12 is not beautiful. The resolution is not enough. For me, I'm lazy I'm poor at drawing so it's OK for me). Also if someone need all the set, for example reader or cninput, he also need to add all the set. And if it's binded in the program, some other program may also use the whole charset which will cause duplicate. Also users can change the public charset to change a font(although I remember that I only find two kind of font of 12*12 lol)

However, if it's easy to convert them into a pile of png images, like the ones in your unicode-font, it's also good to extend the charset
I don't know whether it could only select a few pngs to compile, also the codes is not in unicodes..(this may not be a problem however)
Lephenixnoir En ligne Administrateur Points: 24199 Défis: 170 Message

Citer : Posté le 30/01/2023 10:56 | #


Right, duplication is quite problematic. Even if the font is small, duplicating it in every Chinese language add-in will not be profitable. It seems that using an external file remains the best approach.

I would still be interested in making a small library to make loading the file and drawing characters easier. Probably it is possible to integrate better with the gint API. Also we might still use a programe like fxconv to generate the shared font file from a PNG. This way, if you draw some characters manually, you can use the same text functions and tell it to use your manually-provided characters instead of the shared font, instead of using image functions.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Dimartino Hors ligne Maître du Puzzle Points: 310 Défis: 2 Message

Citer : Posté le 01/03/2023 19:12 | #


Bonjour, je vais sûrement embêter avec ma question un peu débile mais bon... J'ai installé tout ce qu'il faut pour coder en C (normalement) mais je ne trouve pas comment lancer Gint. Quelqu'un pourrait-il m'aider ?
Mon projet du moment : Memen'Casio
Précédente 1, 2, 3 ··· 10 ··· 20, 21, 22, 23, 24, 25, 26 Suivante

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 32 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd