In hummus js how can i draw a filled rectangle with transparent? - node.js

How can I draw a rectangle with a transparent color?
I tried the below code. I am using hummusjs for modifying pdf.
cxt.drawRectangle(x,y,width,height,{type: 'fill',
color: '#eeeeee',
opacity: 0.9});

If your intention is to draw a rectangle without fill and only containing borders, try this:
cxt.drawRectangle(x,y,width,height,{type: 'stroke',
color: '#eeeeee',
opacity: 0.9});

Related

am5charts pie of pie change the legend color text to red

How can I change the font color of the text below? my background is dark.
my jsfiddle: https://jsfiddle.net/theg99/2vsnmb16/1/
I did mange to change the colors of the lines with:
var line0 = container.children.push(
am5.Line.new(root, {
position: "absolute",
stroke: root.interfaceColors.get("text"),
strokeDasharray: [2, 2],
stroke: am5.color('#0xFFFFFF'), //<--I added this, but whats for text?
})
);
It looks like this should work:
subSeries.labels.template.set("fill", am5.color(0xff0000));
This changes all the labels on your second chart - is that what you're looking for?

fabricjs clippath not working as per size

I am trying to apply clippath on image, i am passing rect as clippath to image and size of rect is same as image including scale, still after apply clippath image cropped like clipath is less then what we applied.
i have checked clippath scaled width , height after apply is still same but image is clipped bit small like given in attached image.
var rect = new fabric.Rect({
left: 0,
top: 0,
width: obj.getScaledWidth(),
height: obj.getScaledHeight(),
originX: 'center',
originY: 'center'
});
rect.setCoords();
obj.clipPath = rect;
obj.clipPath.dirty = true;
obj.dirty = true; canvas.renderAll();
My fabric version is 3.4.0.
original image on left side and after apply same size rect as clippath clipped image on right side, actual result should be same size image without any clipped part
one thing i have noticed is cacheHeight and cacheWidth of clipath is less then width and height of clippath. please find below screenshot, is it reason for that, if then what will be solution?

How to add border to the image as polygon/round shaped

We are building the shapes for conveyors, Is there any way to create a rounded border for the images? The below images, which are png files, have square borders around the selected Images.
While Searching we found this code from the link
CSS Border on PNG image with transparent parts
img{
-webkit-filter: drop-shadow(1px 1px 0 black) drop-shadow(-1px -1px 0 black);
filter:drop-shadow(1px 1px 0 black) drop-shadow(-1px -1px 0 black);
}
Is there any way to add drop-shadow to the images in canvas?
Kindly help us with relevant codes and suggestions.
I did this by the properties shadow and strokeWidth(in css by adding shadow). So that image will be like this.
item.strokeWidth = 15;
item.shadow = new fabric.Shadow({color:'red',blur:15,affectStroke:true});
Present Output:
If someone has a better solution kindly brainstorm me.

raphael - SVG should be hidden when overflowing background SVG

http://codepen.io/keyboardninja/pen/WQwoRg
var content = paper.text (70, 54, "3").attr({
"font-size": "120px",
"font-weight": "600",
'fill': 'red',
});
I want the content of the triangle not to be visible outside of the triangle. The black background is the only place where the content should be visible on, not outside of that. is there a way to make something like to hide content that overflows the shape of the black triangle background ?

OpenLayers 3 Stroke style

I want to modify style of the method select . I'm able to change the style of this method but i'm not able to duplicate the white border of blue stroke.
Someone is able to style vector with a stroke and put a border to the stroke?
See this example, for understand what i'm talking about:
http://openlayers.org/en/v3.4.0/examples/select-features.html
The trick is that you have two styles. With the first style you are drawing a white line, with the second style a thinner blue line on top:
var width = 3;
var styles = [
new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'white',
width: width + 2
})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: width
})
})
];

Resources