Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: Edivando on November 12, 2018, 12:42:31 am

Title: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Edivando on November 12, 2018, 12:42:31 am
Boa tarde, estou migrando os fontes do bgrabitmap e bgracontrols  para  Mode delphi no fpc e para delphi xe2.
Os resultados já estão bem satisfatórios gostaria de saber se o fundador do projeto poderia trocar alguns emails para analizar o trabalho realizado e verificar a disponibilidade de unir meu trabalho ao tronco principal do projeto.
Desde já fico grato Edivando, Brasil.

Good afternoon, I'm migrating the bgrabitmap and bgracontrols sources to the delphi mode in fpc and to delphi VCL.
The results are great. I'd like to exchanged e-mails with project owner to analyze the quality and performance.
From now on I am grateful Edivando, Brazil.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on November 12, 2018, 02:03:25 am
Hi, sure these changes are on BGRABitmap, so you need to talk with circular. If you also make changes on bgracontrol talk with me.

I think the best is you make a fork on GitHub with all the changes, so we can review that.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on November 12, 2018, 06:33:54 pm
Hello!

That's an interesting idea. Do you have examples of change you suggest to do?

Regards
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Edivando on November 13, 2018, 02:19:44 pm
Bom dia estou estabilizando o codigo.
Assim que estiver rodando sem bugs eu posto os demos da aparencia no delphi.

Estou usando o codigo base sem mudanças maiores atraves de diretivas {$ifdef fpc} and {ifndef fpc} dessa forma o mesmo codigo esta compilando no lazarus e no delphi

outra coisa que precisei fazer para dar a compatibilidade foi tornar o codigo compativel com a diretira {$mode delphi} do fpc e a retirada de atribuições estilo c tais como "=+,=-,=*,=/" pois o delphi não suporta essa sintaxe.

Eu gostaria que voces (circular, lainz) após as mudanças no projeto estiverem estaveis analisasse e merge os fontes ao codigo original para que o componente melhorasse cada dia mais e com mais uma plataforma delphi .

Good morning, I'm stabilizing the code.
As soon as it is running without bugs I put the demos of the appearance in delphi.

I am using the base code without major changes through directives {$ ifdef fpc} and {ifndef fpc} so the same code is compiling in lazarus and delphi

another thing I needed to do to make compatibility was to make the code compatible with fpc's {$ mode delphi} directive and the removal of style assignments such as "= +, = -, = *, = /" since delphi does not supports this syntax.

I would like you (circular, lainz) after the changes in the project to be stable analyze and merge the sources to the original code so that the component improved every day more and with another platform delphi.

Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on November 13, 2018, 05:19:39 pm
I am using the base code without major changes through directives {$ ifdef fpc} and {ifndef fpc} so the same code is compiling in lazarus and delphi
Ok

Quote
another thing I needed to do to make compatibility was to make the code compatible with fpc's {$ mode delphi} directive
I would rather not do such thing. I would like to look at some example together with you to see what are our options here.

Quote
and the removal of style assignments such as "= +, = -, = *, = /" since delphi does not supports this syntax.
:o That's a pity I like those very much. But I guess I could live without them.

Quote
I would like you (circular, lainz) after the changes in the project to be stable analyze and merge the sources to the original code so that the component improved every day more and with another platform delphi.
That's understandable. Though if we identify all the type of changes to do and agree on it, it would be better not to wait to long to start implementing it because as time goes on, the code might change and this may be complicated to merge.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: RAW on November 13, 2018, 06:20:54 pm
BGRA Bitmap and Delphi VCL ... Interesting !!!

Is this only intended to work with modern Delphi Versions?
(XE2 to XE10)

Or is there any way planned to make this working with D2006 (TurboDelphi), 2007, 2009, 2010 ?

I'm just curious ...  :)
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on November 14, 2018, 01:13:48 am
I think we can discuss it right here and don't keep it as a secret  :)
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Edivando on November 14, 2018, 01:33:14 am
Não é segredo eh devido a problemas linguisticos. Eu nao falo ingles fluente.
Tenhos as tarefas do dia a dia da minha empresa fica bem corrido pra lidar com os problema diarios, mexer no BGRABitmap e BRGAControls ficar analizando a sintaxe dos post, pois o maior public fala ingles e eu portugues.
No forum o tamanho maximo da imagem é 250 k um simples print screen fica bem maior ai tenho que ficar diminuindo a resolução para poder posta no forum.

