Recent

Author Topic: New version of BGRABitmap  (Read 287627 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: New version of BGRABitmap
« Reply #60 on: April 27, 2015, 07:59:49 am »
Oh I may have forgotten something.

Would it fix the problem to replace "BGRADefaultBitmap" by "BGRALCLBitmap", and "TBGRADefaultBitmap" by "TBGRALCLBitmap" in BGRABitmap.pas ?

Yes indeed circular, that fixed the problem! Many thanks.

BGRABitmap is fantastic, thanks for all your work on this.

P.S. Maybe we will see the day when BGRAControls will be a complete widget set for Lazarus?  :)

Cheers,
VTwin
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

circular

  • Hero Member
  • *****
  • Posts: 4217
    • Personal webpage
Re: New version of BGRABitmap
« Reply #61 on: April 27, 2015, 12:35:04 pm »
Is LazUtils absolutely necessary, does it not exist something else more flexible  ?
It is necessary to render FreeType fonts.

Quote
Maybe it is because i use last fpc 3.0.1 ?
Yep, with fpc 2.4 it works  ;)
I am interested if you have an idea on how to make it work with both compilers. What function has changed?

Quote
Huh, Circular, what a perfect work you have done.  ;D

It works perfectly and it is pure-fpGUI => incredible.   :o
Thanks.  :)

Quote
Where are you with your plan to do a BGRABitmap library ?
If you agree, it will be a pleasure to help you for that.
Of course, you are welcome to help. I am writing the documentation. Basically the tasks consists in adding comments in the source code. Then this is transformed into a beautiful wiki. Would you like to hear more about this task?

BGRABitmap is fantastic, thanks for all your work on this.
You're welcome.

Quote
P.S. Maybe we will see the day when BGRAControls will be a complete widget set for Lazarus?  :)
Ahah maybe.  :D

To be honest I have no idea how to do that.
Conscience is the debugger of the mind

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: New version of BGRABitmap
« Reply #62 on: April 27, 2015, 01:15:26 pm »
To be honest I have no idea how to do that.
Leave that to me!  ;) I'll make it happen with fpGUI Toolkit, or at least try and make it so the software renderer for fpGUI is configurable at compile time between AggPas and BGRABitmap. If I complete one, the other shouldn't be too difficult to add. [last famous worlds]

Regards,
  Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

circular

  • Hero Member
  • *****
  • Posts: 4217
    • Personal webpage
Re: New version of BGRABitmap
« Reply #63 on: April 27, 2015, 02:15:35 pm »
Ok Graeme.  :)

So it would be possible to customize the appearance of controls with fpGUI? Or do you think about compiling the current BGRAControls with fpGUI?
Conscience is the debugger of the mind

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: New version of BGRABitmap
« Reply #64 on: April 27, 2015, 04:03:41 pm »
Quote
I am interested if you have an idea on how to make it work with both compilers. What function has changed?
=>
paswstring.pas(379,43) Error: Incompatible types: got "<address of procedure(PWideChar;var AnsiString;Int64);Register>" expected "TUnicodeStringManager.<procedure variable type of procedure(PWideChar;var RawByteString;Word;Int64);Register>"

Quote
Quote

    Where are you with your plan to do a BGRABitmap library ?
    If you agree, it will be a pleasure to help you for that.

Of course, you are welcome to help. I am writing the documentation. Basically the tasks consists in adding comments in the source code. Then this is transformed into a beautiful wiki. Would you like to hear more about this task?

