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
URL: http://forum.codejock.com/forum_posts.asp?TID=24367
Printed Date: 22 December 2024 at 8:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


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
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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net