[Pas2js] Picture serialisation into Pascal

Michael Van Canneyt michael at freepascal.org
Mon Dec 10 09:11:59 CET 2018



A couple of remarks.

> I) Parent property, this property should be the first property, for
> instance:

In general, this is incorrect. There should be no reason for this: 
a component must be able to handle this. 
The setting of properties can happen in any order, including parent.
If the component cannot handle this, it is badly written.

> II) when we use a Image component with streams,  for instance, it generates
> a wierd property ExecCustomCSP for the WebImage, which it's due a fix up;
>
>  with WebImage1 do begin
>    Name:='WebImage1';
>    Parent:=Self;
>    Left:=8;
>    Height:=90;
>    Top:=24;
>    Width:=90;
>
> The correct should 
>
> Picture.Data :=
> 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAALbSURBVHjapZNbSFRRFIb/4zUdJ23s4ozJNM6IlKYpOYGpYCmUmEVDBQZK9CBkYgXdQ7GHoB4sUlAjIg0kSZ0gCCq0UpnwGBWalTNeUvNS46Sm4+icy26fY/nQ5aUWHDZn772+tda/1mYIIfgfY34FmKp69JzIZxNezFlwcyE8EUEgjgNijcCLtS1nEvv+CthT+d7kdnNlukCiNmqDsNzHU96fdvFotX1G16hzjHoUsCXbG34DZFV0m9wurjo9wl8RHarEiMON8WkXBJEg0N8TmsBlsE3MwNzU54QXctlrWQ1LgF3lXeEcx7emGxSayBAl2IEp8DyHWO0KgJ6/GpgE48EgSh2A4ckZ3H9sGwURk9kb+/tlwI7rr4t0ClKSGauBxeqAwPFy5JLsaDm7C7VvKAjw8fJAjFaFh6wVPZ324o47By/KgG1XX9pyYlYZZl0chhyz1JkKR794vUryQ7t1fLFgelcTrIQq0Be3blp62bpDETIg6ZJl7mSa1o+1TsDl5sEJnAwoz0uUAfkVbfI/rRjeXgxSNq7F5dKHro76I/4ywFj8bO7cToPfC5sDTpeTXiZSMORnbMC6NUqcqKIAuiHBvGljUjfrcOXKA1eHueAnoMmWl6I1OKbdGLZ/gyDwEGnEo5nR0FFRC8uf0/SleSBYTUsIpV2qqWruZRsLF0swnn1UtF7tW5IRp0Pb2xEqooDdiVqkxYfBg6rf2WdHaR0riYCtm3Roslgx8G6wmG08tiii8fj9cCzwrZmpBo1OpUBb9yfwUicEAYSu5Ef0uMgwTHALeHKvdZQBklnzqf6lQUo4fNdEZuarM/ZGK8JXKvFh0A771xmIvAhV
 kD8iwoLxcWoWzfVPnWC8c6lzw2+jnHDgtgnEXaaPUquTtugRHOAjp/1leh4tlh4MddvGGMajgDWfbvjjW5DMuK9ST4iQTUXLgTgfIonHMIw0CDUMuNp28/m/P6Z/se/C+4XwIk4olAAAAABJRU5ErkJggg==")';

This is up for debate: you could actually write the image to file, and set
an URL. By putting it in the Javascript you make the javascript bigger and
take away the possibility of the browser to offload the request for the
image.

I don't know what component you use for converting .lfm to pas. 
But if you need these things, I think they are specific to the widgetset and a separate
converter component is the answer.

Michael.


More information about the Pas2js mailing list