Hum, i was taking to transform BGRABitmap unit into a library... :-[

Like i did for fpGUIlib => https://github.com/fredvs/fpGUIlib
or uoslib => https://github.com/fredvs/uoslib

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

circular

  • Hero Member
  • *****
  • Posts: 4217
    • Personal webpage
Re: New version of BGRABitmap
« Reply #65 on: April 27, 2015, 04:52:24 pm »
Quote
I am interested if you have an idea on how to make it work with both compilers. What function has changed?
=>
paswstring.pas(379,43) Error: Incompatible types: got "<address of procedure(PWideChar;var AnsiString;Int64);Register>" expected "TUnicodeStringManager.<procedure variable type of procedure(PWideChar;var RawByteString;Word;Int64);Register>"
Yes I saw that in your previous response, but that does not give me a name. Hmm, oh I see, it is a unit in LazUtils. I suppose it is about Ansi2WideMoveProc or Wide2AnsiMoveProc.

Anyway it will probably be updated by someone in the LCL team for future versions.

Quote
Hum, i was taking to transform BGRABitmap unit into a library... :-[

Like i did for fpGUIlib => https://github.com/fredvs/fpGUIlib
or uoslib => https://github.com/fredvs/uoslib
Ah ok. Well I don't intend to do that for now so I don't need help there. Are you unsure that I would not authorize you to do so? Would it entail something regarding the structure of BGRABitmap?
Conscience is the debugger of the mind

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: New version of BGRABitmap
« Reply #66 on: April 27, 2015, 05:03:17 pm »
Quote
Are you unsure that I would not authorize you to do so?
Hum, BGRABitmap is yours, i think normal to ask it to you... :-[

Quote
Would it entail something regarding the structure of BGRABitmap?
Not the global structure but each procedure/function will be adapted if the library is classical native or Java native.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #67 on: April 27, 2015, 05:22:58 pm »
Quote
Are you unsure that I would not authorize you to do so?
Hum, BGRABitmap is yours, i think normal to ask it to you... :-[

Quote
Would it entail something regarding the structure of BGRABitmap?
Not the global structure but each procedure/function will be adapted if the library is classical native or Java native.

I've started the library some time ago (with circular help), is in bgracontrols package, but left it since I will not use it as is, but if you're interested check it out.
bgracontrols\test\test_bgrabitmap_library test project
bgracontrols\bgra_pascalscript_library the library is based on the bgrabitmap pascal script implementation (that of course is limited to the declared functions in BGRAPascalScript.pas), because that is the name I choose...

I don't know if you have the ability to include the classes like in the bgrabitmap source to get the real power. And also I must ask you If you know if you can get it working with visual studio and c# for example...
« Last Edit: April 27, 2015, 05:25:54 pm by 007 »

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: New version of BGRABitmap
« Reply #68 on: April 27, 2015, 10:37:27 pm »
Just quickly made Windows 7 fpGUI style using BGRABitmap. Antyalias, effects, rounding, everything is working fine. It is amazing. Something is wrong with scrollbars but it is probably my mistake with coordinates. Draw speed seems to be faster than LCL version, probably that it omit Gtk/Qt level and draw directly on X11. Well done circular :)

Suggestion: Missing handy method for color convertion from TfpgColor to TBGRAPixel. For now I need to use fpgColorToRGBTriple and then its RED GREEN BLUE property in BGRA(red, green, blue)

Attached screenshot and source. Tested on Kubuntu 64 bit

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: New version of BGRABitmap
« Reply #69 on: April 27, 2015, 11:29:18 pm »
Quote
Posted by: 007
I've started the library some time ago (with circular help), is in bgracontrols package, but left it since I will not use it as is, but if you're interested check it out.
bgracontrols\test\test_bgrabitmap_library test project
bgracontrols\bgra_pascalscript_library the library is based on the bgrabitmap pascal script implementation (that of course is limited to the declared functions in BGRAPascalScript.pas), because that is the name I choose...

Ha, ok, you did it like that => using Pascal Script.
I have to study it because i do that way =>

Code: [Select]
library BGRABitmap;
uses
   BGRABitmap
  ,BGRABitmapTypes;

 function getBlue(AColor: TBGRAColor): byte;  cdecl;
  begin
    Result := getBlue(aColor);
  end;

....

exports
   getBlue name 'getblue',
...
begin
end.

Quote
And also I must ask you If you know if you can get it working with visual studio and c# for example...

I am not sure to understand... but if you want to know if a fpc library could be used with other languages =>
Of course fpc libraries work with visual studio programs, Python programs, even Java programs (with some modifs).
All compiler/language that can deal with native libraries can deal with fpc libraries.  ;D

Fre;D
« Last Edit: April 28, 2015, 12:45:04 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: New version of BGRABitmap
« Reply #70 on: April 28, 2015, 02:07:58 am »
Quote
And also I must ask you If you know if you can get it working with visual studio and c# for example...

Hum, i think i understand what you mean...  :-[

If you want a Universal Library, there are some things to take care.

- do not use complicated class as parameters or result (only byte, integer, float, boolean => strings is possible but less easy)
- if complicated custom classes are needed like create a TBGRABitmap => you may use a array of TBGRABitmap declared inside the library. => so the foreign program call a procedure who will increment the array of TBGRABitmap.

Fre;D
« Last Edit: April 28, 2015, 02:11:04 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #71 on: April 28, 2015, 02:24:44 am »
Ok. Basically check my code works as you suggested in both comments. With an internal array and these kind of functions.

The code does.not need pascal script but an unit called bgrapascalscript.pas is used to reuse the code in both projects. Check it out. Maybe you want to contribute to this unit direcly we can give you svn access.

Yes, strings are objects in c#. And all unicode of 16 bits.
Edit: here it is, how to pass strings from c# to a lazarus .dll http://forum.lazarus.freepascal.org/index.php/topic,28209.0.html

The question was basically because i'm new to c#. I even did not finish reading the book from the ms website.

« Last Edit: April 28, 2015, 06:45:20 am by 007 »

circular

  • Hero Member
  • *****
  • Posts: 4217
    • Personal webpage
Re: New version of BGRABitmap
« Reply #72 on: April 28, 2015, 07:04:15 am »
Just quickly made Windows 7 fpGUI style using BGRABitmap. Antyalias, effects, rounding, everything is working fine. It is amazing. Something is wrong with scrollbars but it is probably my mistake with coordinates. Draw speed seems to be faster than LCL version, probably that it omit Gtk/Qt level and draw directly on X11. Well done circular :)
Wow it looks great Dibo :)

Quote
Suggestion: Missing handy method for color convertion from TfpgColor to TBGRAPixel. For now I need to use fpgColorToRGBTriple and then its RED GREEN BLUE property in BGRA(red, green, blue)
I suppose you can use ColorToBGRA()
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: New version of BGRABitmap
« Reply #73 on: April 28, 2015, 08:32:29 am »
Just quickly made Windows 7 fpGUI style using BGRABitmap. Antyalias, effects, rounding, everything is working fine. It is amazing. Something is wrong with scrollbars but it is probably my mistake with coordinates. Draw speed seems to be faster than LCL version, probably that it omit Gtk/Qt level and draw directly on X11. Well done circular :)

Suggestion: Missing handy method for color convertion from TfpgColor to TBGRAPixel. For now I need to use fpgColorToRGBTriple and then its RED GREEN BLUE property in BGRA(red, green, blue)

Attached screenshot and source. Tested on Kubuntu 64 bit

Please upload it to BGRA-Controls!
(Yes, I know, is full of things, but.. you know, people find all the stuff there)

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: New version of BGRABitmap
« Reply #74 on: April 28, 2015, 01:02:17 pm »
@ 007

Hello.

I have checked your bgra_pascalscript_library.lpr.

Wow, perfect, nice work.  ;)

Some little detail to be more Universal...

Maybe replace all TBGRAColor with longword => example =>
Code: [Select]
function rgb(red, green, blue: byte): longword; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
  begin
    Result := BGRAPascalScript.rgb(red, green, blue);
  end;       
                         

And replace all String with PChar => example =>
Code: [Select]
procedure bgra_SaveToFile(id: integer; filename: PChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
  begin
    BGRAPascalScript.bgra_SaveToFile(id, filename);
  end;


"_" character in exports-name is interpreted as sub-class in some language (Java,..).
Also, to avoid mangle-name   =>
Code: [Select]
exports
  bgra_GetHighestID name 'bgragethighestid',
   ...   

Fre;D

« Last Edit: April 28, 2015, 02:40:35 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018