Jump to content

pyscripter

Members
  • Content Count

    221
  • Joined

  • Last visited

  • Days Won

    10

pyscripter last won the day on August 5

pyscripter had the most liked content!

Community Reputation

150 Excellent

2 Followers

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. pyscripter

    Delphi 10.4 compiler going senile

    Java terminology... https://www.programcreek.com/2011/12/monitors-java-synchronization-mechanism/
  2. @Attila KovacsThanks. Just replace D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT with $00000004. And of course both LPCWSTR and LPWSTR are cast to PWideChar. But you are right! I would like to add that the purpose of Winapi.D2DMissing is not to provide for the missing D2D API, but to include just enough to serve the purpose of handling svg files. Warning: there are many translation errors in the the parts not used in this project. "TOSVersion.Build returns 0 on my system". Any idea why? Is this a Delphi bug? A more reliable way would be: if Supports(RenderTarget, ID2D1DeviceContext5) then //Supported But that would involve creating the Factory and the Render Target. Any other suggestions?
  3. The attached fixes both issues. Svg.zip
  4. Thanks. The aim is to integrate it with https://github.com/EtheaDev/SVGIconImageList
  5. In the attachment you can find a high-level interface-based encapsulation of the Direct2D SVG functionality. It allows you to parse SVG files and draw them to a GDI/GDI+ DC. Requires Windows 10 with Creators Update or later. Main form code to display SVG files: { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin fSVG := GetD2DSVGHandler.NewSvg; fSVG.LoadFromFile('..\..\browser.svg'); //fSVG.FixedColor := TAlphaColorRec.Red; //fSVG.Opacity := 0.5; fSVG.GrayScale := True; end; procedure TForm1.Paint; begin inherited; fSvg.PaintTo(Canvas.Handle, TRectF.Create(ClientRect), True); end; procedure TForm1.Resize; begin inherited; Invalidate; end; Features: Scale to any size Keep aspect ratio (optionally) Control opacity Recolor to any color Draw in gray scale Samples: The above in grayscale: Svg.zip
  6. pyscripter

    Check for Creators Update

    See
  7. pyscripter

    Check for Creators Update

    In Jcl there is something called Windows10ReleaseId (1703 for Creators Update). Is this same as the build number? (I think not)
  8. pyscripter

    Check for Creators Update

    Is there a way to check whether the Windows version is 10 with the Creators Update or later installed, using the RTL? I know that Jcl provides support for that.
  9. pyscripter

    Translation of C headers.

    If you do it on the Root it works as expected.
  10. pyscripter

    Translation of C headers.

    @Mahdi Safsafi You are my hero!
  11. pyscripter

    Translation of C headers.

    @Attila Kovacs RecolorSubtree(Root, D2D1ColorF(0.5, 80, 80, 80)); does not make sense The Values need to be between 0 and 1 for instance. D2D1ColorF(clRed) = D2D1ColorF(1,0,0,1) I will doing drawing in GrayScale. Does anyone know how to draw the svg with opacity say 0.5? Everything not just the fill color possibly using D2D primitives?
  12. pyscripter

    Translation of C headers.

    @Kas Ob.order which is the same as shown by IDA works here. I can recolor both ways: if Succeeded(Element.GetAttributeValue('fill', D2D1_SVG_ATTRIBUTE_POD_TYPE_COLOR, @OldColor, SizeOf(OldColor))) then begin if (OldColor.r <> 0) or (OldColor.g <> 0) or (OldColor.b <> 0) then Assert(Succeeded(Element.SetAttributeValue('fill', D2D1_SVG_ATTRIBUTE_POD_TYPE_COLOR, @NewColor, SizeOf(NewColor)))); end; and Assert(Succeeded(Element.GetAttributeValue('fill', IID_ID2D1SvgPaint, Pointer(Paint)))); if Assigned(Paint) then begin Paint._AddRef; if Paint.GetPaintType = D2D1_SVG_PAINT_TYPE_COLOR then begin Paint.GetColor(OldColor); if (OldColor.r <> 0) or (OldColor.g <> 0) or (OldColor.b <> 0) then Paint.SetColor(NewColor); end; end; end; The declaration of SetColor needs to be changed: function SetColor(Const color: D2D1_COLOR_F): HResult; stdcall;
  13. pyscripter

    Translation of C headers.

    The functions seem to work now (Succeeded) but still no recoloring though). What is strange is that the order of the overloads in the VTable is the reverse than that in the include file. What is the tool you are using to inspect the Vtables?
  14. pyscripter

    Translation of C headers.

    It does not recolor here. Could you please post your project.
  15. pyscripter

    Translation of C headers.

    This is the one I was getting before at $78 I think. Also when I call it using the commented code it does not succeed. Assert(Succeeded( Element.GetAttributeValue('fill', IID_ID2D1SvgPaint, Pointer(Paint)) )) fails. It does not appear to be in the right order now. Do you get the recoloring to work.
×