Quero usar as duas bibliotecas nos meus sistemas, por isso meu esforço solitario para migrar para o delphi.Mais nao quero que as alterações que fiz fique desatualizadas por nao estar no tronco principal dos fontes.

Sei que com contribuintes do mundo Delphi os componentes BGRABitmap e BGRAControls poderam abrir uma publico ainda maior e uma mair facilidade na portabilidade de programas Bonitos do delphi para Lazarus. Inclusive esse eh meu principal objetivo sair do delphi sem perder a aparencia dos meus sistemas.
 E com a evolução dessas bibliotecas num futuro proximo sei que isso se tornara uma realidade.

Desculpe meu ingles usei o google translator para agilizar nas respostas.

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

It's no secret eh because of linguistic problems. I do not speak fluent english.
I have the tasks of the day to day of my company is well run to deal with the daily problems, to move in the BGRABitmap and BRGAControls to be analyzing the syntax of the post, because the greater public speaks English and I Portuguese.
In the forum the maximum size of the image is 250k a simple print screen is much higher then I have to stay reducing the resolution to be posted on the forum.

I want to use both libraries on my systems, so my solitary effort to migrate to delphi. I do not want the changes I made to be outdated because they are not in the main trunk of the fonts.

I know that with contributors from the Delphi world the components BGRABitmap and BGRAControls could open up an even larger public and a mair facility in the portability of Pretty Delphi programs to Lazarus. Even this is my main goal to get out of delphi without losing the appearance of my systems.
 And with the evolution of these libraries in the near future I know that this had become a reality.

Sorry for my english I used google translator to speed up the answers.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on November 14, 2018, 01:37:17 am
Don't worry I can read Portuguese as well. But not speak it not write it.

If you want to make it simple upload what you have done now and I will test it. I have Delphi installed.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Edivando on November 14, 2018, 01:49:50 am
Estou falando com o circular para ele analizar as mudanças que fiz assim que ele analizar e concordar com as mudanças ai passamos pro BGRAControls. te explicando as mudanças que fiz que no caso do BGRAControls foram poucas e ainda esta em fase de testes pois o redimencionar ainda preciso arrumar porem da forma que estou implementando não esta atrapalhando a implementação principal do LCL pois estou usando bastante diretiva para dar essa compatibilidade cruzada. Exemplo metodos override do lcl uso diretivas recriando o metodo como virtual no delhi buscando uma forma de dar essa compatibilidade na classe base para que nao altere nada nos componentes herdados.

Esse comentario foi apenas um exemplo das taticas que usei para nao mexer em nada que esta funcionando, testado e em produção por alguns usuarios.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on November 14, 2018, 01:58:41 am
It's ok. Simply I can't understand that way of contribution but it's ok. Circular can touch bgracontrols code as well.

For me will be simple to see the code and play with it.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on November 14, 2018, 03:45:58 pm
I think we can discuss it right here and don't keep it as a secret  :)
Indeed, I find it better to make this discussion public whenever possible.

Edivando I suppose you would like to exchange code and images but find it not possible on the forum because of the file size limit.

Regarding screenshots, I suggest you convert them to Jpeg to reduce their size, so that you can post them on the thread. You can have quite a good quality of image with a much lower file size.

Regarding code, there are various ways you can share it. I suggest you use a public code repository. Have you already used Git or Svn? Do you have a Github or Gitlab account?
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi now on github
Post by: Edivando on November 30, 2018, 02:54:07 pm
bgrabitmap and bgracontrols for Lazarus and Delphi now on github.

Take a look at it and help improve compatibility and fix potential errors.

