Print Page | Close Window

Making XAML Icons with MatrixTransform work

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
Printed Date: 04 June 2023 at 6:35am
Software Version: Web Wiz Forums 12.04 -

Topic: Making XAML Icons with MatrixTransform work
Posted By: DavidH
Subject: Making XAML Icons with MatrixTransform work
Date 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
#include "Markup/Transform/XTPMarkupMatrixTransform.h"
#include "Markup/Transform/XTPMarkupGdiPlusTranslateTransform.h"
in void CXTPMarkupContext::RegisterClasses(), add:

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

    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.

Print Page | Close Window

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