On Wed, Nov 4, 2020 at 8:18 AM Ruslan Garipov <ruslanngari...@gmail.com> wrote:
>
> Oh, I'm sorry, I accidentally replied directly to you, not to the list.
>
> On 11/4/2020 10:01 AM, Vincent Torri wrote:
> > for now :
> >
> > CreateDeviceContext method of a ID2D1Device1
> It's already in the master:
>
> $ fgrep -n CreateDeviceContext mingw-w64-headers/include/d2d1_1.h
> 1014:    STDMETHOD(CreateDeviceContext)(D2D1_DEVICE_CONTEXT_OPTIONS
> options, ID2D1DeviceContext **deviceContext) PURE;
> 1034:    STDMETHOD(CreateDeviceContext)(ID2D1Device *This,
>
> $ git blame -L1034,1036 HEAD mingw-w64-headers/include/d2d1_1.h
> 3cc762bfb (Ruslan Garipov 2020-05-19 14:29:13 +0500 1034)
> STDMETHOD(CreateDeviceContext)(ID2D1Device *This,
> 3cc762bfb (Ruslan Garipov 2020-05-19 14:29:13 +0500 1035)
> D2D1_DEVICE_CONTEXT_OPTIONS options,
> 3cc762bfb (Ruslan Garipov 2020-05-19 14:29:13 +0500 1036)
> ID2D1DeviceContext **deviceContext) PURE;

i know how to use fgrep...

what is missing is the classic C API, like (in d2d1_1.h) :

ID2D1Factory1_QueryInterface

that is, a define that call the method from the "virtual table" :

#define ID2D1Factory1_QueryInterface(this,A,B)
(this)->lpVtbl->Base.Base.QueryInterface((IUnknown *)(this),A,B)

it calls QueryInterface from the IUnknownVtbl structure, through
Base.Base in the define above

These are those defines that are missing.

Same for BeginDraw and EndDraw

Vincent Torri

> $ git show --pretty=fuller 3cc762bfb
> commit 3cc762bfbbbefcefa97d937fed89764ed4f58034
> Author:     Ruslan Garipov <ruslanngari...@gmail.com>
> AuthorDate: Tue May 19 14:29:13 2020 +0500
> Commit:     Liu Hao <lh_mo...@126.com>
> CommitDate: Tue May 19 22:31:26 2020 +0800
>
>     d2d1_1.h: Add C declaration for ID2D1Device
>
>     Signed-off-by: ‡Ruslan Garipov <ruslanngari...@gmail.com>
>     Signed-off-by: Liu Hao <lh_mo...@126.com>
>
> diff --git a/mingw-w64-headers/include/d2d1_1.h
> b/mingw-w64-headers/include/d2d1_1.h
> index f090be7a..f48ac349 100644
> --- a/mingw-w64-headers/include/d2d1_1.h
> +++ b/mingw-w64-headers/include/d2d1_1.h
> @@ -1014,7 +1014,29 @@ interface ID2D1Device : public ID2D1Resource
>  #else
>
>  typedef interface ID2D1Device ID2D1Device;
> -/* FIXME: Add full C declaration */
> +
> +typedef struct ID2D1DeviceVtbl {
> +    struct ID2D1ResourceVtbl Base;
> +
> +    STDMETHOD(CreateDeviceContext)(ID2D1Device *This,
> +        D2D1_DEVICE_CONTEXT_OPTIONS options,
> +        ID2D1DeviceContext **deviceContext) PURE;
> +    STDMETHOD(CreatePrintControl)(ID2D1Device *This,
> +        IWICImagingFactory *wicFactory,
> +        IPrintDocumentPackageTarget *documentTarget,
> +        CONST D2D1_PRINT_CONTROL_PROPERTIES *printControlProperties,
> +        ID2D1PrintControl **printControl) PURE;
> +    STDMETHOD_(void, SetMaximumTextureMemory)(ID2D1Device *This,
> +        UINT64 maximumInBytes) PURE;
> +    STDMETHOD_(UINT64, GetMaximumTextureMemory)(ID2D1Device *This) PURE;
> +    STDMETHOD_(void, ClearResources)(ID2D1Device *This,
> +        UINT32 millisecondsSinceUse) PURE;
> +}
> +ID2D1DeviceVtbl;
> +
> +interface ID2D1Device {
> +    const ID2D1DeviceVtbl *lpVtbl;
> +};
>
>  #endif
>
> > BeginDraw and EndDraw methods of a ID2D1DeviceContext (which inherits
> > from a ID2D1RenderTarget)
> The ID2D1DeviceContext is also in the tree (after 0c0da49fd):
>
> $ fgrep -n "struct ID2D1DeviceContextVtbl"
> mingw-w64-headers/include/d2d1_1.h
> 881:typedef struct ID2D1DeviceContextVtbl {
>
> $ tail -n +879 mingw-w64-headers/include/d2d1_1.h | head -130
> ...
>
> And the functions you are looking for (BeginDraw() and EndDraw()), were
> also added for C target long before 0c0da49fd:
>
> $ tail -n +934 mingw-w64-headers/include/d2d1.h | head -n 120 | egrep
> "BeginDraw|EndDraw"
>     STDMETHOD_(void, BeginDraw)(ID2D1RenderTarget *This) PURE;
>     STDMETHOD(EndDraw)(ID2D1RenderTarget *This, D2D1_TAG *tag1, D2D1_TAG
> *tag2) PURE;
> #define ID2D1RenderTarget_BeginDraw(this) (this)->lpVtbl->BeginDraw(this)
> #define ID2D1RenderTarget_EndDraw(this,A,B)
> (this)->lpVtbl->EndDraw(this,A,B)
>
> If you need some other interfaces -- let's try to add them.  Because I
> have developed a C program rendering with Direct2D, and also I'm to
> continue with that project in future.
>
> >
> > Vincent Torri
> >
> > On Tue, Nov 3, 2020 at 9:31 PM Ruslan Garipov <ruslanngari...@gmail.com> 
> > wrote:
> >>
> >> On 11/3/2020 9:36 PM, Vincent Torri wrote:
> >>> Hello
> >> Hello!
> >>
> >>>
> >>> does someone plan to add all the missing C API in d2d1_1.h ?
> >> Which interfaces (or some other API parts?) exactly do you need?
> >>
> >>> Currently, it's not possible to use d2d 1.1  API in C
> >>>
> >>> thank you
> >>>
> >>> Vincent Torri
> >>>
> >>>
> >>> _______________________________________________
> >>> Mingw-w64-public mailing list
> >>> Mingw-w64-public@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >>>


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to