-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Pattern transformation. #2263
Support for Pattern transformation. #2263
Conversation
|
||
// Draw it in device space, so transformation is not applied to the render target. | ||
coordinateMode = _kCGCoordinateModeDeviceSpace; | ||
geometry.Attach(transformedGeometry.Detach()); |
There was a problem hiding this comment.
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
Do we have any tests for stroking with a pattern brush? #Resolved |
@DHowett-MSFT TEST_P(CGPatternColoredRectBasedStroke, PatternStrokeRegion) { |
CGContextFillRect(context, bounds); | ||
} | ||
|
||
DRAW_TEST_F(CGPatternTests, PatternFillTransformationWindowsLogoTranslate, UIKitMimicTest<>) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
bab9b92
to
859f25f
Compare
@@ -144,15 +143,23 @@ inline void ComputeStrokeStyle(ID2D1DeviceContext* deviceContext) { | |||
ComPtr<ID2D1Factory> factory; | |||
deviceContext->GetFactory(&factory); | |||
|
|||
ComPtr<ID2D1Factory1> factory1; |
There was a problem hiding this comment.
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
…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.
d81e803
to
bce05fa
Compare
- 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.
bce05fa
to
21fc872
Compare
fixes #2108