Getting masked area to be transparent?
Tag : cpp , By : Pieter Taelman
Date : March 29 2020, 07:55 AM
help you fix your problem This can be done by first setting its alpha value to 0 of the regions that you want to make them fully transparent (255 for others), and then save it to PNG. To set the alpha value of pixel-(x,y), it can be done: image.at<cv::Vec4b>(y, x)[3] = 0;
cv::cvtColor(image, image, CV_BGR2BGRA);
cv::Mat mask; // 0 for transparent regions, 255 otherwise (serve as the alpha channel)
std::vector<cv::Mat> channels;
cv::split(image, channels);
channels.push_back(mask);
cv::Mat result;
cv::merge(channels, result);
|
Masked bitmap on canvas with transparent activity
Date : March 29 2020, 07:55 AM
To fix the issue you can do I implemented custom ShowCase for activity , I solve this Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
mCanvas.drawBitmap(cBitmap,mXPosition,mYPosition,paint);
// mShape.draw(canvas, mEraser, mXPosition, mYPosition, mShapePadding);
// Draw the bitmap on our views canvas.
canvas.drawBitmap(mBitmap, 0, 0, null);
|
Make hexagon shape with border, rounded corners and transparent background
Tag : css , By : hsdfhksh
Date : March 29 2020, 07:55 AM
it fixes the issue Hexagon with rounded corners are complex shapes to create and I usually recommend using SVG for creating them. The need for a transparent background makes it even more better suited for SVG. With SVG you can get better control over the shape, its curves etc and you don't have to add a lot of extra (unnecessary) elements to your markup also. All that is needed for creating this shape with SVG is to use a single path element along with a few L (line) and A (arc) commands. The L (line) command basically draws a line from point 1 to point 2 whereas the A (arc) command draws an arc of the specified radius (the first two values immediately following the A command). svg {
height: 200px;
width: 240px;
}
path {
stroke: #777;
fill: none;
}
body {
background: black;
}
<svg viewBox='0 0 120 100'>
<path d='M38,2
L82,2
A12,12 0 0,1 94,10
L112,44
A12,12 0 0,1 112,56
L94,90
A12,12 0 0,1 82,98
L38,98
A12,12 0 0,1 26,90
L8,56
A12,12 0 0,1 8,44
L26,10
A12,12 0 0,1 38,2' />
</svg>
.roundHex {
position: relative;
margin: 0 auto;
background: transparent;
border-radius: 10px;
height: 300px;
width: 180px;
box-sizing: border-box;
transition: all 1s;
border: 10px solid transparent;
border-top-color: black;
border-bottom-color: black;
}
.roundHex:before,
.roundHex:after {
content: "";
border: inherit;
position: absolute;
top: -10px;
left: -10px;
background: inherit;
border-radius: inherit;
height: 100%;
width: 100%;
}
.roundHex:before {
transform: rotate(60deg);
}
.roundHex:after {
transform: rotate(-60deg);
}
<div class="roundHex"></div>
|
Hexagon with semi transparent background and border
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You can modify the background-color of the pseudo element with gradient to color only half of it: .hexagon {
position: relative;
width: 290px;
height: 173.21px;
margin: 86.60px 0;
border-left: solid 5px #333333;
border-right: solid 5px #333333;
background-color: rgb(102, 204, 34, 0.7);
}
.hexagon:before,
.hexagon:after {
box-sizing: border-box;
content: "";
position: absolute;
z-index: 1;
width: 212.13px;
height: 212.13px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
left: 38.9340px;
}
.hexagon:before {
top: -106.0660px;
border-top: solid 7.0711px #333333;
border-right: solid 7.0711px #333333;
background:linear-gradient(to bottom left,rgb(102, 204, 34, 0.7) 48%,transparent 48%);
}
.hexagon:after {
bottom: -106.0660px;
border-bottom: solid 7.0711px #333333;
border-left: solid 7.0711px #333333;
background:linear-gradient(to top right,rgb(102, 204, 34, 0.7) 48%,transparent 49%);
}
<div class="hexagon">
<span style="font-size: 11px">1</span>
<span>2 </span>
</div>
body {
margin:0;
background:linear-gradient(to right, blue 10%,pink);
}
.box {
background: url('data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="174" height="200" viewBox="-5 -5 180 220"><path fill="rgb(102, 204, 34, 0.5)" stroke="black" stroke-width="3" d="M86.60254037844386 0L173.20508075688772 50L173.20508075688772 150L86.60254037844386 200L0 150L0 50Z"></path></svg>');
height: 200px;
width: 180px;
background-repeat: no-repeat;
background-position: center;
display:inline-block;
line-height:150px;
text-align:center;
}
svg {
display:inline-block;
vertical-align:top;
}
<div class="box">
SVG as background
</div>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="174" height="200" viewBox="-5 -5 180 220"><path fill="rgb(102, 204, 34, 0.5)" stroke="black" stroke-width="3" d="M86.60254037844386 0L173.20508075688772 50L173.20508075688772 150L86.60254037844386 200L0 150L0 50Z"></path>
<text x=20 y=80 >Normal SVG</text>
</svg>
body {
background:linear-gradient(to right,pink, blue);
}
.hexagon {
position: relative;
width: 290px;
height: 290px;
margin: 50px;
background:
linear-gradient(to bottom left,transparent calc(50% - 3px),#000 calc(50% - 3px))0 100%/50% 25% no-repeat,
linear-gradient(to bottom right,transparent calc(50% - 3px),#000 calc(50% - 3px))100% 100%/50% 25% no-repeat,
linear-gradient(to top right,transparent calc(50% - 3px),#000 calc(50% - 3px))100% 0/50% 25% no-repeat,
linear-gradient(to top left,transparent calc(50% - 3px),#000 calc(50% - 3px))0 0/50% 25% no-repeat,
linear-gradient(#000,#000)0 0/3px 100% no-repeat,
linear-gradient(#000,#000)100% 0/3px 100% no-repeat,
rgba(102, 204, 34, 0.5);
-webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
<div class="hexagon">
</div>
|
Create a transparent hexagon with border in css
Tag : html , By : Cenneca
Date : March 29 2020, 07:55 AM
|