Pixel Colors -- Image and Pixmap

772 views
Skip to first unread message

Bert Mariani

unread,
Oct 5, 2023, 4:41:50 PM10/5/23
to The Ring Programming Language
Hello Mahmoud et ALL

I have some questions on Image, Pixmap, reading pixels, writing pixels ...
My program is very slow because it reads and writes every pixel and RGBA color ...

Attached:  
    pixelColor-1.ring
    PotatoGirl.png

Usage:  (Use debug button)
    - Click on "GetPixelColors  --- will read the RGB for each pixel from the Image displayed
    - after it is finished ...                 ( 10 seconds  for 200x300 image = 60,000 points)
    - Click on "DrawImagePixels"   ( 30 seconds ... it is slow)

Questions:
   The program is very slow reading each pixel value and writing each pixel value !
   There is toImage  and fromImage  and Pixmap
   How can they be used ?

    How can the toImage be used to load an array-List with all the pixel values ?
    How can the array-List  be used to write all the fromImage values to a new image ?

    Hope is is clear enough. 
    QT docs are sometimes  lacking examples and understandable documentation.

-------------------------------
Func GetPixelColors()
   pixmap = screen.grabwindow(0, xPos, yPos , -1, -1)        // Window on screen
   image  = pixmap.toimage()
                  ....
   color   = image.Pixel(i,j)            
   mycolor = new qcolor()
   mycolor.setRGBA(color)

DrawImagePixels()              
                        colorBlue  = new qcolor() { setrgb( R,G,B,A ) }
penBlue    = new qpen()   { setcolor(colorBlue)   setwidth(1) }
daVinci.setpen(penBlue)
daVinci.drawPoint(Row + OffsetW , Col ) 
                        ....

======================================
Original image: PotatoGirl.png
PotatoGirl.png

Manually edit the pixel-Color-1.ring to put a "0" value for the color
Line 179
value = split(MC[i][j], ",")
Row = 0+ value[1]  // i pos
Col = 0+ value[2]  // j pos
R   = 0+ value[3]  // color
G   = 0+ value[4]
B   = 0+ value[5]
A   = 0+ value[6]  // Intensity of color

PotatoGirl-Color-Remove-1.png
pixelColor-1.ring

Mahmoud Fayed

unread,
Oct 5, 2023, 5:33:28 PM10/5/23
to The Ring Programming Language
Hello Bert


RingQt Add the next methods to the QPainter class
* drawHSVFList()
* drawRGBFList()

These methods can draw 400x400 image (160,000 points) in 0.15 second on my machine. 

Greetings,
Mahmoud

Ilir Liburn

unread,
Oct 5, 2023, 5:40:07 PM10/5/23
to The Ring Programming Language
Hello Bert,

in Ring2B I get (on my 12 years old laptop - i7 first gen)

Start MC size: 200-300
Start Get PixelColor

Fin Get PixelColor i-j 201-301
Fin Get PixelColor Wide-High 200-300
Time: 3.36

Start Draw-ImagePixels
Fin Draw ImagePixels
Fin Img array MC-RGBA: 200-300
Time: 10.66

I strongly recommend to use allegro library for image manipulation,. It should be faster, but only test can show.
Find attached allegro sample.

Greetings,
Ilir
stretch.ring
background.png

Mahmoud Fayed

unread,
Oct 5, 2023, 5:48:49 PM10/5/23
to The Ring Programming Language
Hello Ilir

>> "I strongly recommend to use allegro library for image manipulation,. It should be faster, but only test can show."

Nice suggestion (In General),  But in this particular case (Where Bert just need to load an image, then process it then display it again)
A nice solution could be developed using

StbImage ---> To load the image in memory quickly.  ---> Will provide stream of bytes where each three bytes represent a pixel (R,G,B)
Then we can convert this to a list [X,Y,R,G,B,A] ---> Will be done quickly by Ring
* some Image Processing  on the List
Then we use QPainter drawRGBFList() to display the result
Example: in my previous message

Greetings,
Mahmoud

Ilir Liburn

unread,
Oct 5, 2023, 6:13:08 PM10/5/23
to The Ring Programming Language
Hello Mahmoud,

Indeed, I tried your suggestion and it is fast enough.

Greetings,
Ilir


# Load the library
load "stbimage.ring"
# Image Information
width=0 height=0 channels=0
# Ring will Free cData automatically in the end of the program
cData = stbi_load("potatogirl.png",:width,:height,:channels,STBI_rgb)
# Display the output
? "Size (bytes): " + len(cData)
? "Width : " + width
? "Height: " + height
? "Channels: " + channels
# End of program
lst = []
i = 0
for h = 1 to height
for w = 1 to width
lst + [0+cData[i++],0+cData[i++],0+cData[i++]]
next
next
? len(lst)
? type(lst[1][1])
? :done

Mahmoud Fayed

unread,
Oct 6, 2023, 8:17:11 AM10/6/23
to The Ring Programming Language
Hello Ilir

>> "Indeed, I tried your suggestion, and it is fast enough."

Thank you very much
I like this line: lst + [0+cData[i++],0+cData[i++],0+cData[i++]]
It's a good example about using the (++) operator. 

Greetings,
Mahmoud

Ilir Liburn

unread,
Oct 6, 2023, 9:42:43 AM10/6/23
to The Ring Programming Language
Hello Mahmoud,

You're Welcome. Unfortunately, code is incorrect, 0+cData[i++] works only for hex char because it is calling stringtonum. Correct is

lst + [ascii(cData[i++]),ascii(cData[i++]),ascii(cData[i++])]

This makes conversion slower. Allegro library is using function(s) which operates on one pixel (not pixel components), so it has advantage.
Because whole pixel is returned as integer where each component can be accessed by some bit shifting or by using functions (on all components).

Greetings,
Ilir

Mahmoud Fayed

unread,
Oct 6, 2023, 9:55:37 AM10/6/23
to The Ring Programming Language
Hello Ilir

>> "This makes conversion slower"

A better solution would be to improve the RingStbImage extension
Where we add a C function that return the [ [x,y,r,g,b,a], ...]  list automatically
Since this have a common case

Greetings,
Mahmoud

Ilir Liburn

unread,
Oct 6, 2023, 10:14:41 AM10/6/23
to The Ring Programming Language
Hello Mahmoud,