https://github.com/edivando-fpc/BGRABitmap

Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on November 30, 2018, 02:56:45 pm
Hi thanks. I will try it soon.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on November 30, 2018, 04:16:48 pm
Hi, seems that BGRABitmap compiles well, but I have a problem installing BGRAControls, it says can't find GraphType. If I add GraphType to package, it says it must remove it because it's already included in BGRABitmap.

Maybe something related with the paths?
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Edivando on November 30, 2018, 04:38:26 pm
deixe o path do projeto assim c:\bgrabitmap\  que tudo vai funcionar pois o Search path esta estatico com esse caminho
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on November 30, 2018, 08:01:43 pm
Great, it's working fine. To work better on Windows 10 I just enable 'Double Buffered' in forms to avoid flickering.

I will try to incorporate BGRAControls changes into our repository.

It will be good if it can run in any folder, not just from C:\bgrabitmap\, because we have 2 repos, one for bgrabitmap and one for bgracontrols, and they are in separate folders.

Anyone with more Delphi experience can help?
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on December 01, 2018, 01:48:18 am
Hi, I've merged your changes into our repository of BGRAControls
https://forum.lazarus.freepascal.org/index.php/topic,24176.msg303533.html#msg303533

Please if there are more changes:
- Create a fork of the development branch of BGRAControls, or the master branch is ok too, because I added every change from 5.0.1 to 5.0.3 plus development branch one by one by myself again into the new release.

https://help.github.com/articles/fork-a-repo/

About BGRABitmap changes, I can't add them, that must be done by Circular, but he doesn't have currently a Windows machine to test, so maybe it's good that you can mantain the delphi version.

Many thanks for your help.  :)
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on December 14, 2018, 05:10:44 pm
If the Delphi version is working, we can start to try and merge what we can into the dev branch.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: lainz on December 16, 2018, 03:05:04 pm
I tested bgracontrols and its working.

Is based on BGRABitmap 9.9, so you have 2 options:

1) Use that code and add all your development branch changes to that
2) Add all this version changes to development branch

Maybe 3) If there's a way to merge both changes at the same time.

What I did was take the bgracontrols fork as a base and then I've added all changes in development again.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on December 17, 2018, 03:50:09 pm
Hi @Edivando

Thanks for taking the time to make a Delphi version of BGRABitmap.

I agree with the changes regarding the overload keyword. Sometimes it was missing and sometimes I suppose keyword position is not accepted by Delphi. I have merged those changes in the dev branch of BGRABitmap.

There are other changes that we need to talk about. Basically, I would like that the number of change in the code to be the smallest possible to make it easier to maintain.

For example renaming all types like Word -> BGRAWord seems unnecessary to me as there is no ambiguity in the meaning of this type. This may be useful when porting into another language but that's not what we are doing here. What are the types that are not compatible between Delphi and FreePascal that would necessitate an alias? NativeInt? UInt64?

Also about the function LEToN, NToLE, BEToN and NToBE, as they do not exist in Delphi I suggest to emulate those functions, so that the rest of the code is unchanged.

Regarding removing the $PUSH / $POP when it is not FPC, I have some doubts. At the end of the $POP, the options are back to what they were. The switches $HINTS and $OPTIMIZATION are there to fix some compiler problems, so maybe they are not necessary with Delphi and you could include them inside the $IFDEF FPC.

There other things but let's start with that.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Thaddy on December 17, 2018, 04:30:46 pm
For example renaming all types like Word -> BGRAWord seems unnecessary to me as there is no ambiguity in the meaning of this type. This may be useful when porting into another language but that's not what we are doing here. What are the types that are not compatible between Delphi and FreePascal that would necessitate an alias? NativeInt? UInt64?
Not necessary, unless very old versions of Delphi will be supported (pre D2010, maybe even XE2). Many of those types were introduced in FPC because of Delphi compatibility....
Quote
Also about the function LEToN, NToLE, BEToN and NToBE, as they do not exist in Delphi I suggest to emulate those functions, so that the rest of the code is unchanged.
These are functionally supported in some third party networking libraries and Windows units in Delphi (I believe in winsock? because similar routines are needed for network byte order, not only for processor endness). Also  note implementation is platform!
Quote
Regarding removing the $PUSH / $POP when it is not FPC, I have some doubts. At the end of the $POP, the options are back to what they were. The switches $HINTS and $OPTIMIZATION are there to fix some compiler problems, so maybe they are not necessary with Delphi and you could include them inside the $IFDEF FPC.
That's another matter and can indeed lead to code breaks if it can not be determined what the state was at {$push} time. Requires careful code analysis. Delphi does not support it in any version.

