Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Making XAML Icons with MatrixTransform work
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Making XAML Icons with MatrixTransform work

 Post Reply Post Reply
Author
Message
DavidH View Drop Down
Groupie
Groupie


Joined: 24 March 2007
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote DavidH Quote  Post ReplyReply Direct Link To This Post Topic: Making XAML Icons with MatrixTransform work
    Posted: 07 March 2023 at 8:44am
As a reminder to myself, and hopefully helpful to others and the Codejock devs:

To make MatrixTransform work as a RenderTransform in CJ 22.0.0, I had to make the following changes:

- Source\Markup\XTPMarkupContext.cpp -> Add registrations to parser
Add:
#include "Markup/Transform/XTPMarkupMatrixTransform.h"
#include "Markup/Transform/XTPMarkupGdiPlusMatrixTransform.h"
in void CXTPMarkupContext::RegisterClasses(), add:
CXTPMarkupGdiPlusMatrixTransform::RegisterType();

- Source\Markup\Transform\XTPMarkupGdiPlusMatrixTransform.cpp  Simply use the transformation:
BOOL CXTPMarkupGdiPlusMatrixTransform::TransformMatrix(const CXTPGdiPlus* pReserved,
                                                       GpMatrix* pMatrix)
{
    UNREFERENCED_PARAMETER(pReserved);

    ASSERT(NULL != pMatrix);

    const int matrixValues                = 6;
    CXTPMarkupDoubleCollection* pValues = GetMatrix();
    if (pValues->GetCount() < matrixValues || matrixValues > pValues->GetCount())
        return FALSE;

    Matrix m((Gdiplus::REAL)pValues->GetAt(0), (Gdiplus::REAL)pValues->GetAt(1),
             (Gdiplus::REAL)pValues->GetAt(2), (Gdiplus::REAL)pValues->GetAt(3),
             (Gdiplus::REAL)pValues->GetAt(4), (Gdiplus::REAL)pValues->GetAt(5));

    if (Gdiplus::Ok != GdipMultiplyMatrix(pMatrix, &m, Gdiplus::MatrixOrderPrepend))
        return FALSE;

    return TRUE;
}

- Source\Markup\XTPMarkupObject.cpp Support floats with powers (e/E):
BOOL CXTPMarkupDoubleCollection::GetNextValue(LPCWSTR& lpszValue, float& fValue)
{
    while (*lpszValue != '\0' && isspace(*lpszValue)) lpszValue++;
    if (*lpszValue == '\0') {
        return FALSE;
    }

    WCHAR* lpszEnd;
    fValue = wcstof(lpszValue, &lpszEnd);
    auto result = lpszValue != lpszEnd;
    lpszValue = lpszEnd;
    return result;
}


With these changes, all the Axialis XAML icons I'm using in my project work.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.