You can do that. Question is: should 0+cData[i++] call stringtonum on a single character? Maybe for Ring 1.19, we could change to return ascii value for a single character (if this doesn't cause problems on existing code).

Greetings,
Ilir

Mahmoud Fayed

unread,
Oct 6, 2023, 10:17:20 AM10/6/23
to The Ring Programming Language
Hello Ilir

>> "if this doesn't cause problems on existing code"

I think it will cause problems
? 0 + "1"
? Ascii("1")

Output:
1
49

Greetings,
Mahmoud

Ilir Liburn

unread,
Oct 6, 2023, 10:35:03 AM10/6/23
to The Ring Programming Language
Hello Mahmoud,

then in some not so distant future we could do

load "typehints.ring"

 ch = '1'
? 0 + int ch
? 0 + ch

This currently takes int as second argument to add (producing zero), ch is left standalone.

Greetings,
Ilir

Mahmoud Fayed

unread,
Oct 6, 2023, 1:04:11 PM10/6/23
to The Ring Programming Language
Hello Bert & Ilir

The RingStbImage is updated and the stbi_bytes2list() function is added

Then run gencode.bat and build the extension using buildvc.bat


This sample will
(1) Use stbi_load() to load an image and get a stream of bytes
(2) Use stbi_bytes2list() to have a Ring List from these bytes [ [x,y,R,G,B,A], ... ] - The values of R,G,B are from 0 to 255 while A=1 
(3) You can process this list as you want (optional) using Ring code
(4) The sample uses  /= 255 to convert R,G,B values from 0 to 255 to from 0 to 1
(5) The sample uses QPainter - drawRGBFList() method to draw the list

Greetings,
Mahmoud
On Thursday, October 5, 2023 at 11:41:50 PM UTC+3 Bert Mariani wrote:

Bert Mariani

unread,
Oct 6, 2023, 5:22:28 PM10/6/23
to The Ring Programming Language
Hello Mahmoud, Illir

Thanks for the info !

Attached: pixelColor-RGBV-3.ring
     - Button son bottom - 
       GetPixelColors -      creates a 2D List  MC[][]  and a 1D List MCrbgv[]
     - DrawImagePixels - draws the 2D List  MC[][]            -  at x=210 position
     - Draw-RGBA-ImagePixels - draws the 1D MCrgbv[]   - at x=420 position
                                                         
Problem:  daVinci.drawRGBFList(MCrgbv)    does Not Draw anything ??
                  Can't get it to work and display the Image array  ...   x,y,R,G,B,A  format

Other question:
     Is there a  "Read-RGBV-fromImage" to  Array,  that can be used to read the   x,y,R,G,B,A  values  ?
    It would be so much faster.

=========================
tSart Processing... GetPixelColors
Total Time: 3.89 seconds

Start Processing... DrawImageColors  MC[][]  200x300
Total Time: 9.62 seconds

Start Processing... Draw-RBGA-ImagePixels MCrgb[] 60000
Total Time: 0.01 seconds
pixelColor-RGBV-3.ring

Ilir Liburn

unread,
Oct 6, 2023, 5:56:29 PM10/6/23
to The Ring Programming Language
Hello Bert,

just update your code to use following line

MCrgbv[k] =  [i+offsetW,j,R/255,G/255,B/255,1]  // Linear List for drawRGBFlist()
Greetings,
Ilir

Bert Mariani

unread,
Oct 12, 2023, 3:11:23 PM10/12/23
to The Ring Programming Language
Hello Mahmoud, Illir et ALL

Attached:  pixelColor-RGBV-Zipped.zip
                   has pixelColor-RGBV.ring  and Images

Main Question: As the Image file gets bigger, the read pixel routine for color values gets slower.
Is there a function that has a built-in reader to get the pixel colors into an array ?

Steps:
     - Select - an Image from DropDown list at TopLeft
     - Click - GetImagePixels  to read the image pixel and position values
     - Use  Red, Green, Blue, Alpha, GrayScale to  reduce a color value
     - Click - ChangeColorValues
     
Include images to play with color values and gray scale
  - PotatoGirl.png
  - Flower.png
  - AfghanGirl.png    ( Sharbat Gula)
  - Tiger.png
  - Butterfly.png

=====================
SPEED

Image Picked: PotatoGirl
Image W-H: 200-300
GetPixelColors.....:   Total Time: 3.25 seconds
DrawRBGAImagePixels:   Total Time: 0.10 seconds

Change-ColorValue..:   Total Time: 0.82 seconds
DrawRBGAImagePixels:   Total Time: 0.06 seconds

Image Picked: Tiger
Image W-H: 626-417
GetPixelColors.....:   Total Time: 34.78 seconds
DrawRBGAImagePixels:   Total Time: 0.42 seconds

Change-ColorValue..:   Total Time: 3.94 seconds
DrawRBGAImagePixels:   Total Time: 0.34 seconds

================================

Ex-Tiger-No-Green.png

Ex-Tiger-GrayScale.png
pixelColor-RGBV-Zipped.zip

Ilir Liburn

unread,
Oct 12, 2023, 3:29:21 PM10/12/23
to The Ring Programming Language
Hello Bert,

Read last post by Mahmoud (about stbi_bytes2list).

Greetings,
Ilir.

Bert Mariani

unread,
Oct 13, 2023, 10:42:41 AM10/13/23
to The Ring Programming Language
Hello Mahmoud, Illir

Thank you for the  library  "stbimage.ring" , it really speeds up  the reading of the image pixels

Two issues can up while testing  pixelColor-RGBV-9.ring with the  library  "stbimage.ring"
Attached: "pixelColor-RGBV-9-Zipped.zip"   

1.   Format looks Y-X Col-Row rather than X-Y Row-Col
      It should scan horizontally then vertically.
  Entry           Position        RGBV     
  59596 = 196-298   0.78 0.67 0.46 1
 59597 = 197-298   0.78 0.67 0.46 1
 59598 = 198-298   0.78 0.67 0.46 1
 59599 = 199-298   0.78 0.66 0.44 1
 59600 = 200-298   0.78 0.66 0.44 1
 59601 = 1-299     0.80 0.48 0.05 1
 59602 = 2-299     0.80 0.48 0.05 1
 59603 = 3-299     0.89 0.73 0.38 1
 59604 = 4-299     0.89 0.73 0.38 1
 59605 = 5-299     0.91 0.78 0.46 1

2. The  smaller PNG images are read in and handled OK.
    The larger PNG images - example - TigerPNG  239k - causes a crash  ???
    Using the JPG image - TigerJPG  29k - displays OK  - no transparency background
    Both the Tiger  PNG and JPG have the same  Width-Height:  626-417 

Image Picked: SharbatGula
Image W-H: 254-400 Size: 101600
GetPixelColors.....: Size (bytes): 304800
Width : 254
Height: 400
Channels: 3
  Total Time: 1.43 seconds
DrawRBGAImagePixels:   Total Time: 0.14 seconds

Change-ColorValue..:   Total Time: 1.29 seconds

DrawRBGAImagePixels:   Total Time: 0.10 seconds

Image Picked: TigerJPG
Image W-H: 626-417 Size: 261042
GetPixelColors.....: Size (bytes): 783126
Width : 626
Height: 417
Channels: 3
  Total Time: 3.66 seconds
DrawRBGAImagePixels:   Total Time: 0.29 seconds

Change-ColorValue..:   Total Time: 3.42 seconds
DrawRBGAImagePixels:   Total Time: 0.28 seconds

Image Picked: TigerPNG
Image W-H: 626-417 Size: 261042
GetPixelColors.....:  =>  crash

*/
Ex-Tiger-JPG.jpg
pixelColor-RGBV-9-Zipped.zip

Ilir Liburn

unread,
Oct 13, 2023, 1:25:45 PM10/13/23
to The Ring Programming Language
Hello Bert,

1. both Ring functions seems to be correct, drawing pixels horizontally from left (0) to right (x), top (0) to bottom (y). In your previous code you had

           for i = 0 to imageStock.Width() -1          // 200
                for j = 0 to imageStock.Height() -1    // 300

drawing images vertically from top (0) to bottom (y), left (0) to right (x)

2. You need to use STBI_rgb_alpha because PNG includes alpha channel (JPG doesn't)

Greetings,
Ilir

Bert Mariani

unread,
Oct 13, 2023, 4:04:28 PM10/13/23
to The Ring Programming Language
Hello Illir. Mahmoud

This doesn't work.  STBI_rgb_alpha

# Ring will Free cData automatically in the end of the program
    cData = stbi_load(ImageFile,:width,:height,:channels,STBI_rgb_alpha)

Both the JPG and PNG have "Alpha" = 1

Result form "PotatoGirl.png"  - small file  
No color, multiple partial images  using ,STBI_rgb_alpha

It was good before with plain  "STBI_rgb"

Ex-PotatoGirl-PNG-Alpha.jpg

Image Picked: PotatoGirl
Image W-H: 200-300 Size: 60000
GetPixelColors.....: Size (bytes): 180000
Width : 200
Height: 300
Channels: 3
  Total Time: 0.66 seconds
DrawRBGAImagePixels:   Total Time: 0.05 seconds

Change-ColorValue..:   Total Time: 0.76 seconds
DrawRBGAImagePixels:   Total Time: 0.07 seconds

Ilir Liburn

unread,
Oct 13, 2023, 5:16:15 PM10/13/23
to The Ring Programming Language
Hello Bert,

you need to check number of channels before loading image

   # Image Information
    width=0 height=0 channels=0
   
stbi_info(ImageFile,:width,:height,:channels)

    ? "Width : " + width
    ? "Height: " + height
    ? "Channels: " + channels

   # Ring will Free cData automatically in the end of the program
if channels = 3
    cData = stbi_load(ImageFile,:width,:height,:channels,STBI_rgb)
else

    cData = stbi_load(ImageFile,:width,:height,:channels,STBI_rgb_alpha)
ok

etc.

Greetings,
Ilir

Ilir Liburn

unread,
Oct 13, 2023, 5:39:03 PM10/13/23
to The Ring Programming Language
Hello Bert,

you see multiple partial images because ring_stbi_bytes2list doesn't read alpha channel from the buffer,  function assumes buffer is in rgb form.

We neeed ring_stbi_alpha_bytes2list function or you can manually remove alpha channel from the buffer.

BTW: documentation is listing desired_channels as parameter, but Ring version doesn't have it.

Greetings,
Ilir

Ilir Liburn

unread,
Oct 13, 2023, 6:05:24 PM10/13/23
to The Ring Programming Language
Hello Bert,

here is the part which removes alpha channel from PNG

   # Convert to [x,y,r,g,b] List
if channels = 3
    aList = STBI_Bytes2List(cData,width,height)
else
size = len(cData)
cData2 = ""
for i = 1 to size step 4
cdata2 += cData[i]
cdata2 += cData[i+1]
cdata2 += cData[i+2]
next
    aList = STBI_Bytes2List(cData2,width,height)
ok

Greetings,
Ilir

Bert Mariani

unread,
Oct 13, 2023, 7:48:38 PM10/13/23
to The Ring Programming Language
Hi Illir, Mahmoud

Sorry to say ... this didn't work either
PotatoGirl.png  just shows a white rectangle

Note:
    cData = stbi_load(ImageFile,:width,:height,:channels,STBI_rgb)
    Would work for SMALL PNG  files (colors and all ),  but not for LARGER PNG  files
    It would work for Larger JPG file (colors and all)

Ex-PotatoGirl-Blamk.jpg

Ilir Liburn

unread,
Oct 13, 2023, 8:19:44 PM10/13/23
to The Ring Programming Language
Hello Bert,

find attached version which works for any image listed.

Greetings,
Ilir
pixelColor-RGBV-9.ring

Bert Mariani

unread,
Oct 13, 2023, 10:50:36 PM10/13/23
to The Ring Programming Language
Hello Illir

Thanks !!! It works now. All images are displayed

Here is what I can figure out.
All the images are PNG  except for the Tiger which has 2 - a PNG and a JPG
The PNG's that were "plain"  show 3 channels
The PNG's that were made "transparent" show 4 channels
The JPG sows 3 channels.

That's why the "Smaller PNG" worked. I had not made them transparent.
Whereas the :Larger PNG" failed.  I had made them "transparent" using Paint 3D

Looks like "transparency" turns on the 4th Channel

============================

Image Picked: PotatoGirl       <<<<  PNG

Image W-H: 200-300 Size: 60000
GetPixelColors.....: Size (bytes): 180000
Width : 200
Height: 300
Channels: 3
  Total Time: 0.67 seconds

DrawRBGAImagePixels:   Total Time: 0.05 seconds


Image Picked: Flower              <<<<  PNG
Image W-H: 457-360 Size: 164520
GetPixelColors.....: Size (bytes): 493560
Width : 457
Height: 360
Channels: 3
  Total Time: 2.16 seconds
DrawRBGAImagePixels:   Total Time: 0.20 seconds


Image Picked: SharbatGula          <<<<  PNG

Image W-H: 254-400 Size: 101600
GetPixelColors.....: Size (bytes): 304800
Width : 254
Height: 400
Channels: 3
  Total Time: 1.30 seconds
DrawRBGAImagePixels:   Total Time: 0.12 seconds


Image Picked: AfghanGirl           <<<<  PNG
Image W-H: 500-326 Size: 163000
GetPixelColors.....: Size (bytes): 652000
Width : 500
Height: 326
Channels: 4                <<<< Transparency 
  Total Time: 2.42 seconds
DrawRBGAImagePixels:   Total Time: 0.19 seconds


Image Picked: TigerPNG            <<<<  PNG

Image W-H: 626-417 Size: 261042
GetPixelColors.....: Size (bytes): 1044168
Width : 626
Height: 417
Channels: 4             <<<< Tranparency
  Total Time: 3.88 seconds

DrawRBGAImagePixels:   Total Time: 0.28 seconds


Image Picked: TigerJPG            <<<< JPG

Image W-H: 626-417 Size: 261042
GetPixelColors.....: Size (bytes): 783126
Width : 626
Height: 417
Channels: 3              <<<< JPG
  Total Time: 3.52 seconds
DrawRBGAImagePixels:   Total Time: 0.30 seconds


Image Picked: Butterfly            <<<<  PNG
Image W-H: 600-570 Size: 342000
GetPixelColors.....: Size (bytes): 1368000
Width : 600
Height: 570
Channels: 4                 <<<< Transparency
  Total Time: 6.49 seconds
DrawRBGAImagePixels:   Total Time: 0.37 seconds

Ilir Liburn

unread,
Oct 14, 2023, 6:47:14 AM10/14/23
to The Ring Programming Language
Hello Bert,

You're Welcome. Note: by removing alpha channel from the image, we lost possibility to write our own paint program pasting masked image. We really need bytes2list alpha version.

Furthermore, images can be 32 bit (RGBA), 24 bit (RGB) or 16 bit (each channel uses two bytes or use color palette - RGB565)

Greetings,
Ilir

Bert Mariani

unread,
Oct 14, 2023, 1:21:28 PM10/14/23
to The Ring Programming Language
Hello Ilir, Mahmoud

Issue with  GIF images.

Update:  pixelColor-RGBV-10-Zipped.zip
                pixelColor-RGBV-10.ring

BlackBuck and LadyBug are GIF images
Getting message  "QPixmap::scaled: Pixmap is a null pixmap "  ??? 
They are not being read in by STBI_Bytes2List, but there is some code in the library for GIF
They show as Width 0, Height 0, Channels 0

========================

Image Picked: PotatoGirl
Image W-H: 200-300 Size: 60000
Size (bytes): 180000
Width : 200
Height: 300
Channels: 3
GetPixelColors.....:   Total Time: 0.68 seconds
DrawRBGAImagePixels:   Total Time: 0.04 seconds

Image Picked: BlackBuck
QPixmap::scaled: Pixmap is a null pixmap   ???
Image W-H: 0-0 Size: 0
Size (bytes): 0
Width : 0
Height: 0
Channels: 0

GetPixelColors.....:   Total Time: 0.05 seconds
DrawRBGAImagePixels:   Total Time: 0.00 seconds
pixelColor-RGBV-10-Zipped.zip

Ilir Liburn

unread,
Oct 14, 2023, 1:57:05 PM10/14/23
to The Ring Programming Language
Hello Bert,

BlackBuck and LadyBug are BMP images. Simply use bmp extension in file name...

Greetings,
Ilir

Bert Mariani

unread,
Oct 14, 2023, 5:25:48 PM10/14/23
to The Ring Programming Language
Thanks Ilir !!!  I must have been seeing cross-eyed after a while.

It is now working with all image types.
I think I am am done for now.
Works with  --  PNG,  PNG-Transparent,  JPG,  BMP,  GIF image types

Next challenges / projects
 -  With the C-Code interface to modify the  R,G,B.A values in the Image-Array-List  for quicker speed.
  - Take a Grey-Scale picture and Colorize it. 
  - Morph 2 images from Image-A to Image-B. It will need animation.
  - Linear Transform an Image:  Rotate, Scale, Shear, Transpose, Reflection

Attached: pixelColor-RGBV-10-Zipped.zip
                   pixelColor-RGBV-10.ring
                   Images:  PNG,  PNG-Transparent, JPG, BMP, GIF

PotatoGirl.png
Flower.png
Sharbat_Gula.png
AfghanGirl.jpg
Tiger.jpg
Tiger.png        transparent
Butterfly.png  transparent
LadyBug.bmp
BlackBuck.bmp
Spiral.gif
Rotate.gif
========================

BlackBuck.BMP
Ex-BMP.jpg

pixelColor-RGBV-10-Zipped.zip

Ilir Liburn

unread,
Oct 14, 2023, 6:17:41 PM10/14/23
to The Ring Programming Language
Hello Bert,

AfghanGirl is PNG; not JPG (won't read). You probably wanted JPG here because AfghanGirl is based on SharbatGula PNG.

Greetings,
Ilir

Bert Mariani

unread,
Oct 15, 2023, 2:52:34 PM10/15/23
to The Ring Programming Language
Hello Ilir

Thanks !
Added  AfghanGirl.JPG  to the list of images in the zip file. 

     - pixelColor-RGBV-10-Zipped.zip
     - pixelColor-RGBV-1-.ring
pixelColor-RGBV-10-Zipped.zip

Mahmoud Fayed

unread,
Oct 15, 2023, 2:57:51 PM10/15/23
to The Ring Programming Language
Hello Bert

Suggestion: Adding a button to select an image file (This way, we can use the application with any image without modifying the source code) : Desktop, WebAssembly and Mobile Development using RingQt — Ring 1.18 documentation (ring-lang.github.io) 

Greetings,
Mahmoud

Bert Mariani

unread,
Oct 17, 2023, 3:22:28 PM10/17/23
to The Ring Programming Language
Hello Mahmoud, Ilir et ALL

Thanks for the suggestion Mahmoud !

Attached:  renamed
                   ImagePixelColor-1-Zipped.zip
                   ImagePixelColor-1.ring    
                   Included images

Added:  FileRead button  to select an image file in the current directory.
               You can download any image from the Internet and save it here.
               
CheckBox
  - GrayScale  converts a color image to black and white
  - Colorize converts a black and white image to color
         The original color values of each pixel are lost in the black and white image - average value
          The Colorize makes and attempt to restore color. All the Red pixel have same value etc ...
          You can play with the Sliders to add or remove some RGB color
          

Example-1.png
ImagePixelColor-1-Zipped.zip

Mahmoud Fayed

unread,
Oct 19, 2023, 11:43:27 AM10/19/23
to The Ring Programming Language
Hello Bert, Ilir

Thank you very much :D

Keep up the GREAT WORK 

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Oct 19, 2023, 12:00:04 PM10/19/23
to The Ring Programming Language
Hello Bert, Ilir

Added to Ring Website - News Section:

website.png
Greetings,
Mahmoud

Bert Mariani

unread,
Nov 10, 2023, 2:12:23 PM11/10/23
to The Ring Programming Language
Hello Mahmoud, Ilir et ALL

Updated:  ImagePixel-2.ring
Added:     mylibCalcColor.c        ( C interface code for Calculator. Speeds up calculations 10-12 times)
To build -- mylibCalcColor.dll      run --  buildvc-mylibCalcColor.bat  ( Uses Visual Studio )

Now, if we could only get the  Image Pixel Colors extracted quicker from  "stbimage.ring"

//===========================================
// Could Not Attach the batch file as per google groups
// buildvc-mylibCalcColor.bat 

cls
call c:\ring\language\src\locatevc.bat          
cl /c /DEBUG mylibCalcColor.c -I "C:\ring\language\include"
link /DEBUG mylibCalcColor.obj c:\ring\lib\ring.lib /DLL /OUT:mylibCalcColor.dll /SUBSYSTEM:CONSOLE,"5.01"
del mylibCalcColor.obj
pause
//=======================

OUTOUT TIMING:

Loading Library - the DLL for the mylibCalcColor()
Windows loaded mylibCalcColor.dll
Image W-H: 500-645 Size: 322500
Size (bytes): 967500
Width : 500
Height: 645
Channels: 3
GetPixelColors.....:  Total Time: 5.83 seconds
Ring ColorChange...:  Total Time: 4.08 seconds
C-Calc ColorChange.:  Total Time: 0.39 seconds


Image W-H: 626-417 Size: 261042
Size (bytes): 1044168
Width : 626
Height: 417
Channels: 4
GetPixelColors.....:  Total Time: 4.20 seconds
Ring ColorChange...:  Total Time: 3.14 seconds
C-Calc ColorChange.:  Total Time: 0.29 seconds



mylibCalcColor.c
ImagePixel-2.ring
Flower.png

Mahmoud Fayed

unread,
Nov 10, 2023, 3:22:13 PM11/10/23
to The Ring Programming Language
Hello Bert

>> "Now, if we could only get the  Image Pixel Colors extracted quicker from  "stbimage.ring"

Most of the delay happens because of the time invested in creating the list
A solution could be creating the list using the List() function (Which is optimized)
Then passing this list as parameter to ring_stbi_bytes2list() function
In the extension

Get it as parameter using RING_API_GETLIST()

And instead of using ring_list_newlist_gc() and ring_list_adddouble_gc()
We can use ring_list_getlist() and ring_list_setdouble_gc() functions

Try these updates
This could provide a faster function (from 3x to 5x faster)

Greetings,
Mahmoud

Ilir Liburn

unread,
Nov 10, 2023, 4:29:16 PM11/10/23
to The Ring Programming Language

Hello Bert,

Image Pixel Colors are extracted by the STBI_Bytes2List. Only possible optimization here is to join stbi_load and STBI_Bytes2List into one function, e.g. to return list instead of string (bytes). Requires improved "stbrimage.ring" .

For the second case where alpha channel is used, instead of copying RGB without alpha to a new list, you can simply delete alpha channel from the list (by removing every 4th element).

Greetings,
Ilir

Bert Mariani

unread,
Nov 13, 2023, 8:29:02 PM11/13/23
to The Ring Programming Language
Hello Mahmoud,Ilir

On two of the larger images was only able to increase speed ~ 20%
GetPixelColors.....:  Total Time: 4.74 seconds        Previous   5.83 seconds  
GetPixelColors.....:  Total Time: 3.36 seconds        Previous    4.20 seconds

Made changes to ImagePixel-4.ring
//---------------------------------------------------
    sizeXY = width * height          //<<<
   aList  =  list(sizeXY, 6)        //<<< pixels points x xyrgba
    if channels = 3
        //aList = STBI_Bytes2List(cData,width,height)
STBI_Bytes2List(cData,width,height,aList)       //<<<
    else


Made changes to stbimage.cf
//-----------------------------------------------
List *p2List, *p2Row, *p2Col;                           // Image Array 60000 x 6  xyrgba
int            n2Row,  n2Col;
int   x, y, k=1;
 
p2List = RING_API_GETLIST(4);                           // <==== PARAMTER 4
n2Row  = ring_list_getsize(p2List);                     //  Rows 60000x6
p2Row  = ring_list_getlist(p2List, n2Row);              // *Pointer to Row in List, to get Col
n2Col  = ring_list_getsize(p2Row);                      //  Cols 6

for ( y=1; y <= RING_API_GETNUMBER(3); y++)
{  for ( x=1; x <= RING_API_GETNUMBER(2); x++)
   {
p2Row  = ring_list_getlist( p2List, k);       // *Pointer to Row-X start of Col-Y
ring_list_setdouble(p2Row, 1,  x);      
ring_list_setdouble(p2Row, 2,  y);        
ring_list_setdouble(p2Row, 3,  pData[nIndex++]);    
ring_list_setdouble(p2Row, 4,  pData[nIndex++]);    
ring_list_setdouble(p2Row, 5,  pData[nIndex++]);    
ring_list_setdouble(p2Row, 6,  1.0);                
        k++;
   }
}  

RING_API_RETLIST(p2List);

//--------------------------------------------

//=============================
OUTPUT

Image W-H: 500-645 Size: 322500
stbi_info: W: 500 H: 645 C: 3

Size (bytes): 967500
Width : 500
Height: 645
Channels: 3
GetPixelColors.....:  Total Time: 4.74 seconds               Previous   5.83 seconds
DrawRBGAImagePixels:   Total Time: 0.38 seconds
C-Calc ColorChange.:  Total Time: 0.41 seconds
DrawRBGAImagePixels:   Total Time: 0.43 seconds


Image W-H: 626-417 Size: 261042
stbi_info: W: 626 H: 417 C: 4

Size (bytes): 1044168
Width : 626
Height: 417
Channels: 4
GetPixelColors.....:  Total Time: 3.36 seconds             Previous   4.20    seconds
DrawRBGAImagePixels:   Total Time: 0.23 seconds
C-Calc ColorChange.:  Total Time: 0.31 seconds
DrawRBGAImagePixels:   Total Time: 0.33 seconds
stbimage.cf
ImagePixel-4.ring

Mahmoud Fayed

unread,
Nov 13, 2023, 9:48:14 PM11/13/23
to The Ring Programming Language
Hello Bert

Since you have written a C extension to process the pixels
Then there is not need to use Ring lists in the process

Just get the bytes from stbimage --> Then process these bytes directly without conversion to Lists.

Greetings,
Mahmoud

Ilir Liburn

unread,
Nov 14, 2023, 6:56:28 AM11/14/23
to The Ring Programming Language
Hello Bert,

while converting your C extension to process bytes, do not send bytes as argument to the C function because that is a string and every string in Ring is copied (can take several megabytes of data). Use varptr to send pointer to bytes ( like varptr(:cData,"char") ) and then use RING_API_GETCPOINTER(x,"char") to get pointer to bytes (C array!).

Note: you don't return anything from C function because strings or lists (unless referenced) are copied at return. You simply process external data in this case.

Greetings,
Ilir

Bert Mariani

unread,
Nov 15, 2023, 10:35:09 AM11/15/23
to The Ring Programming Language
Hello Mahmoud, Ilir

RE: "just get the bytes from stbimage --> Then process these bytes directly without conversion to Lists."

Not sure how to do that directly since the "bytes in the file" need X-Y position vales to be added
Each "x, y, r, g, b, a"  needs to be a (double) in the List.  

The  drawRGBFList requires a List .
Where the the string of "r,g,b" or "r,g,b,a" in the image file and X and Y positions need to be inserted in a List

//================
    aList = ExtractImageRGB(DisplayImage)   // <<<=== Call  stbi_load  Extract "r,g,b" bytes to aList  
    MCOrig   = aList
    ....
    daVinci.drawRGBFList(MCImage)   //  <<<  List = MCOrig 

             

Mahmoud Fayed

unread,
Nov 15, 2023, 10:49:40 AM11/15/23
to The Ring Programming Language
Hello Bert

It demonstrates using the drawPixmap() method to draw images quickly using QPainter

(2) Check this C library (stb_image_write.h) :  stb/stb_image_write.h at master · nothings/stb (github.com)
That can be used to write image files

So using stb 
(1) Load the Image
(2) Process the bytes directly using C code
(3) Write the Image

Then using QPainter draw the image
This will provide very high speed + A library/extension that could be used in other applications in the future.

Greetings,
Mahmoud 

Mahmoud Fayed

unread,
Nov 25, 2023, 10:27:04 PM11/25/23
to The Ring Programming Language
Hello Bert

I updateed the application source code, Ring API, RingStbImage extension & RingQt QPainter class to have a faster version


Once we select an image using (Open File) we will see the image directly (No waiting here) and then the load process will start
In most cases the image will be loaded while the user set the other options 
This decreases the importance of (GetPixelColors) time, where what is more important is the (Change-ColorValue) time which is now less than the loading time :D

Some results on my machine 

result2.png
result3.png

result5.png

result7.png

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 26, 2023, 12:36:36 AM11/26/23
to The Ring Programming Language
Hello


Now stbi_bytes2list() is seventeen times faster (17x)
large images could be loaded now very fast

For example, the escapegame.png image is loaded in 0.1 seconds instead of 1.73 seconds.

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 26, 2023, 1:13:57 AM11/26/23
to The Ring Programming Language
Hello

Now changing image colors is 2.5x faster

good.png

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 26, 2023, 11:34:37 AM11/26/23
to The Ring Programming Language
Hello Mahmoud

This is Fantastic news !! Great performance update.

I have been working on the C-code for STBI.
I am not as quick as you are  :D

Got some of it to work.
Get lots or warnings on the STBI headers using Visual Studio C
Will try to make a simple library.
    Image_load( image, function)
    Image_write
    Image_info
    Image_free
    Image_to_gray
    Image_to_sepia

Mahmoud Fayed

unread,
Nov 26, 2023, 11:52:36 AM11/26/23
to The Ring Programming Language
Hello Bert

>> "Will try to make a simple library."

Nice idea to provide functions that process the image directly
Also, there are two other direction that we can explorer in the future
1 - Providing functions for Ring lists that process a column directly, Like setting all items in a column with a specific value, or we multiply/divide a column. This will be faster than using Loops to process each item alone.
2 - Providing support for a library like OpenCV

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 26, 2023, 12:39:22 PM11/26/23
to The Ring Programming Language
Hello Mahmoud

I downloaded the new  files -- see attached  --
  - ImagePixel.ring      to C:/MyStuff/AA-ImagePixel-MF/
 - ring_stbimage,c       to C:\ring\extensions\ringstbimage
 - stbimage.cf              to C:\ring\extensions\ringstbimage

Am I missing something ?
I got this error
Line 241 Bad parameters count!
In stbi_bytes2list() In function changecolorvalue() in file C:/MyStuff/AA-ImagePixel-MF/ImagePixel.ring

# We keep calling STBI_Bytes2List() to get the List which is faster than copying it using assignment

MCOrig = STBI_Bytes2List(:cData,nDataWidth,nDataHeight,nDataChannels,255)



Snap2.png


ring_stbimage.c
stbimage.cf
ImagePixel.ring

Mahmoud Fayed

unread,
Nov 26, 2023, 12:44:32 PM11/26/23
to The Ring Programming Language
Hello Bert

After downloading stbimage.cf
run gencode.bat
then buildvc.bat or buildvc_x64.bat

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 26, 2023, 12:47:33 PM11/26/23
to The Ring Programming Language
Hello Bert

>> "Am I missing something ?"

I updated Ring API and added RING_API_NEWLISTUSINGBLOCKS1D and RING_API_NEWLISTUSINGBLOCKS2D 

So, it's important to build Ring from source code too.
Then build stbimage

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 26, 2023, 1:05:37 PM11/26/23
to The Ring Programming Language
Hello Bert

You can download a binary release for the ImagePixel application from this link: https://www.dropbox.com/scl/fi/r1zl61oyejbb0dk6n7wux/ImagePixel.zip?rlkey=337fdqvbe45p9r0gi38fienf3&dl=0

So you can try all of the updates to the app, stbimage, Ring API & RingQt too

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 26, 2023, 10:45:07 PM11/26/23
to The Ring Programming Language
Hello Mahmoud

RE:  "... You can download a binary release for the ImagePixel application from this ..."
This worked. Thanks !!

RE:  "... run gencode.bat              <<< Ran ok
              then buildvc.bat ... "       <<< Had an error

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.3.6
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31630 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

ring_stbimage.c
ring_stbimage.c(201): warning C4047: '=': 'List *' differs in levels of indirection from 'int'
Microsoft (R) Incremental Linker Version 14.33.31630.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library ..\..\bin\ring_stbimage.lib and object ..\..\bin\ring_stbimage.exp
ring_stbimage.obj : error LNK2019: unresolved external symbol _RING_API_NEWLISTUSINGBLOCKS2D referenced in function _ring_stbi_bytes2list
..\..\bin\ring_stbimage.dll : fatal error LNK1120: 1 unresolved externals
Press any key to continue . . .

////////////////////////////////
Then tried


After downloading these 2 files
Ran    gencode.bat
           buildvc.bat      <<< got this error

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.3.6
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31630 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

ring_stbimage.c
Microsoft (R) Incremental Linker Version 14.33.31630.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library ..\..\bin\ring_stbimage.lib and object ..\..\bin\ring_stbimage.exp
ring_stbimage.obj : error LNK2019: unresolved external symbol _ring_vm_api_isstring referenced in function _ring_stbi_load_from_memory
ring_stbimage.obj : error LNK2019: unresolved external symbol _ring_vm_api_isnumber referenced in function _ring_stbi_load_from_memory
ring_stbimage.obj : error LNK2019: unresolved external symbol _ring_vm_api_getstring referenced in function _ring_stbi_load_from_memory
ring_stbimage.obj : error LNK2019: unresolved external symbol _ring_vm_api_getnumber referenced in function _ring_stbi_load_from_memory
ring_stbimage.obj : error LNK2019: unresolved external symbol _ring_vm_api_newlistusingblocks referenced in function _ring_stbi_bytes2list
..\..\bin\ring_stbimage.dll : fatal error LNK1120: 5 unresolved externals
Press any key to continue . . .

Mahmoud Fayed

unread,
Nov 26, 2023, 11:48:14 PM11/26/23
to The Ring Programming Language
Hello Bert

The best thing is to use Git from the command line, get everything from GitHub and build everythings 

In 2023, These steps are too much easy than before

(1) Install Git For Windows from:  Git for Windows

(2) Open command prompt and go to a location that you will use for storing Ring then type this command



This will get a copy from the Ring source code, save it in Ring folder

(3) Open the Ring folder

cd Ring

(4) Build everything for 32bit windows

buildvc.bat

And if you want to build for 64bit windows, run buildvc_x64.bat

These batch files assume that you have Qt installed in C:\Qt\5.15.15
If you have another version like Qt 5.15.2
Just before running the batch file use
SET RING_QT_VERSION=5.15.2

All other dependencies comes with Ring

Now after building, You can run Ring or Ring Notepad using
ringpm run ringnotepad

When we update the code on GitHub, and you want to get these updates, Just get it using then next commands

cd ring
git pull

Then build again using buildvc.bat or buildvc_x64.bat

Please do this and enjoy getting Ring updates at any time today or in the future

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 27, 2023, 6:56:58 PM11/27/23
to The Ring Programming Language
Hello Mahmoud

Got the error below.
After git to download all the files to C:\  (1.92 gigs)
ran buildvc.bat  that built everthing
There is no ringnotepad !

=============================
c:\ring>dir
 Volume in drive C is Windows
 Volume Serial Number is D693-3EDC

 Directory of c:\ring

2023-11-27  06:48 PM    <DIR>          .
2023-11-27  06:36 PM               403 .gitattributes
2023-11-27  06:36 PM             2,121 .travis.yml
2023-11-27  06:36 PM    <DIR>          applications
2023-11-27  06:39 PM    <DIR>          bin
2023-11-27  06:36 PM             3,977 buildvc.bat
2023-11-27  06:36 PM             4,205 buildvc_x64.bat
2023-11-27  06:36 PM             4,663 CODE_OF_CONDUCT.md
2023-11-27  06:36 PM    <DIR>          documents
2023-11-27  06:36 PM    <DIR>          extensions
2023-11-27  06:36 PM    <DIR>          language
2023-11-27  06:37 PM    <DIR>          lib
2023-11-27  06:36 PM    <DIR>          libraries
2023-11-27  06:36 PM             1,096 LICENSE
2023-11-27  06:36 PM    <DIR>          marketing
2023-11-27  06:36 PM            31,557 README.md
2023-11-27  06:36 PM                68 RingCMD.bat
2023-11-27  06:36 PM    <DIR>          samples
2023-11-27  06:36 PM    <DIR>          tools
               8 File(s)         48,090 bytes
              11 Dir(s)  362,055,737,344 bytes free

c:\ring>
c:\ring>
c:\ring> c:\ring\bin\ringpm.exe run ringnotepad

Library File : ring_internet.dll
Line 2 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() in file ringpm.ring
c:\ring>

Mahmoud Fayed

unread,
Nov 27, 2023, 7:23:27 PM11/27/23
to The Ring Programming Language
Hello Bert

RingInternet uses LibCurl

Could you please try copying the dll files in this folder:  ring/extensions/libdepwin/LibCurl/bin at master · ring-lang/ring (github.com)
To ring/bin folder

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 27, 2023, 7:27:24 PM11/27/23
to The Ring Programming Language
Hello Bert

Thanks for the report
I have already updated buildvc.bat in this commit to copy the DLL files for libcurl and openssl to the bin folder

To try the new updates
git stash            # if you modified files and don't want to save these modifications
git pull               # Get the updated version
buildvc.bat

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 28, 2023, 8:21:11 AM11/28/23
to The Ring Programming Language
Hello Mahmound

Tried
============
To ring/bin folder
=============
To try the new updates
git stash            # if you modified files and don't want to save these modifications
git pull               # Get the updated version
buildvc.bat
=============
Still No  RingNotePad
================

Started all over

cd Ring
buildvc.bat 
================ 
Still No  RingNotePad
==================

Tried Again
============
To ring/bin folder
=============
To try the new updates
git stash            # if you modified files and don't want to save these modifications
git pull               # Get the updated version
buildvc.bat
=============
Still No  RingNotePad
================

///////////////////////////////////////////////////////////////////////
CAPTURES

buildvc.bat

..\extensions\libdepwin\pgsql\lib\libeay32.dll
..\extensions\libdepwin\pgsql\lib\libiconv-2.dll
..\extensions\libdepwin\pgsql\lib\libintl-8.dll
..\extensions\libdepwin\pgsql\lib\libpq.dll
..\extensions\libdepwin\pgsql\lib\ssleay32.dll
        5 file(s) copied.
..\extensions\libdepwin\libuv\libuv.dll
        1 file(s) copied.


c:\ring>dir
 Volume in drive C is Windows
 Volume Serial Number is D693-3EDC

 Directory of c:\ring

2023-11-28  07:52 AM    <DIR>          .
2023-11-28  07:52 AM               403 .gitattributes
2023-11-28  07:52 AM             2,121 .travis.yml
2023-11-28  07:52 AM    <DIR>          applications
2023-11-28  07:57 AM    <DIR>          bin
2023-11-28  07:52 AM             4,123 buildvc.bat
2023-11-28  07:52 AM             4,205 buildvc_x64.bat
2023-11-28  07:52 AM             4,663 CODE_OF_CONDUCT.md
2023-11-28  07:52 AM    <DIR>          documents
2023-11-28  07:52 AM    <DIR>          extensions
2023-11-28  07:52 AM    <DIR>          language
2023-11-28  07:55 AM    <DIR>          lib
2023-11-28  07:52 AM    <DIR>          libraries
2023-11-28  07:52 AM             1,096 LICENSE
2023-11-28  07:52 AM    <DIR>          marketing
2023-11-28  07:52 AM            31,557 README.md
2023-11-28  07:52 AM                68 RingCMD.bat
2023-11-28  07:52 AM    <DIR>          samples
2023-11-28  07:52 AM    <DIR>          tools
               8 File(s)         48,236 bytes
              11 Dir(s)  357,333,516,288 bytes free

c:\ring>


              11 Dir(s)  357,333,516,288 bytes free

c:\ring>git stash
Saved working directory and index state WIP on master: dc170aecec Update extensions/ringlistpro/README.md

c:\ring>git pull
warning: redirecting to https://github.com/ring-lang/ring.git/
Already up to date.

c:\ring>buildvc.bat

...
...
..\extensions\libdepwin\mysql\lib\libmysql.dll
        1 file(s) copied.
..\extensions\libdepwin\pgsql\lib\libeay32.dll
..\extensions\libdepwin\pgsql\lib\libiconv-2.dll
..\extensions\libdepwin\pgsql\lib\libintl-8.dll
..\extensions\libdepwin\pgsql\lib\libpq.dll
..\extensions\libdepwin\pgsql\lib\ssleay32.dll
        5 file(s) copied.
..\extensions\libdepwin\libuv\libuv.dll
        1 file(s) copied.

c:\ring>

c:\ring>

c:\ring>dir
 Volume in drive C is Windows
 Volume Serial Number is D693-3EDC

 Directory of c:\ring

2023-11-28  07:52 AM    <DIR>          .
2023-11-28  07:52 AM               403 .gitattributes
2023-11-28  07:52 AM             2,121 .travis.yml
2023-11-28  07:52 AM    <DIR>          applications
2023-11-28  08:04 AM    <DIR>          bin
2023-11-28  07:52 AM             4,123 buildvc.bat
2023-11-28  07:52 AM             4,205 buildvc_x64.bat
2023-11-28  07:52 AM             4,663 CODE_OF_CONDUCT.md
2023-11-28  07:52 AM    <DIR>          documents
2023-11-28  07:52 AM    <DIR>          extensions
2023-11-28  07:52 AM    <DIR>          language
2023-11-28  07:55 AM    <DIR>          lib
2023-11-28  07:52 AM    <DIR>          libraries
2023-11-28  07:52 AM             1,096 LICENSE
2023-11-28  07:52 AM    <DIR>          marketing
2023-11-28  07:52 AM            31,557 README.md
2023-11-28  07:52 AM                68 RingCMD.bat
2023-11-28  07:52 AM    <DIR>          samples
2023-11-28  07:52 AM    <DIR>          tools
               8 File(s)         48,236 bytes
              11 Dir(s)  357,292,195,840 bytes free

c:\ring>

 Directory of c:\ring\bin

2023-11-28  07:52 AM           266,752 curl.exe
2023-11-28  08:04 AM           713,216 folder2qrc.exe
2023-11-28  08:03 AM            76,288 ring.exe
2023-11-28  08:04 AM           833,536 ring2exe.exe
2023-11-28  08:04 AM           973,312 ringpm.exe
2023-11-28  08:04 AM           489,984 ringrepl.exe
2023-11-28  08:03 AM            73,216 ringw.exe
               7 File(s)      3,426,304 bytes
               0 Dir(s)  357,291,610,112 bytes free

c:\ring\bin>

c:\ring\bin>dir lib*.dll

 Volume in drive C is Windows
 Volume Serial Number is D693-3EDC

 Directory of c:\ring\bin

2023-11-28  07:52 AM           290,816 libcurl.dll
2023-11-28  07:52 AM         1,212,928 libeay32.dll
2023-11-28  07:52 AM           387,072 libFLAC-8.dll
2023-11-28  07:52 AM           550,912 libfreetype-6.dll
2023-11-28  07:52 AM         1,015,973 libiconv-2.dll
2023-11-28  07:52 AM         1,550,023 libintl-8.dll
2023-11-28  07:52 AM           224,256 libjpeg-9.dll
2023-11-28  07:52 AM           245,248 libmodplug-1.dll
2023-11-28  07:52 AM           339,456 libmpg123-0.dll
2023-11-28  07:52 AM         4,903,936 libmysql.dll
2023-11-28  07:52 AM            47,104 libogg-0.dll
2023-11-28  07:52 AM           114,688 libopus-0.dll
2023-11-28  07:52 AM            49,664 libopusfile-0.dll
2023-11-28  07:52 AM           198,656 libpng16-16.dll
2023-11-28  07:52 AM           239,104 libpq.dll
2023-11-28  07:52 AM           428,544 libtiff-5.dll
2023-11-28  07:52 AM           214,528 libui.dll
2023-11-28  07:52 AM           148,992 libuv.dll
2023-11-28  07:52 AM           196,608 libvorbis-0.dll
2023-11-28  07:52 AM            63,488 libvorbisfile-3.dll
2023-11-28  07:52 AM           415,744 libwebp-7.dll
              21 File(s)     12,837,740 bytes
               0 Dir(s)  357,291,610,112 bytes free

c:\ring\bin>


MOHANNAD ALDULAIMI

unread,
Nov 28, 2023, 11:56:54 AM11/28/23
to The Ring Programming Language
Hello mr. Mahmoud,Mr. Bert , Mr.  Ilir 

I also do the same to get the latest update of ring 1.19 before the development finished ...

I just ran this file "buildvc_x64.bat"  ,then it had built after ends of process this files:
folder2qrc.exe
ring.exe
ring2exe.exe
ringpm.exe
ringrepl.exe
ringw.exe


and when I load "stdlib.ring" the file can not be executed it tells me error while loading dynamic library,but the file "libmysql.dll" and "ring_mysql.dll" are exists in bin folder...

also ringQt did not built from source code and i could  not build it because it needs Qt Creator ...

I hope that was helpful for you...
Best wishes...

Mohaannad 

Mahmoud Fayed

unread,
Nov 28, 2023, 12:06:54 PM11/28/23
to The Ring Programming Language
Hello Bert, Mohannad

What about the system PATH?

is ring/bin folder added to the PATH?
is ring/bin folder of another release (like Ring 1.18) is added to the PATH which lead to conflict?
what is the Windows version?

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 28, 2023, 12:09:52 PM11/28/23
to The Ring Programming Language
Hello Bert

Suggestion (Looks strange but could help to discover the missing files)

After (git clone) and having Ring 1.19 source code
Copy ring/bin folder from Ring 1.18 and replace ring/bin folder in Ring 1.19 and accept replacing the files
Then build Ring 1.19 using buildvc.bat

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 28, 2023, 12:30:10 PM11/28/23
to The Ring Programming Language
Hello

On my machine, I change ring/bin folder for Ring 1.19 to ring/oldbin
Then 
git stash to have ring/bin as we have in GitHub
then
buildvc.bat

After having ring/bin and ring/oldbin 
I tried this Ring script to know the difference in DLL files between these two folders

load "stdlibcore.ring"

aList1= listallfiles("b:\ring\bin","*.dll")
aList2 = listallfiles("b:\ring\oldbin","*.dll")
for cFile in aList1
    cfile = substr(cFile,"b:\ring\bin","")
next
for cFile in aList2
    cfile = substr(cFile,"b:\ring\oldbin","")
next

for cFile in aList2
    if ! find(aList1,cFile)
       ? cFile
    ok
next

Output:

/api-ms-win-core-winrt-l1-1-0.dll
/api-ms-win-core-winrt-string-l1-1-0.dll
/FLAC.dll
/freetype.dll
/icudt54.dll
/icuin54.dll
/icuuc54.dll
/jpeg62.dll
/libcrypto-1_1-x64.dll
/libgcc_s_dw2-1.dll
/libpng16.dll
/libssl-1_1-x64.dll
/libstdc++-6.dll
/libwinpthread-1.dll
/msvcp100.dll
/msvcp120.dll
/msvcp120d.dll
/msvcp120_clr0400.dll
/msvcr100.dll
/msvcr120.dll
/msvcr120d.dll
/msvcr120_clr0400.dll
/ogg.dll
/physfs.dll
/qml/Qt/labs/location/locationlabsplugin.dll
/qml/Qt/labs/location/locationlabsplugind.dll
/qml/QtQuick/Controls.2/Material/qtquickcontrols2materialstyleplugin.dll
/qml/QtQuick/Controls.2/Material/qtquickcontrols2materialstyleplugind.dll
/ring_opengl11.dll
/ring_opengl32.dll
/theoradec.dll
/ucrtbase.dll
/ucrtbased.dll
/vccorelib140.dll
/vcomp100.dll
/vcruntime140d.dll
/vcruntime140_1.dll
/vcruntime140_clr0400.dll
/vorbis.dll
/vorbisfile.dll
/zlib.dll


Greetings,
Mahmoud

Bert Mariani

unread,
Nov 28, 2023, 1:09:49 PM11/28/23
to The Ring Programming Language
Hello Mahmound

I always install to C:\ring
I rename previous versions to C:\ring-17  C:\ring-18  etc

c:\>path
...
C:\Perl\site\bin;C:\Perl\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Ring\bin;C:\Program Files\Git\cmd;C:\Users\bert_\AppData\Local\Microsoft\WindowsApps;
c:\>

MOHANNAD ALDULAIMI

unread,
Nov 28, 2023, 1:23:45 PM11/28/23
to The Ring Programming Language
Hello Mr. Mahmoud
* I'm using windows 10 pro 64x bit,

* I always remove older versions from path and add the newer version of ring to path.

Best wishes...
Mohannad
wherering.jpg

Mahmoud Fayed

unread,
Nov 28, 2023, 1:28:13 PM11/28/23
to The Ring Programming Language
Hello Bert, Mohannad

I have updated a copy from my Ring 1.19 bin folder (for 32bit and for 64bit too)

Please extract the files, replace your ring/bin folder and try each of these versions.

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 28, 2023, 1:33:25 PM11/28/23
to The Ring Programming Language
Hello Mahmoud


c:\ring\bin>ring.exe C:\MyStuff\AA-ImageTest-MF\Test-File-Diff.ring

Line 897 Error, Couldn't open the directory   because script referred to ("b:\ring\bin","*.dll")
In dir() In function listallfiles() in file c:\ring\libraries\stdlib\stdlibcore.ring
called from line 3  in file C:\MyStuff\AA-ImageTest-MF\Test-File-Diff.ring

c:\ring\bin>
c:\ring\bin>

======================================
Changed script to  C:\     ("C:\ring\bin","*.dll")

c:\ring\bin>ring.exe C:\MyStuff\AA-ImageTest-MF\Test-File-Diff.ring

c:\ring\bin>

====================================
No differences since i how originally downloaded the files with the Git

Mahmoud Fayed

unread,
Nov 28, 2023, 1:50:16 PM11/28/23
to The Ring Programming Language
Hello Bert

Could you check my previous message.
It contains a Dropbox link that contains a copy from my bin folder.

Greetings,
Mahmoud 

Bert Mariani

unread,
Nov 28, 2023, 2:15:22 PM11/28/23
to The Ring Programming Language
Hello Mahmoud

It took a bit of time to down load  the 32bit and 64bit
  -- C:\ring\bin   replaced with 32bit
  -- ran buildvc.bat

No sign of "ringnotepad"  ???
Where is it ?

You may need a second generic laptop using GIT to download and install ring19  to  C:\
It will end up in C:\ring
It may be quicker to verify and debug.

Mahmoud Fayed

unread,
Nov 28, 2023, 2:46:36 PM11/28/23
to The Ring Programming Language
Hello Bert

>> "No sign of "ringnotepad"  ???"

The idea is to replace the bin folder in ring 1.19 that you have from GitHub
Then run using ringpm run ringnotepad

> "You may need a second generic laptop using GIT to download and install ring19  to  C:\"

I have three laptops with different OS (Windows 7, Windows 10 & Windows 11)
Also, I use Oracle VirtualBox

Sometimes we did a mistake (missing a DLL files) and it works because it's already exist on the System (for different reasons)
So, your testing for these bin folders is very important and will help in fixing the problem before it appears after Ring 1.19 release

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 28, 2023, 4:43:02 PM11/28/23
to The Ring Programming Language
Hello Mahmoud

Ran
cd c:\ring
c:\ring>ringpm run ringnotepad

================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

////////////////////////////////////

RingNotePad   STARTED !!!
But C:\ring  does not have a  RingNotePad,exe  can I can create a shortcut too.

//////////////////////////////////////

Ran "ImagePixel.ring"  in C:\ring\application\imagepixel
WORKS !!!

Image W-H: 626-417 Size: 261042
Size (bytes): 1044168
Width : 626
Height: 417
Channels: 4
GetPixelColors.....:   Total Time: 0.01 seconds
Change-ColorValue..:   Total Time: 0.07 seconds
DrawRBGAImagePixels:   Total Time: 0.26 seconds

Image W-H: 457-360 Size: 164520
Size (bytes): 493560
Width : 457
Height: 360
Channels: 3
GetPixelColors.....:   Total Time: 0.00 seconds
Change-ColorValue..:   Total Time: 0.05 seconds
DrawRBGAImagePixels:   Total Time: 0.17 seconds

Mahmoud Fayed

unread,
Nov 28, 2023, 4:51:05 PM11/28/23
to The Ring Programming Language
Hello Bert

>> "But C:\ring  does not have a  RingNotePad,exe  can I can create a shortcut too."

Just copy RingNotePad.exe from Ring 1.18 folder to Ring 1.19 (GitHub) folder
What this executable does is very simple (It just run ringw ring/tools/ringnotepad/rnote.ring)

>> "Ran "ImagePixel.ring"  in C:\ring\application\imagepixel
WORKS !!!"

This is very nice :D

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 28, 2023, 7:35:23 PM11/28/23
to The Ring Programming Language
Hello Bert

Today I updated the QPainter class by adding the drawBytes() method
Using this method we can draw images loaded by stbImage directly

Also, I update the RingListPro extension which contains now the next three functions
Bytes2List()
UpdateList()
List2Bytes()

And ImagePixel is updated to use drawBytes() which provide very fast performance when drawing images/large images.

For example the time required for displaying the Tiger image after processing is not (30ms) instead of (200ms)
This is 6 times faster (6x)


shot1.png

shot2.png

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Nov 29, 2023, 4:31:42 AM11/29/23
to The Ring Programming Language
Hello Bert

Today I update buildvc.bat & buildvc_x64.bat for Ring 1.19 in GitHub
And added the missing DLL files & RingNotepad.exe too 

Try the following to be sure that these updates works on your machine
And you no longer need the bin folder from Dropbox

open ring/bin folder and delete all of the files
Then from command prompt
cd ring
git stash
git pull
buildvc
RingNotepad

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 29, 2023, 10:44:59 AM11/29/23
to The Ring Programming Language
Hello Mahmoud

Did the following commands
     open ring/bin folder and delete all of the files ( moved the ring/bin folder to my Desktop
     Then from command prompt
     cd ring          ok
     git stash       ok
     git pull          ok
     buildvc         created new  ring/bin  folder  and  ring/RingNotepad,exe
     RingNotepad

=========================
RESULTS

c:\ring> buildvc
....

..\extensions\libdepwin\pgsql\lib\libpq.dll
..\extensions\libdepwin\pgsql\lib\ssleay32.dll
        5 file(s) copied.
..\extensions\libdepwin\libuv\libuv.dll
        1 file(s) copied.

c:\ring>RingNotepad    --- nothing happened

=================
Clicked on  C:\ring/RingNotepad.exe  --- nothing happened

Tried my old batch shortcut from the Desktop
--------------------
cd c:\ring
ringpm run ringnotepad
pause
---------------

C:\Users\bert_\Desktop>cd c:\ring


c:\ring>ringpm run ringnotepad
================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file rnote.ring
c:\ring>pause

Press any key to continue . . .

Mahmoud Fayed

unread,
Nov 29, 2023, 2:13:01 PM11/29/23
to The Ring Programming Language
Hello Bert

>> "Library File : ringqt.dll Line 5 Error (R38) : Runtime Error in loading the dynamic library"

This means loading stdlib.ring is OK (This is a step forward)
But loading guilib.ring fails 

Using buildvc.bat/buildvc_x64.bat assume that we have Qt 5.15.15 instealled in this folder: c:\Qt\5.15.15
Is Qt installed on your system?
If you have another Qt version like Qt 5.15.2 then updating the environment variables before running buildvc.bat is required

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 29, 2023, 2:31:17 PM11/29/23
to The Ring Programming Language
Hello Mahmoud

No, I have never had  C:\QT  as a separate folder.
The only QT  I have is the one under Ring

Mahmoud Fayed

unread,
Nov 29, 2023, 2:34:01 PM11/29/23
to The Ring Programming Language
Hello Bert

>> "No, I have never had  C:\QT  as a separate folder."

So, This error is expected, and Now after building from source code, anything can works if it's not releated to RingQt.
To be sure, You can try things like (ringpm run goldmagic800) or (ringpm run starsfigther)

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 29, 2023, 8:24:44 PM11/29/23
to The Ring Programming Language
Hello Mahmoud

With the new  "bin" downloaded
=====================

c:\ring>RingNotepad.exe                <<< nothing happens, it should run using the QT inside Ring

c:\ring>ringpm run goldmagic800  <<< starts   and runs ok
================================================================================
GoldMagic800 Package
================================================================================
GoldMagic800 package for the Ring programming language
See the folder : ring/applications/goldmagic800
================================================================================

c:\ring>ringpm run starsfigther
Error(3) : We don't have this package
Package Name : starsfigther


c:\ring>
==================

c:\ring>cd applications/starsfighter   <<< it exist ???

c:\ring\applications\starsfighter>dir

 Volume in drive C is Windows
 Volume Serial Number is D693-3EDC

 Directory of c:\ring\applications\starsfighter


2023-11-28  07:52 AM    <DIR>          .
2023-11-28  07:52 AM    <DIR>          ..
2023-11-28  07:52 AM    <DIR>          fonts
2023-11-28  07:52 AM    <DIR>          images
2023-11-28  07:52 AM               148 README.md
2023-11-28  07:52 AM    <DIR>          sound
2023-11-28  07:52 AM             8,361 starsfighter.ring
               2 File(s)          8,509 bytes
               5 Dir(s)  349,120,512,000 bytes free

c:\ring\applications\starsfighter>

Mahmoud Fayed

unread,
Nov 29, 2023, 8:28:40 PM11/29/23
to The Ring Programming Language
Hello Bert

>> " c:\ring>ringpm run starsfigther
Error(3) : We don't have this package"

It's starsfighter not starsfigther

A little mistake in typing the package name

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 29, 2023, 9:34:49 PM11/29/23
to The Ring Programming Language
Hello Mahmoud
ringpm run starsfighter   <<< works

This is an issue.  I don't have C:\QT  (none of the Ring users have)
It has to work with the QT inside C:\Ring
I did a complete reinstall using ---  git clone http://github.com/ring-lang/ring.git (1.99 gigs)

c:\ring>ringpm run ringnotepad     <<< not working

================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file rnote.ring
c:\ring>pause
Press any key to continue . . .

Mahmoud Fayed

unread,
Nov 29, 2023, 9:47:26 PM11/29/23
to The Ring Programming Language
Hello Bert

>> "This is an issue.  I don't have C:\QT  (none of the Ring users have)"

When we distribute a binary release from Ring, we provide all of the required DLLs - No need to build from source code.
Building from source code is an advanced option. Not for all Ring developers.
We can say it's just for us as Ring Team, So we can check development efforts before release.

>> "It has to work with the QT inside C:\Ring"

I was thinking about this, the problem is this means adding many hundreds of MB
A solution could be creating a RingPM package that install Qt 5.15 
But I think installing Qt from their official website is too much better and an easy option for now.

By the way, we have this problem only on Windows.
In Linux & macOS, the package manager installs all of the dependencies through simple commands.

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 30, 2023, 7:52:17 AM11/30/23
to The Ring Programming Language
Hi Mahmoud

I give up with this QT
I was able to find a download ZIP  qt-everywhere-src-5.15.0 
Its 2.9 gigs unzipped
QT15.15.15 says commercial

I cannot get Ring-19 to work.
I am going back to Ring-18

These batch files assume that you have Qt installed in C:\Qt\5.15.15
If you have another version like Qt 5.15.2
Just before running the batch file use
SET RING_QT_VERSION=5.15.2

====================

c:\QT>dir

 Volume in drive C is Windows
 Volume Serial Number is D693-3EDC

 Directory of c:\QT

2023-11-30  07:09 AM    <DIR>          .
2023-11-30  07:22 AM    <DIR>          qt-everywhere-src-5.15.0
               0 File(s)              0 bytes
               2 Dir(s)  336,620,249,088 bytes free

c:\QT>cd qt-everywhere-src-5.15.0

c:\QT\qt-everywhere-src-5.15.0>dir

 Volume in drive C is Windows
 Volume Serial Number is D693-3EDC

 Directory of c:\QT\qt-everywhere-src-5.15.0

2023-11-30  07:22 AM    <DIR>          .
2023-11-30  07:09 AM    <DIR>          ..
2020-05-14  05:06 AM             7,307 .gitmodules
2020-05-14  04:50 AM            79,137 .QT-ENTERPRISE-LICENSE-AGREEMENT
2020-05-14  04:50 AM            79,137 .QT-FOR-APPLICATION-DEVELOPMENT-LICENSE-AGREEMENT
2020-05-14  04:50 AM            79,137 .QT-FOR-AUTOMATION-LICENSE-AGREEMENT
2020-05-14  04:50 AM            47,369 .QT-FOR-AUTOMOTIVE-LICENSE-AGREEMENT
2020-05-14  04:50 AM

=====================

c:\ring\applications\imagepixel>c:\ring\bin\ring.exe ImagePixel.ring


Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file c:\ring\libraries\guilib\loadlibfile.ring
called from line 11  in file ImagePixel.ring
c:\ring\applications\imagepixel>

Mahmoud Fayed

unread,
Nov 30, 2023, 3:42:56 PM11/30/23
to The Ring Programming Language
Hello Bert

>> "I give up with this QT"

It's your choice, and I confirm that installing Qt is not easy as it was in the past, especially for open-source developers where we don't have the offline installer and recent patches, which exist only for commercial version users.
(I have access to these services, like getting an offline installer and recent patches, but I don't have the permission to distribute these files, What I can do is using them in Ring development and providing Ring binary release with the recent Qt 5.15 patch)

>> "I was able to find a download ZIP  qt-everywhere-src-5.15.0 "

This is Qt source code, we don't install Qt this way

Click the button: Download the Qt online installer

downloadqt.png

Using this installer, we can download Qt 5.15.2 (without commercial license)
RingQt works with any Qt 5.15 version

Once, you have Qt installed on your machine, you will get many advantages
It's not just about building RingQt from source code

(1) You can contribute to RingQt development, Add more functions/classes based on your need.
(2) You can use Qt for WebAssembly, and create a web version from your RingQt projects 
(3) You can use Qt for Android and develop Mobile applications using RingQt 

So it's a step that could take some hours to download and install
But it will open the door of many possibilities in the future.

Greetings,
Mahmoud

Bert Mariani

unread,
Nov 30, 2023, 5:14:12 PM11/30/23
to The Ring Programming Language
Hello Mahmoud

Thanks for the link
      Click the button: Download the Qt online installer

The installer downloaded and installed QT. 
It started up by itself ... ok.
Then I closed it

Qt Creator 12.0.0

Based on Qt 6.6.0 (MSVC 2019, x86_64)
Built on Nov 22 2023 07:38:51


Qt Design Studio 4.3.1

Based on Qt 6.5.2 (MSVC 2019, x86_64)
Built on Oct 11 2023 07:30:11

===================

Then I stared from scratch again. To download Ring-19

cd C:\
git clone http://github.com/ring-lang/ring.git
cd C:\ring
SET RING_QT_VERSION=5.15.2        (Don't know where in QT to find the version)
buildvc.bat                           <<< fails  after a few build iterations
ringpm run ringnotepad    <<< fails 

======================


**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.3.6
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31630 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

ring_pgsql.c
ring_pgsql.c(856): warning C4047: '=': 'char **' differs in levels of indirection from 'char *'

Microsoft (R) Incremental Linker Version 14.33.31630.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library ..\..\bin\ring_pgsql.lib and object ..\..\bin\ring_pgsql.exp
The system cannot find the path specified.
'buildvc' is not recognized as an internal or external command,
operable program or batch file.

The system cannot find the path specified.
'build' is not recognized as an internal or external command,

===============================


c:\ring>ringpm run ringnotepad
'ringpm' is not recognized as an internal or external command,
operable program or batch file.

c:\ring>

================================

Mahmoud Fayed

unread,
Nov 30, 2023, 6:18:07 PM11/30/23
to The Ring Programming Language
Hello Bert

>> "The installer downloaded and installed QT. "

It's important to install Qt5 (Not Qt6)
Because the version supported by RingQt is Qt5 (For now, Qt6 will be supported in the future)

The next screen shot demonstrates installing Qt 5.15.15 on my machine
Where I have the folder c:\Qt\5.15.15

What I expect is that you will install Qt 5.15.2 (Latest Qt5 version provided for open-source license)
So, select this version and install it, From the components, select everything as much as you can.

installqt.png

>> "The system cannot find the path specified."

Thanks for the report, This happened after rename the ListPro extension to FastPro 
The batch files are updated and the problem is fixed.

Try after installing Qt 5.15.2

git stash
git pull
set RING_QT_VERSION = 5.15.2
buildvc

Greetings,
Mahmoud

Bert Mariani

unread,
Dec 1, 2023, 8:03:45 AM12/1/23
to The Ring Programming Language
Hello Mahmoud

Tried again. Failed

QT when I select  QT 5,15.2   --- shows install size  56 Gigs !!!
This seemed like a ridiculous size.
When I expand the subcomponents and removed some --- shows 16 Gigs !!
Still way too big.
After removing MSVC 2019 32 bit and 64 bit --- shows 1 Gig
So I proceeded with the install.   (QT 6 was 2.3 Gigs ) 
See image below.

Still frustrated that "ringpm run ringnotepad "   <<< fails 
It should not need C:\QT to run since Ring had the QT DLL;s built it

=============================
cd C:\
git clone http://github.com/ring-lang/ring.git
cd C:\ring
SET RING_QT_VERSION=5.15.2        (Don't know where in QT to find the version)
buildvc.bat                          <<< worked 
ringpm run ringnotepad    <<< fails 

..\extensions\libdepwin\pgsql\lib\libpq.dll
..\extensions\libdepwin\pgsql\lib\ssleay32.dll
        5 file(s) copied.
..\extensions\libdepwin\libuv\libuv.dll
        1 file(s) copied.

c:\ring>ringpm run ringnotepad
================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file rnote.ring
c:\ring>
==========================

ringpm run goldmagic800    <<< Runs !!!

===========================

Looks bigger than your screen capture.

Snap1.png

Snap2.png

Bert Mariani

unread,
Dec 1, 2023, 8:14:07 AM12/1/23
to The Ring Programming Language
Hello Mahmoud

Not everything runs using "ringpm run xxx"

c:\ring>ringpm run ringnotepad
================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file rnote.ring


c:\ring>ringpm run goldmagic800

================================================================================
GoldMagic800 Package
================================================================================
GoldMagic800 package for the Ring programming language
See the folder : ring/applications/goldmagic800
================================================================================

c:\ring>ringpm run AnalogClock
================================================================================
AnalogClock Package
================================================================================
AnalogClock package for the Ring programming language
See the folder : ring/applications/analogclock
================================================================================

Library File : ringqt_light.dll

Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file AnalogClock.ring


c:\ring>ringpm run checkers
================================================================================
Checkers Package
================================================================================
Checkers package for the Ring programming language
See the folder : ring/applications/checkers
================================================================================

Library File : ringqt_light.dll

Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file AA-Checkerboard.ring


c:\ring>ringpm run cards
================================================================================
Cards Package
================================================================================
Cards package for the Ring programming language
See the folder : ring/applications/cards
================================================================================

Library File : ringqt_light.dll

Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file cards.ring
c:\ring>

Fuad Omari

unread,
Dec 1, 2023, 8:44:39 AM12/1/23
to The Ring Programming Language
i suggest to Mahmoud to release an alpha version setup for ring 0.19 for windows since it seems suitable for testing so the users can post bugs and tests before the final version
i have installed v0.19 from the zip file 654 mega but without the qt i can test the speed ,the math, the opengl .stb image wich does not need qt libs.

MOHANNAD ALDULAIMI

unread,
Dec 1, 2023, 12:17:26 PM12/1/23
to The Ring Programming Language
Hello Mr. Mahmoud et All,

Thanks for helping me , RingQt library worked successfully after unzip files into ring\bin folder....

but the 'stdlib.ring' did not worked I had to load stdlibcore to fix this...

it tell me this error : 
Library File : ring_mysql.dll Line 2 Error (R38) : Runtime Error in loading the dynamic library In loadlib() in file C:/ring/test.ring

I hope that would be helpful for you ...

Best wishes....
Mohannad

Mahmoud Fayed

unread,
Dec 1, 2023, 6:44:05 PM12/1/23
to The Ring Programming Language
Hello

>> " i suggest to Mahmoud to release an alpha version setup for ring".

We don't provide alpha/beta versions. 
We used to provide final releases where we have huge number of tests/samples/applications that we already use for testing to have a specific level of quality which is simple to describe (NO KNOWN ISSUES).

The source code written for Ring 1.0 in 2016 will work using Ring 1.18 or Ring 1.19 (2023)
We keep compatibility, so any discovered issues will be solved in the next release and we expect Ring developer will always upgrade once the new version is released, because there is no real reason to avoid this. 

 >> "Thanks for helping me , RingQt library worked successfully after unzip files into ring\bin folder...."

The files in dropbox are no longer up to date
It's recommended to install Qt and build everything from source code if your would like to try Ring 1.19 from GitHub 

>> "it tell me this error : Library File : ring_mysql.dll Line 2 Error (R38) : Runtime Error in loading the dynamic library In loadlib() in file C:/ring/test.ring "

This is strange, Try to build RingMySQL from source code
cd ring/extensions/ringmysql
buildvc.bat   (32bit version)
Or buildvc_x64.bat  (64bit version)

Greetings,
Mahmoud

Azzeddine Remmal

unread,
Dec 1, 2023, 9:08:54 PM12/1/23
to The Ring Programming Language
Hello Mahmoud
You have successfully completed all steps except installing Qt
Its size is large. What are the minimum requirements for building a Ring QT?
my regards

Mahmoud Fayed

unread,
Dec 1, 2023, 10:12:14 PM12/1/23
to The Ring Programming Language
Hello Bert

>> "QT when I select  QT 5,15.2   --- shows install size  56 Gigs !!!"

I tried installing Qt 5.15.2 now
Selecting MSVC 32bit, 64bit
And QML modules 
This is around 2.3 GB 

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Dec 1, 2023, 10:14:49 PM12/1/23
to The Ring Programming Language
Hello Azzeddine

>> "Its size is large. What are the minimum requirements for building a Ring QT?"

We need at least Qt libraries for one platform/compiler
Say MSVC 32bit OR MSVC 64bit
And the other modules related to QML
This is around 645MB of download size & 2GB of space after extraction.

I am thinking about providing a RingPM package that can install Qt 5.15.2
Will see if this is possible 

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Dec 1, 2023, 10:21:31 PM12/1/23
to The Ring Programming Language
Hello Bert

>> " Not everything runs using "ringpm run xxx""

When install Qt 5.15.2, You need to select MSVC 32bit or MSVC64Bit
So Qt libraries for these compilers could be installed

You should find Qt in C:\Qt\5.15.2 folder

Also open these batch files
And set Qt path 
c:\ring\buildvc.bat
c:\ring\extensions/ringqt/binupdate/installqt515.bat

The first is used to build from the source code
The second batch file is called by the first to copy Qt DLLs to ring/bin folder
Both of them need to know where is Qt install and which version

Greetings,
Mahmoud

Bert Mariani

unread,
Dec 2, 2023, 7:46:26 AM12/2/23
to The Ring Programming Language
Hello Mahmoud

      Click the button: Download the Qt online installer

See screen captures below.
We must have different QT 5.15.2  
My screen capture looks different from yours for item available.
QT was 8 Gigs after minimum items selected

Again ... Why do we need all this  C:\QT stuff just to get ringnotepad  started ???

c:\ring>ringpm run ringnotepad
================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Line 5671 Bad parameters count, the function expect four parameters
In qfont_new() In method init() in file C:\Ring\libraries\guilib\classes/ring_qt.ring
called from line 12  In function open_windownoshow() in file C:\Ring\libraries\objectslib\objects.ring
called from line 26  in file rnote.ring
c:\ring>

==============================


Snap7.png

Snap6.png

Snap5.png





Mahmoud Fayed

unread,
Dec 2, 2023, 9:27:49 AM12/2/23
to The Ring Programming Language
Hello Bert

>> "We must have different QT 5.15.2  "

It's the same, I just calculated the Qt 5.15.2 size as an update to my Qt install which already includes Qt creator & Qt 5.15.16
So, it's my mistake in calculating the total size.

>> "Again ... Why do we need all this  C:\QT stuff just to get ringnotepad  started ???"

Because it's not about starting Ring Notepad or any RingQt application
We need c:\qt to build RingQt from source code
And RingQt is a Qt project which requires Qt (development version) as a dependency. 

>> "Line 5671 Bad parameters count, the function expect four parameters
In qfont_new() In method init() in file C:\Ring\libraries\guilib\classes/ring_qt.ring"

I can't reproduce this error on my machine!!
Please try
git stash
cd ring/extensions/ringqt
gencode_core.bat
gencode_light.bat
gencode_nobluetooth.bat
cd ..\..\
SET RING_QT_VERSION=5.15.12
buildvc
RingNotepad

If this doesn't work
Try buildvc_x64 

Greetings,
Mahmoud



Bert Mariani

unread,
Dec 2, 2023, 10:46:15 AM12/2/23
to The Ring Programming Language
Hello Mahmoud

Started from scratch --- fails
Command
     --------
     Response is indented
     --------

=========================
=========================

cd  C:\
c:\>git clone http://github.com/ring-lang/ring.git
Cloning into 'ring'...

cd c:\ring
SET RING_QT_VERSION=5.15.2
buildvc.bat


c:\ring>ringpm run ringnotepad

------------

c:\ring>ringpm run ringnotepad
================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file rnote.ring
c:\ring>

------------

==================
==================


When we update the code on GitHub, and you want to get these updates,
cd ring
git pull
------------

c:\ring>git pull
warning: redirecting to https://github.com/ring-lang/ring.git/
Already up to date.

c:\ring>
------------


===================
===================


I can't reproduce this error on my machine!!Please try
git stash
-------------
c:\ring>git stash
Saved working directory and index state WIP on master: d90e8434e8 Update Documentation - What is new in Ring 1.19?

c:\ring>
-------------

cd ring/extensions/ringqt
-------------
c:\ring>cd c:\ring/extensions/ringqt

c:\ring\extensions\ringqt>
-------------


gencode_core.bat
-----------
c:\ring\extensions\ringqt>set RINGQT_NOCHARTS=

c:\ring\extensions\ringqt>
-----------

gencode_light.bat
----------------
Writing file : ..\cpp\src\gxyseries.cpp
Size : 11272 Bytes

c:\ring\extensions\ringqt\events>cd ..

c:\ring\extensions\ringqt>
----------------

gencode_nobluetooth.bat
----------------
Writing file : ..\cpp\src\gxyseries.cpp
Size : 11272 Bytes

c:\ring\extensions\ringqt\events>cd ..

c:\ring\extensions\ringqt>set RINGQT_QT515=

c:\ring\extensions\ringqt>
----------------


cd ..\..\
-------------
c:\ring\extensions\ringqt>cd ..\..\

c:\ring>
-------------

SET RING_QT_VERSION=5.15.12
-----------
c:\ring>SET RING_QT_VERSION=5.15.12

c:\ring>
-----------

buildvc
-----------------
buildvc.bat

..\extensions\libdepwin\pgsql\lib\libpq.dll
..\extensions\libdepwin\pgsql\lib\ssleay32.dll
5 file(s) copied.
..\extensions\libdepwin\libuv\libuv.dll
1 file(s) copied.

c:\ring>
-----------------

RingNotepad
-------------

c:\ring>ringpm run ringnotepad
================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file rnote.ring

c:\ring>
-------------


If this doesn't work
Try buildvc_x64

------------------
buildvc_x64.bat


c:\ring>ringpm run ringnotepad
================================================================================
RingNotepad Package
================================================================================
RingNotepad package for the Ring programming language
See the folder : ring/tools/ringnotepad
================================================================================

Library File : ringqt.dll
Line 5 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() In function loadlibfile() in file C:\Ring\libraries\guilib\loadlibfile.ring
called from line 11  in file rnote.ring
c:\ring>

------------------r

Azzeddine Remmal

unread,
Dec 2, 2023, 11:42:04 AM12/2/23
to The Ring Programming Language
Hello Bert
The problem is not in the ring files. You must install the minimum requirements for Qt to properly build the Ring Qt DLL files

Sketch2154.png
Greetings,
Azzeddine

Bert Mariani

unread,
Dec 2, 2023, 11:48:25 AM12/2/23
to The Ring Programming Language
What are the QT minimum requirements ?
I need screen captures from top to bottom
of all the items selected 
and those not selected.

Azzeddine Remmal

unread,
Dec 2, 2023, 11:59:24 AM12/2/23
to The Ring Programming Language
It is loading more messages.
0 new messages