The most important pre-requisites for such conversions are:
- determining the supported Delphi minimum version
- and the license model. (e.g. if it is compatible with lgpl+linker exception, you can also copy out the byte order manipulations (LEToN and family) from the fpc code (although that is trivial code if the endness is known).

Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on December 17, 2018, 06:41:28 pm
Not necessary, unless very old versions of Delphi will be supported (pre D2010, maybe even XE2). Many of those types were introduced in FPC because of Delphi compatibility....
Sounds contradictory to me. Can you make full sentences here?

About LEToN, NToLE, BEToN and NToBE I suppose it will be little endian, so those functions would simply return the same value.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Thaddy on December 17, 2018, 06:55:45 pm
Not necessary, unless very old versions of Delphi will be supported (pre D2010, maybe even XE2). Many of those types were introduced in FPC because of Delphi compatibility....
Sounds contradictory to me. Can you make full sentences here?
We introduced them, or re-named them, after Delphi started to support 64 bits: NativeInt, NativeUint, etc. This is not an issue if the minimum supported Delphi version would be XE2.
Anyway, if, say D7, needs to be supported it is cheaper to declare them in a Delphi specific block than to introduce specific types.
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Edivando on December 17, 2018, 11:09:26 pm
Boa noite,

Sei que não seria o tópico correto para incluir esses links, porem sei do alto grau de conhecimento das pessoas envolvidas nesse tópico e gostaria das suas opiniões.
O que acha de uma modalidade de  Crowdfunding para agilizar o desenvolvimento de algumas soluções para o Lazarus e FPC?

Links sobre o assunto:

https://forum.lazarus.freepascal.org/index.php/topic,43543.0.html
http://pas2js.38893.n8.nabble.com/
http://free-pascal-lazarus.989080.n3.nabble.com/

Atenciosamente

Edivando, Brasil

----------------------------- Google Translate -------------------------------------

Good night,

I know it would not be the correct topic to include these links, but I know the high degree of knowledge of the people involved in this topic and would like the opinion of you.
What do you think of a Crowdfunding modality to speed development of some solutions for Lazarus and FPC?

Links on the subject:

https://forum.lazarus.freepascal.org/index.php/topic,43543.0.html
http://pas2js.38893.n8.nabble.com/
http://free-pascal-lazarus.989080.n3.nabble.com/

graciously

Edivando, Brazil
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on December 18, 2018, 10:42:19 am
We introduced them, or re-named them, after Delphi started to support 64 bits: NativeInt, NativeUint, etc. This is not an issue if the minimum supported Delphi version would be XE2.
Anyway, if, say D7, needs to be supported it is cheaper to declare them in a Delphi specific block than to introduce specific types.
Well precisely I am trying to narrow down the types that may need some hack. And indeed, it is easy to declare NativeInt if it is missing rather than renaming in the whole source code.

@Edivando:
That's off-topic. By the way have you seen my questions/remarks?
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: Thaddy on December 18, 2018, 12:55:46 pm
Note there are some problems with Delphi because the native types are declared wrong in d2007,2009 and 2010.
So if you declare them, do it like so:
Code: Pascal  [Select]
  1. {$if CompilerVersion<=21}
  2. type
  3.   NativeInt = Integer;
  4. ... etc
  5. {$ifend}
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: circular on December 19, 2018, 01:22:19 pm
Thanks for the tip
Title: Re: bgrabitmap and bgracontrols for Lazarus and Delphi
Post by: DomingoGP on April 07, 2019, 10:10:40 am
Hi Edivando
I have been testing the library a bit and I have found and fixed 2 bugs. I have also implemented the functions LEToN, BEToN ... for delphi.
I have put 3 pull requests in your repository on GitHub in case you may be interested in the changes made.