当前位置: 首页>>代码示例>>C++>>正文


C++ AffineTransform::transformPoint方法代码示例

本文整理汇总了C++中AffineTransform::transformPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ AffineTransform::transformPoint方法的具体用法?C++ AffineTransform::transformPoint怎么用?C++ AffineTransform::transformPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AffineTransform的用法示例。


在下文中一共展示了AffineTransform::transformPoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addPath

void Path::addPath (const Path& other,
                    const AffineTransform& transformToApply)
{
    size_t i = 0;
    const float* const d = other.data.elements;

    while (i < other.numElements)
    {
        const float type = d [i++];

        if (type == closeSubPathMarker)
        {
            closeSubPath();
        }
        else
        {
            float x = d[i++];
            float y = d[i++];
            transformToApply.transformPoint (x, y);

            if (type == moveMarker)
            {
                startNewSubPath (x, y);
            }
            else if (type == lineMarker)
            {
                lineTo (x, y);
            }
            else if (type == quadMarker)
            {
                float x2 = d [i++];
                float y2 = d [i++];
                transformToApply.transformPoint (x2, y2);

                quadraticTo (x, y, x2, y2);
            }
            else if (type == cubicMarker)
            {
                float x2 = d [i++];
                float y2 = d [i++];
                float x3 = d [i++];
                float y3 = d [i++];
                transformToApply.transformPoints (x2, y2, x3, y3);

                cubicTo (x, y, x2, y2, x3, y3);
            }
            else
            {
                // something's gone wrong with the element list!
                jassertfalse;
            }
        }
    }
}
开发者ID:410pfeliciano,项目名称:plugin-GUI,代码行数:54,代码来源:juce_Path.cpp

示例2: applyTransform

//==============================================================================
void Path::applyTransform (const AffineTransform& transform) noexcept
{
    bounds.reset();
    bool firstPoint = true;
    float* d = data.elements;
    float* const end = d + numElements;

    while (d < end)
    {
        const float type = *d++;

        if (type == moveMarker)
        {
            transform.transformPoint (d[0], d[1]);

            if (firstPoint)
            {
                firstPoint = false;
                bounds.reset (d[0], d[1]);
            }
            else
            {
                bounds.extend (d[0], d[1]);
            }

            d += 2;
        }
        else if (type == lineMarker)
        {
            transform.transformPoint (d[0], d[1]);
            bounds.extend (d[0], d[1]);
            d += 2;
        }
        else if (type == quadMarker)
        {
            transform.transformPoints (d[0], d[1], d[2], d[3]);
            bounds.extend (d[0], d[1], d[2], d[3]);
            d += 4;
        }
        else if (type == cubicMarker)
        {
            transform.transformPoints (d[0], d[1], d[2], d[3], d[4], d[5]);
            bounds.extend (d[0], d[1], d[2], d[3]);
            bounds.extend (d[4], d[5]);
            d += 6;
        }
    }
}
开发者ID:410pfeliciano,项目名称:plugin-GUI,代码行数:49,代码来源:juce_Path.cpp

示例3: it

void Direct2DLowLevelGraphicsContext::pathToGeometrySink (const Path& path, ID2D1GeometrySink* sink, const AffineTransform& transform)
{
    Path::Iterator it (path);

    while (it.next())
    {
        switch (it.elementType)
        {
            case Path::Iterator::cubicTo:
            {
                D2D1_BEZIER_SEGMENT seg;

                transform.transformPoint (it.x1, it.y1);
                seg.point1 = D2D1::Point2F (it.x1, it.y1);

                transform.transformPoint (it.x2, it.y2);
                seg.point2 = D2D1::Point2F (it.x2, it.y2);

                transform.transformPoint(it.x3, it.y3);
                seg.point3 = D2D1::Point2F (it.x3, it.y3);

                sink->AddBezier (seg);
                break;
            }

            case Path::Iterator::lineTo:
            {
                transform.transformPoint (it.x1, it.y1);
                sink->AddLine (D2D1::Point2F (it.x1, it.y1));
                break;
            }

            case Path::Iterator::quadraticTo:
            {
                D2D1_QUADRATIC_BEZIER_SEGMENT seg;

                transform.transformPoint (it.x1, it.y1);
                seg.point1 = D2D1::Point2F (it.x1, it.y1);

                transform.transformPoint (it.x2, it.y2);
                seg.point2 = D2D1::Point2F (it.x2, it.y2);

                sink->AddQuadraticBezier (seg);
                break;
            }

            case Path::Iterator::closePath:
            {
                sink->EndFigure (D2D1_FIGURE_END_CLOSED);
                break;
            }

            case Path::Iterator::startNewSubPath:
            {
                transform.transformPoint (it.x1, it.y1);
                sink->BeginFigure (D2D1::Point2F (it.x1, it.y1), D2D1_FIGURE_BEGIN_FILLED);
                break;
            }
        }
    }
}
开发者ID:sonic59,项目名称:JuceDirect2DS2,代码行数:61,代码来源:juce_win32_Direct2DGraphicsContext.cpp

示例4:

const D2D1_POINT_2F Direct2DLowLevelGraphicsContext::pointTransformed (int x, int y, const AffineTransform& transform)
{
    transform.transformPoint (x, y);
    return D2D1::Point2F ((FLOAT) x, (FLOAT) y);
}
开发者ID:sonic59,项目名称:JuceDirect2DS2,代码行数:5,代码来源:juce_win32_Direct2DGraphicsContext.cpp


注:本文中的AffineTransform::transformPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。