Shadow with transparent background in Jetpack Compose - shadow

Can anyone explain this?
And how to make the center rectangle with the color of the background disappear?
the result here
I've tried many ways but still can't understand the logic here. (different from Flutter UI)
Box(
modifier = Modifier
.fillMaxWidth()
.shadow(elevation = 3.dp, shape = RoundedCornerShape(28.dp))
.background(
MaterialTheme.colors.primary.copy(alpha = 0.8f),
shape = RoundedCornerShape(28.dp)
)
.padding(16.dp)
)

use like this -
.background(
MaterialTheme.colors.primary.copy(alpha = 0.8f).compositeOver(Color.White),
shape = RoundedCornerShape(28.dp)
)
the background basically shows for elevation and shadow, if you remove them then it will be gone, since you are using transparent color that's why you are seeing this. but make the color solid but light using compositeOver , then it will work fine.

Related

mxGraph how to use edge in different way

I trying to create a network architecture using vertex and edge objects from mxGraph.
Now in first image ZCU_08_01 is connected to ZCU_01_01 as you see.
Is possible the modification using edges like in next image ? And if possible, how? (of course assuming straight line sections not "hand made" :) )
The edge is defined:
var E33 = graph.insertEdge(parent, null, '', ID618, ID620,'strokeColor=#FF0000;');
and the style definition for edges is:
style = graph.getStylesheet().getDefaultEdgeStyle();
style[mxConstants.STYLE_EDGE] = mxConstants.EDGESTYLE_ORTHOGONAL;
style[mxConstants.STYLE_EDGE] = mxConstants.EDGESTYLE_SIDETOSIDE;
style[mxConstants.STYLE_ENDARROW] = mxConstants.NONE;
style[mxConstants.STYLE_ROUNDED] = true;
Thank in advance

How to update the color of (the state of) the cell during resize in mxgraph?

I want to change the color of a state of a cell during resize of the cell.
To achieve this, I have added the following code to mxVertexHandler.prototype.updateLivePreview:
mxVertexHandler.prototype.updateLivePreview = function (me) {
...
this.state.x = this.bounds.x;
this.state.y = this.bounds.y;
this.state.origin = new mxPoint(this.state.x / scale - tr.x, this.state.y / scale - tr.y);
this.state.width = this.bounds.width;
this.state.height = this.bounds.height;
...
this.state.shape.fill = "#CCCCCC";
this.state.shape.fillOpacity = 30;
...
}
What happens is that this code changes the opacity of the cell while resized, but does not change the fill color.
How can I cange the fill color too?
Thanks,
-- Jaap
No, that does not work either.
BTW, I thought that temporal changes, e.g. during a resize, should go via the state.
I do not understand why fillOpacity (and other properties) works, and fill not. It seems that the fill is overwritten somewhere else (e.g. after calling updateLivePreview), but I can not figure out where.

animate label text color from transparent to black in libgdx

I have been trying to animate the color of label from transparent to black. I had little success. The label remains fully transparent during whole aniamtion. This is the code I used. Stage is already set correctly since other Actor work normally.
Label.LabelStyle lsBy = new Label.LabelStyle(byFont, new Color(0,0,0,0));
Label byLabel = new Label("text to animate",lsBy);
ColorAction ca= new ColorAction();
ca.setEndColor(new Color(0,0,0,1));
ca.setDuration(0.8f);
label.addAction(ca);
What is the correct way to animate label text color?
A bit confusing, but a Label has two colors. One is the color of the font in its LabelStyle. The other is its own color, as all Actors have. These two colors are multiplied by each other for drawing. ColorAction only affects the color of the actor, not the color of the style.
You need to leave the label style's color as white, and set the color of the Label actor itself to transparent.
Label.LabelStyle lsBy = new Label.LabelStyle(byFont, Color.WHITE);
Label byLabel = new Label("text to animate",lsBy);
byLabel.setColor(Color.CLEAR);
ColorAction ca= new ColorAction();
ca.setEndColor(new Color(0,0,0,1));
ca.setDuration(0.8f);
label.addAction(ca);

Access VBA Back Color Gradient For Label/Shape

I'm looking for a way in Access VBA to set the backcolor of a label, shaped, etc as a gradient. I'm currently applying solid colors but was hoping there is a way to accomplish this via a gradient.
Here is how I'm currently applying a back color in Access:
Label2.BackColor = RGB(119, 49, 65)
Here was the code I was using in Excel, to fill a cell as a gradient, worked well. However, I'm not sure exactly how Access VBA would work. Suggestions to point me in the right direction?
Range("D14").Select
With Selection.Interior
.Pattern = xlPatternLinearGradient
.Gradient.Degree = 0
.Gradient.ColorStops.Clear
End With
With Selection.Interior.Gradient.ColorStops.Add(0)
.Color = 2786997
.TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(1)
.Color = 1447704
.TintAndShade = 0
End With
A Label cannot have a gradient background.
If you want to set the gradient on a button you can do that similar to before.
button.Gradient = 12

Multiple masked image

I am trying to make multiple masked images.
How can I make;
image_01 + mask_image_01 = image_02
image_02 + mask_image_02 = image_03 ?
** image_02 is result of image_01 with mask_image_01.
(should be running on both Chrome and IE)
Assuming that I've understood you right, you can just use the background property for an image:
CSS:
#image_o1 {
background: transparent url(http://davidrhysthomas.co.uk/linked/astrid_avatar.png) top left no-repeat;
}
HTML:
<img id="image_o1" src="http://davidrhysthomas.co.uk/linked/mask.png" />
JS Fiddle demo.
The only major problem with this method is that it uses the masking image in the src of the img element, and puts the 'real' image in the background.
If JavaScript is an option, then you could use the image you want to mask as the src of the image element(s), and then switch that for a mask, though this is a little messy (and could definitely be improved):
function imageMask(){
var masked = document.getElementsByClassName('masked');
var mD, mU, rImg;
for (i=0; i<masked.length; i++){
mD = window.getComputedStyle(masked[i],null).backgroundImage;
mU = mD.substring(mD.indexOf('(')+1,mD.indexOf(')'));
rImg = masked[i].src;
masked[i].src = mU;
/*
For some (probably obvious) reason:
masked[i].style.backgroundImage = rImg;
refused to work, so I'm using 'setAttribute()' instead, in a
hackish and hideous workaround.
*/
masked[i].setAttribute('style','background-image: url(' + rImg + ');');
}
};
window.onload = imageMask();
JS Fiddle demo
Browser compatibility might be a problem with the JavaScript approach, though, as IE (I think) doesn't support either .getElementsByClassName() or window.getComputedStyle(). The majority of other browsers, though, seem happy enough with it. Tested in Firefox 7 and Chromium 14 on Ubuntu 11.04.