Base64 support?

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,136
Is there base-64 support in Cerberus?

I was trying to get this working. I saw that html5 has inbuilt support for loading sounds and images from the web, so I tried it with base64 but I don't know what protocol to prefix it with?
Code:
Strict

Import mojo2
Import brl.databuffer

Function Main:Int()
    New Game
    Return 0
End
   
Class Game Extends App

    Field sprite:Image
    Field canvas:Canvas

    Method OnCreate:Int()

        canvas=New Canvas
       
        'sprite =  Image.Load("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",0,0,0)   ' A red dot

        sprite =  Image.Load("127.0.0.1/data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",0,0,0) 
       
        SetSwapInterval 1 ; SetUpdateRate 0
        Return 0
    End
 
    Method OnRender:Int()
        canvas.Clear
        canvas.DrawImage sprite,0,0
        canvas.Flush
         Return 0
    End
End
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
907
Do a search of the forums. I'm sure that something will pop up.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,136
Do a search of the forums. I'm sure that something will pop up.

Do you have insight into the Cerberus internals?

The forums has a lot of code when it comes to BASE-64 encoders and decoders, but there's no information about how to go aboutactually using BASE-64 inside LoadSound and similar commands. I have to assume it can't be done easily.

I was really after this specific solution where you'd use BASE-64 as an additional way of providing data.
DATA, INTERNAL, EXTERNAL, HTTP/HTTPS, and I wanted to see if there were a chance you could add BASE-64 on top of that. Maybe someone already thought of this, but I did not see any discussion around this.

A few people assisted me last night though and pretty much everyone estimated it would be limited, so I scratched the idea.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
907
I was really after this specific solution where you'd use BASE-64 as an additional way of providing data.
DATA, INTERNAL, EXTERNAL, HTTP/HTTPS, and I wanted to see if there were a chance you could add BASE-64 on top of that.
That would require changes to transcc to inject base64 into the meta data and the target template to process base64 meta data into a usable form.
 
Top Bottom