What is the diffrence between ShapeBorderClipper class and CustomClipper<T> class - dart

I wanted to know what is the diffrence between ShapeBorderClipper class and CustomClipper class and when is the best to use each one of them

ShapeBorderClipper is a special type of CustomClipper, which according to its documentation clips to the outer path of a ShapeBorder. And as you know CustomClipper is used to customize the clipping behavior of clip widgets such as ClipRRect and ClipOval.
As for when it is suitable to use each one you should opt for CustomClipper when you want to alter the behavior of a Clip widget. and use ShapeBorderClipper if you want to a new shape based on the mix of the current widget border and the ShapeBorder provided to ShapeBorderClipper.

Related

How to style the transform anchors on a Konva element?

How do I style the transform anchors (e.g., blue boxes) on a transformable Konva element? Note I'm using Konva with konva-react.
Example 1:
In other words, what if I wanted to make the boxes grey, and semi-transparent? Or change the size?
Example 2:
Or, what if I waned to remove the anchors and make the entire edge of a Rect able to be grabbed to resize? In other words, make the anchor transparent and full-height/full-width.
I’d start your research using the elements from this example:
https://konvajs.org/docs/sandbox/Image_Resize.html
It shows that the transformer has various bits you can style in your own way. Good luck with that.

Is there a way to change position of transformer anchors so that I can interact with transformer using mousemove but from outside of transformer box?

For example need to use rotate anchor from another position then default top center of transformer
I have tried to create new Konva.Rect and pass its 'mousedown' and 'mousemove' events to transformer _handleMouseMove but didn't find appropriate way for it to work correctly.

Theme colors Material Design vs Angular Material

If I refer to Material Design guidelines about Colors, they define :
Primary
Primary Variant
Secondary
Secondary Variant
Background
Surface
Error
Angular material define
Primary
Secondary
Warn
In addition the contrast color in angular is the equivalent of the On* in MDC.
1> In Angular Material background and surface are set to white or black depending of the theme builder function. No access for custom.
[edit] (thanks #G. Tranter):
Custom background color here
2> In Angular Material, I can define lighter and darker variant of each of the 3 colors, but I do not have control of where those variants are used !
(unless I manually overwrite each mat-* class...)
I am able to build my theme with two colors (primary and accent). But I don't get the point to define variants if I cannot assign the variants to specific UI elements.
[edit] (thanks #G. Tranter):
In Angular Material the use of variants is defined by the component itself.
If I refer to Material design examples (same page linked above) I cannot reproduce the theme with primary, primary variant and secondary for example...
did I miss something ? or does someone can enlighten me about this 2 major restrictions in theming ?
[edit] (thanks #G. Tranter):
In Angular Material we can define a second theme (with Primary and Accent colors) that will be applied to a specific CSS class
.item-second-theme {
#include angular-material-theme($second-theme);
}
Neither is actually a restriction (at least completely).
You can customize the foreground and background by modifying the theme before you apply it to your application and to Angular Material. See this post. However, it is probably not a great idea from a Material Design point of view to use background and foreground palettes that don't follow the guidelines, so there's usually no reason to not use the default ones in Angular Material.
You can't control how Angular Material components use the variants - that is part of the design of the components themselves. But you can control what those variants are when you create your palettes. For example:
$primary-palette: mat-palette($mat-blue, 500, 100, 700); // default
or
$primary-palette: mat-palette($mat-blue, 700, 300, 900); // darker
And of course you have complete control within your own components as to how shades are used.

JUNG Visualisation

Does anyone know if you are able to set the colour of the text for a vertex label in JUNG.
I'm using the Visualisation Viewer and can seem to be able to set the colour for everything else.
vv = new VisualizationViewer<String,Integer>(treeLayout, new Dimension(410,557));
Transformer<String,Paint> vertexPaint = new Transformer<String,Paint>() {
public Paint transform(String b) {
return Color.orange;
}
};
vv.setBackground(Color.white);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
//vv.getRenderContext().setVertexFontTransformer(vertexFont);
// add a listener for ToolTips
vv.setVertexToolTipTransformer(new ToStringLabeller());
vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.WHITE));
The DefaultVertexLabelRenderer and the DefaultEdgeLabelRenderer extend JLabel (it is similar to the way cell renderers work in JTable and JTree).
By default, it uses the foreground color of the VisualizationViewer to draw the label text.
vv.setForegroundColor(Color.red);
will make all of your labels red.
This approach is less expensive than making all of the labels parse HTML.
Sorry that the solution is so obscure.
Additionally, since the default renderers extend JLabel, the use of html is the same as it is for JLabel. There are good online resources to show examples of using html with javax.swing. What's missing is documentation to make the connection between using html in JUNG and using html in javax.swing.
You can use HTML in the label to specify the color; an example is here: https://stackoverflow.com/a/2017576/664856
In your case,
vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.RED));
should work (if you wanted selected vertex to be Red). I tested it myself. This applies to the selected vertex.
Upon inspection of code, I would have to believe that the link I provided does correctly work for those vertices which are not selected, but I did not actually try implementing that link.

Set global text color?

I know that to use color in a document you have to load the package "color". But I can only find documentation on how to define color for a given part of the document... not what I want to do. What I do want is to define a global text color, that is used per default.
Is this possible? Can anyone tell me how to do this?
If you use, for example
\color{red}
in your preamble, before \begin{document}, then the text should be red throughout your document unless you override with another \color declaration.

Resources