Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Support for Pattern transformation.#2263

Merged
msft-Jeyaram merged 6 commits into
microsoft:developfrom
msft-Jeyaram:FixRotationPatternBrush_3
Mar 23, 2017
Merged

Support for Pattern transformation.#2263
msft-Jeyaram merged 6 commits into
microsoft:developfrom
msft-Jeyaram:FixRotationPatternBrush_3

Conversation

@msft-Jeyaram

Copy link
Copy Markdown

fixes #2108


// Draw it in device space, so transformation is not applied to the render target.
coordinateMode = _kCGCoordinateModeDeviceSpace;
geometry.Attach(transformedGeometry.Detach());

@msft-Jeyaram msft-Jeyaram Mar 17, 2017

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: As per D2D DrawGeo.. a transformed geometry will have a thinner line width, than an untransformed geometry + transformation.

Working on a fix in the coming iteration. #Resolved

@DHowett-MSFT

DHowett-MSFT commented Mar 17, 2017

Copy link
Copy Markdown

Do we have any tests for stroking with a pattern brush? #Resolved

@msft-Jeyaram

msft-Jeyaram commented Mar 17, 2017

Copy link
Copy Markdown
Author

@DHowett-MSFT TEST_P(CGPatternColoredRectBasedStroke, PatternStrokeRegion) {
Cover the stroke #Resolved

CGContextFillRect(context, bounds);
}

DRAW_TEST_F(CGPatternTests, PatternFillTransformationWindowsLogoTranslate, UIKitMimicTest<>) {

@DHowett-MSFT DHowett-MSFT Mar 17, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these can be parameterized on CGAffineTransform #ByDesign

@DHowett-MSFT DHowett-MSFT Mar 17, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, we don't know what happens to stroke pattern brushes under transformation #Resolved

@DHowett-MSFT DHowett-MSFT left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot review this in time for my vacation, but I am not going to leave it with an ❌

I recuse myself from review.

@msft-Jeyaram msft-Jeyaram force-pushed the FixRotationPatternBrush_3 branch 2 times, most recently from bab9b92 to 859f25f Compare March 22, 2017 21:55
ComPtr<ID2D1Factory> factory;
deviceContext->GetFactory(&factory);

ComPtr<ID2D1Factory1> factory1;

@rajsesh rajsesh Mar 23, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

factory1 [](start = 30, length = 8)

factory.As(&factory1)? also no need for fail fasts here, we will crash right afterwards anyway. #Resolved

Jeyaram Jeyaraj added 5 commits March 22, 2017 21:12
…ion, scaling or translation.

Thus any transformation that is done to the context, should only be applied to the context and not the CGPattern image.
CGPattern image, which is drawn via the callback should be treated like an image.
Adding image scaling and proper sizing to the user drawn CGPattern image.
…to the render target.

Thus this way, any transformation to the context is applied to the geometry before being drawn (vs. applying the geometry to the render target the drawing).
This will allow sub-mechanism (e.g brushes) to keep their proper orientation while being drawn.

This is funneled through Draw() function, thus since the geometry is already transformed, the coordinate mode is set to _kCGCoordinateModeDeviceSpace to ensure
that transform is not applied to the render target.
The line width should not subject to transformation (but should respect DPI).
Fixing the Stroke so that it does not apply the transformation to the stroke,
but respect the DPI values (e.g thicker/thinner).
Also including CoreGraphics vs UIKit based tests.
@msft-Jeyaram msft-Jeyaram force-pushed the FixRotationPatternBrush_3 branch from d81e803 to bce05fa Compare March 23, 2017 04:13
- GetBoundingBox
- PathApplyControlPointsQuadCurve
- PathApplyControlPointsArcs
- PathApplyControlPointsArcsSimple

These tests had the wrong reference image, also these are UIKit based tests.
Currently, UIKit mimicking of 2x scaling for strokes is not implemented.
@msft-Jeyaram msft-Jeyaram force-pushed the FixRotationPatternBrush_3 branch from bce05fa to 21fc872 Compare March 23, 2017 05:33
@msft-Jeyaram msft-Jeyaram merged commit 1903d21 into microsoft:develop Mar 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CGPattern CTM rotation should not affect the brush

4 participants