19/05/2023: A causa di un errore sono stati cancellati, insieme ad account creati da bot, alcuni account legittimi. Si prega di leggere qui: https://www.gambas-it.org/smf/index.php?topic=9733.0
Public Sub Form_Open() Dim im As Image Dim st As Stream Dim i As Integer Dim l, limite As Long limite = &FFC0C0C0& im = Image.Load("/percorso/del/file/immagine/RGBA") st = Memory im.data For Write For i = 0 To im.Pixels.Max * 4 Step 4 l = CLong(Byte@(im.Data + i)) l += CLong(Shl(CInt(Byte@(im.Data + (i + 1))), 8)) l += CLong(Shl(CInt(Byte@(im.Data + (i + 2))), 16)) l += CLong(Shl(CLong(Byte@(im.Data + (i + 3))), 24)) If l > limite Then Write #st, Color.RGB(255, 255, 255, 255) As Integer ' Impone il pixel bianco Else Seek #st, Seek(st) + 4 Endif Next st.Close With Me .W = im.W .H = im.H End With With PictureBox1 .W = im.W .H = im.H .Image = im End WithEnd
' void kyklos (unsigned int * img, int wh, long int lmt)' Esegue il ciclo per la verifica dei pixel.Private Extern kyklos(img As Pointer, wh As Integer, lmt As Long) In "/tmp/kyklos"Public Sub Form_Open() Dim im As Image Dim limite As Long Creaso() ' Invoca la procedura per la creazione della libreria esterna .so in C limite = &FFC0C0C0& im = Image.Load("/percorso/del/file/immagine/RGBA") kyklos(im.Data, im.W * im.H, limite) With Me .W = im.W .H = im.H End With With PictureBox1 .W = im.W .H = im.H .Image = im End WithEndPrivate Procedure Creaso() File.Save("/tmp/kyklos.c", "void kyklos(unsigned int * img, int wh, long int lmt)" & "\n{\n" & " int c;\n" & " unsigned int ff = 0xFFFFFFFF;\n\n" & " for (c=0; c<wh; c++) \n" & " if (*(img+c) > lmt){\n" & " *(img+c) = ff;}\n" & "}") Shell "gcc -o /tmp/kyklos.so /tmp/kyklos.c -shared" Wait End
... noto che i due programmi non sono uguali, vedi immagini allegate