sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.68k stars 641 forks source link

ColorGlyphRunEnumerator.CurrentRun returns Intpr instead of ColorGlyphRun #1067

Closed Gillibald closed 5 years ago

Gillibald commented 5 years ago

Current CI builds seem to have some code generation issues. ColorGlyphRunEnumerator.CurrentRun returns Intptr instead of ColorGlyphRun. Atleast the marshaling code is available in the current master branch.

It seems the current CI builds dont map this correctly.

I have the following code:

var result = factory2.TryTranslateColorGlyphRun(
baselineOriginX,
baselineOriginY,
glyphRun,
glyphRunDescription,
measuringMode,
null,
0,
out var colorGlyphRunEnumerator);

if (result == Result.Ok)
{
    while (true)
    {
        colorGlyphRunEnumerator.MoveNext(out var hasRun);

        if (!hasRun)
        {
            break;
        }

        var colorGlyphRun = colorGlyphRunEnumerator.CurrentRun;

        brush = new SolidColorBrush(_renderTarget, colorGlyphRun.RunColor);

        _renderTarget.DrawGlyphRun(
             new RawVector2 { X = colorGlyphRun.BaselineOriginX, Y = colorGlyphRun.BaselineOriginY },
                            glyphRun,
                            brush,
                            measuringMode);
     }
         colorGlyphRunEnumerator.Dispose();
     }
    else
    {
         _renderTarget.DrawGlyphRun(baselineOrigin, glyphRun, brush, measuringMode);
    }
}
xoofx commented 5 years ago

@jkoritzinsky could you have a look?

jkoritzinsky commented 5 years ago

Will do!


From: Alexandre Mutel notifications@github.com Sent: Thursday, August 23, 2018 8:27:15 AM To: sharpdx/SharpDX Cc: Jeremy Koritzinsky; Assign Subject: Re: [sharpdx/SharpDX] ColorGlyphRunEnumerator.CurrentRun returns Intpr instead of ColorGlyphRun (#1067)

Assigned #1067https://github.com/sharpdx/SharpDX/issues/1067 to @jkoritzinskyhttps://github.com/jkoritzinsky.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://github.com/sharpdx/SharpDX/issues/1067#event-1805253320, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABf6UFEI_zTmqlkcZncuDehfT6RkerPNks5uTq2ygaJpZM4WJYFs.

jkoritzinsky commented 5 years ago

Looks like SharpDX is generating the property based of the parameter type (which is correctly IntPtr). The GetCurrentRun method that doesn't take any parameters will get you your instance of ColorGlyphRun that you're looking for. I'll put together a PR when I have a chance with the changes to the mapping files to show the old API face correctly.

Gillibald commented 5 years ago

Hmm okay didn't realize there was a method for that. Will have a try.

jkoritzinsky commented 5 years ago

@Gillibald this will be fixed (with the expected property name like before) in the next version of SharpDX.

Gillibald commented 5 years ago

Thanks for this 👍