Git Product home page Git Product logo

Comments (19)

rchastain avatar rchastain commented on May 28, 2024 2

Thank you for the code. I will try it at once.

Yes, I am prepared to give it another go, of course.

from image32.

rchastain avatar rchastain commented on May 28, 2024 2

Yes, test successful here too. Bravo!

from image32.

rchastain avatar rchastain commented on May 28, 2024 1

Applied your patch. Error solved.

Next problem here:

// Img32.pas 
function HslToRgb(hslColor: THsl): TColor32;
  // ...
begin
  // ...
  x := c * (255 - abs((hsl.hue mod 85) * 6 - 255)) div 255; // <--- "Can't determine which overloaded function to call"

I solved it like this:

var
  //...
  c, x, m, a: Integer;
begin
  // ...
  a := (hsl.hue mod 85) * 6 - 255;
  x := c * (255 - abs(a)) div 255;

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024 1

Hopefully these latest 2 commits help. ðŸĪžðŸ™.

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024 1

Next problem (sorry). :)

No, it's me that's sorry.
Thanks for your patience and thanks for your help too.
I'll try and fix it tonight, but it's close to my bedtime, so unless I find the fix quickly, I'll attend to it tomorrow morning.

Yep, sadly that won't be an easy fix (for Linux).
More info here: https://wiki.freepascal.org/High_DPI#Lazarus_DPI_related_properties
I'll see what I can do tomorrow morning. Cheers.

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024 1

When you have solved the bug, you should remember how it was done, and keep it as special effect. :)

Actually it's not unlike an interim image in cleartype construction where text is stretched out into red green and blue stripes before it's de-stretched.

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024 1

I'm hoping the latest changes I've just pushed to the repository will fix the above issues.
However, unrelated to Linux, I'm aware that resizing the SVG in this Demo App can on occasions cause exceptions that I'm investigating, but confident it'll be an easy fix.

from image32.

rchastain avatar rchastain commented on May 28, 2024 1

Yes it works (and looks very nice).

image32-lazarus-demo-linux

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024 1

Yay! And thank you for all your helpful feedback.

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024 1

However, unrelated to Linux, I'm aware that resizing the SVG in this Demo App can on occasions cause exceptions that I'm investigating, but confident it'll be an easy fix.

Found and fixed (in the latest repository commit).

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024

Bonjour Roland.
Yes, I need to update the uses clause in main.pas.
The reference to Img32.Clipper should be changed to Img32.Clipper2.
The demo then compiles without any further issues for me (using Lazarus 2.0.12, FPC 3.2.0).
I'll try to update the repository soon.

Edit: Sorry, that was compiling on Windows. I don't have a Linux PC to test but I'll do a bit of research.

from image32.

rchastain avatar rchastain commented on May 28, 2024

Thank you for your answer.

There are other problems. I could fix some of them, but not all. I wonder if the library, in its current state, is compatible with Linux. I see several things that are Windows-only.

I believe that we can close the issue? I will give another try to the demo when I have a Windows computer under the hand.

Regards.

Roland

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024

There are other problems. I could fix some of them, but not all.

OK, I'm sorry to hear that, though I'm keen to know what they are/were.
And I'll certainly understand if you don't want to persist.
But if you're prepared to give it another go here's a likely fix:

In Img32.pas (in lines 112 and following)

  TInterfacedObj = class(TObject, IInterface)
  public
  {$IFDEF FPC}
    function  _AddRef: Integer;
      {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
    function  _Release: Integer;
      {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
    function QueryInterface(
      {$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} iid : tguid;
      out obj) : longint;
      {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
  {$ELSE}
    function  _AddRef: Integer; stdcall;
    function  _Release: Integer; stdcall;
    function  QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
  {$ENDIF}
  end;

(and lines ~3300 and following)

{$IFDEF FPC}
function TInterfacedObj._AddRef: Integer;
  {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
  Result := -1;
end;
//------------------------------------------------------------------------------

function TInterfacedObj._Release: Integer;
  {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
  Result := -1;
end;
//------------------------------------------------------------------------------

function TInterfacedObj.QueryInterface(
  {$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} iid : tguid;
  out obj) : longint;
begin
  if GetInterface(IID, Obj) then Result := 0
  else Result := E_NOINTERFACE;
end;

{$ELSE}

function TInterfacedObj._AddRef: Integer; stdcall;
begin
  Result := -1;
end;
//------------------------------------------------------------------------------

function TInterfacedObj._Release: Integer; stdcall;
begin
  Result := -1;
end;
//------------------------------------------------------------------------------

function TInterfacedObj.QueryInterface(const IID: TGUID;
  out Obj): HResult;
begin
  if GetInterface(IID, Obj) then Result := 0
  else Result := E_NOINTERFACE;
end;
{$ENDIF}

I wonder if the library, in its current state, is compatible with Linux. I see several things that are Windows-only.

I'm hoping it is Linux compatible though, as I've said above, I don't currently have linux installed to test it.

I believe that we can close the issue?

I will if you don't wish to continue.

from image32.

rchastain avatar rchastain commented on May 28, 2024

Next problem. Lazarus tries to compile Img32.FMX.pas.

I noticed this line:

// Img32.Layers.pas, line 469
{$IFNDEF MSWINDOWS} uses Img32.FMX;{$ENDIF} 

I tried this:

{$IFNDEF FPC}{$IFNDEF MSWINDOWS} uses Img32.FMX;{$ENDIF}{$ENDIF}

But the compiler still tries to compile Img32.FMX. I will continue to investigate.

from image32.

rchastain avatar rchastain commented on May 28, 2024

Thank you for the two commits.

Next problem (sorry). :)

main.pas(119,47) Error: Identifier not found "DpiAware"
main.pas(129,29) Error: Identifier not found "DPIAware"
main.pas(279,23) Error: Identifier idents no member "CopyToDc"

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024

I've updated and greatly simplified the Lazarus demo (see repository) and I'm hoping it'll now compile in Linux too. The only thing I'm slightly concerned about is whether TBitmap.Scanline is supported in Linux.

Edit: Deleted zip file and updated repository.

from image32.

rchastain avatar rchastain commented on May 28, 2024

Thank you for your work and congratulations. It compiles and works!

I had to do this correction (img32.pas lines 2686 and 2713):

    pxDst := {img}self.PixelRow[i];

I had to remove these three lines in main.pas, line 55:


{$IFNDEF MSWINDOWS}
  //bkColor  := SwapRedBlue(bkColor);
  //penColor := SwapRedBlue(penColor);
  //txtColor := SwapRedBlue(txtColor);
{$ENDIF}

That's all!

I have the impression that the result on the screen is not what it should be, but in any case it is pretty. :)

lazarusdemo01

from image32.

AngusJohnson avatar AngusJohnson commented on May 28, 2024

have the impression that the result on the screen is not what it should be,

LOL, no! 😜ðŸĪŠ. But I'm encouraged that we're close. 👍

from image32.

rchastain avatar rchastain commented on May 28, 2024

Old televisions used to look like that sometimes when they were not correctly adjusted. :)

When you have solved the bug, you should remember how it was done, and keep it as special effect. :)

from image32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google âĪïļ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.