Cross hatch and other Pattern Fills?

I would really like a “cross hatch” or “lined” type fill to be allowed for polygons. I have an activity where filled shapes overlap and I think it would be easier to see the intersection regions if they were filled with diagonal lines going in opposite directions.

+1

For folks that are completely color blind, this might be especially helpful.

2 Likes

I created the feature request

1 Like

Agreed. Even with choosing contrasting colors, they tend to get muddy after a few layers. Like: “Is this brown different from this other brown?”

We have released a new dev version of DoenetML with support for pattern filling. I’d be interested in feedback on how it works.

Assuming you have the dev version selected and have it updated to the newest version (possibly requiring clearing of the browser cache), then you can do things like

<styleDefinition styleNumber="2" fillStyle="diagonalCrosshatch" />

<graph>
  <regularPolygon numSides="5" sideLength="3" styleNumber="2" filled />
  <circle center="(5,4)" radius="6" fillStyle="horizontal" filled />
</graph>

Is there a way to control the opacity on the lines in the pattern?

I changed the fill style for A’ in Venn Diagram Shader and it looks pretty good, but the lines are a tad too dark.

I also appreciate how it doesn’t break across regions if your region (like mine) is really two polygons.

You can only change colors and opacity using the <styleDefinition>. The attribute fillOpacity should affect the opacity of the pattern fill.

I have my fillOpacity set to 0.4. I just want the lines to be a bit lighter, maybe 10% higher than the fill opacity?. The lines make it hard to read the labels on some of my elements.

We don’t currently have another dial than fillOpacity to change the opacity of the fill (whether it is a pattern or solid). I can’t think of what other dial to that wouldn’t be confusing. Can you decrease the fill opacity of the styles that you use for pattern fills?

Apologies if I am misunderstanding the concern!

ALERT: we may backtrack on some of these available patterns.

I’ve been in discussion with David Austin, developer of PreFigure, about accessibility support for the different pattern fills. There are some concerns about tactile support for the some of the patterns, namely the crosshatches.

From the guidelines from the Braille Authority of North America, specifically the textures available for Tiger embossers (Appendix H), which PreFigure is optimized for, it suggests these patterns:

David and I are discussing to changing the supported patterns to “horizontal”, “vertical”, “diagonal”, “dots”, and “diamonds”, as shown in the graph.

If we do make the change, then unsupported options like “crosshatch”, will no longer work.

I definitely want to avoid removing features from an actual released version, so plan is to remove them before we release a new version (which I was hoping to do by the end of the week). We can always add features, but removing them causes problems with backward-incompatibility. That’s why I’d like to be conservative on this for an actual release, and we can continue to discuss adding back patterns in a future release.

1 Like

I definitely agree with the crosshatch issue and dots would be very nice!

I also got backDiagonal approved by David, so we’ll just be removing the two cross hatches, and I’ll work on adding the dots and the diamonds.

Wait, it appears that the fill pattern lines aren’t even obeying fillOpacity! That would explain your concerns. I’ll look into that, too.

1 Like

OK, I released a new dev version with the revised fillPatterns, with the new dots and diamonds fill patterns. The crosshatch patterns are removed (though the same effect can easily be reproduced with overlapping shapes filled with horizontal and vertical lines or with the two diagonal lines).

Also, I did decide to add another dial for fill opacity: fillPatternOpacity. Since fill patterns will generally be used with a much higher opacity than a solid fill, I decided it was better to have a separate opacity attribute. fillPatternOpacity defaults to 1, but you can see it smaller to make it easier to see things through it.

1 Like

I especially love the dots fill. This looks great!

1 Like

I’d like to better understand the request for opacity on the patterned fills as there are a number of compositing operations that can be used here. For instance, setting fill-opacity=“0” on the pattern means that that pattern is completely transparent. But the patterns are mostly empty space (e.g. lines separated by quite a bit of space) and therefore mostly transparent anyway. A second notion of opacity would apply to the background. For instance, in Duane’s demonstration (screenshot below), wouldn’t it be preferable to control the extent to which the axes in the background appear behind the filled region? The range of opacity would be from 0, where the axes are plainly visible as shown below, to 1, where the axes are completely hidden so that we just see the fill on a white background.

This is an example demonstrating what I mean. The opacity of the circles varies from 0 to 1 moving around the circle, which controls the extent to which we see the grid in the background.

I had requested the ability to control the opacity of the lines (or dots/diamonds). I guess I was hoping to be able to control the background opacity separate from the line opacity.

I was using the pattern fill without axes, but found that having very dark lines would interfere with the ability to read other labels on the image.

What is the effect of using lighter fill lines in that case?