Different paddings for text-background-padding in Cytoscape? - cytoscape.js

Is it possible to specify different values for top/right/bottom/left paddings for node's label background in Cytoscape?
Currently this works for me: 'text-background-padding': '6px'
But this doesn't: 'text-background-padding': '10px 20px 30px 40px'

Related

How to set fliers in matplotlib.pyplot.boxplot

I'm using python to create boxplots seen here:
The filers are 'o' markers, but the width of the circles are too thick.
I want to know how to show hollow instead of solid dots.

Add horizontal padding if the original image is less than the width specified

I don't think this is possible out of the box but wanted to make sure.
We'd like to do the following.
Take any image input and force the output width to be a fixed size. If the width is less than the output width, we'd like to center the image and add horizontal padding to the image but not add vertical padding.
For example
Original image is 700px x 400px
Final output size of 1000px width x 400px. This would include 150px padding left and 150px padding right (no top / bottom padding).
I know that we can upscale the image (scale=both) or set the canvas scale (but that adds top / bottom padding) or we could add padding to the image but none are really what we want.
Thanks for any help
Response to Nathanael
Your comments are exactly correct.
I expected http://z.zr.io/ri/red-leaf.jpg?width=1000&scale=canvas&bgcolor=gray to work exactly as it does
Yes, our problem is that the image heights are not known beforehand, but it's good to know that this works with a known height
I think it would be great if there was a command for scale=padwidth that would work with variable heights. Or a setting for padwidth=true and padheight=false that could be used in conjunction with scale=canvas.
So, let's say that you're given an 800x600px image, and you apply ?width=1000&scale=canvas. You were expecting that this would produce a 1000x600px image, but instead it produced a 1000x750px image, right?
http://z.zr.io/ri/red-leaf.jpg?width=1000&scale=canvas&bgcolor=gray
If you specify the height explicitly, the padding goes away - but you may not know the image height beforehand, correct?
http://z.zr.io/ri/red-leaf.jpg?width=1000&scale=canvas&bgcolor=gray&height=600
What would be the least surprising behavior - maintaining aspect ratio, or only adding the minimum padding required? How would you expect this to behave, or be exposed as a command?

WinRT Ellipse Stroke Thickness not consistent

I want to draw in WinRT (Windows 8.1) multiple circles with same size and stroke thickness. If I use Ellipse elements and set on all elements the same values (no fill color) I get circles with different stroke thickness. But they should all have the same stroke thickness. How can this be fixed?
The Ellipse is created programmatically and then added as child element to a Grid
Ellipse e = new Ellipse();
e.Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
e.StrokeThickness = 1;
e.Width = 30;
e.Height = 30;
You're not seeing different StrokeThickness what you are seeing is 2 or more Ellipse on top of each other. But you're probably wondering why it appears "Thicker", it is because antialiasing on the outer/inner edges of the ellipse.
When you have two or more they will blend with each other, so the antialiasing will appear thicker because the semi-transparent edges will AlphaBlend, if you have enough layers then all outer/inner edges will lose its transparency and eventually will become a very jagged Ellipse.
If you can figure how to turn antialias off like WPF's SnapsToDevicePixels then you won't have this effect, but you will have a jagged Ellipse.

Issues setting UIEdgeInsetsMake for UNEVEN image

I need HELP setting up resizableImageWithCapInsets:UIEdgeInsetsMake for an UNEVEN image. I have used this successfully with EVEN images, it works fine but having lot of difficulty setting correct values for a particular image. I have a callout bubble image (attached) of size 49 X 158 and using following values for resizableImageWithCapInsets:UIEdgeInsetsMake:
dialogueBubbleImage = [[UIImage imageNamed:#"BubbleBottomRightLong_1.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(20, 23, 138, 23)];//49 × 158. UIEdgeInsetsMake: CGFloat top, left, bottom, right;
Whole idea is to display a label with text inside the white box area, keeping the callout arrow as-is.
Here is the image I am using:
what exactly is the problem? your value for top is too high, you are leaving a 0px vertical area to tile. ideally you would have a single pixel left to tile, so i would choose values like:
dialogueBubbleImage = [[UIImage imageNamed:#"BubbleBottomRightLong_1.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(12, 24, 145, 24)];

OpenGL multi texture masking

I fallowed #Stefan Monov tutorial in this question. And everything works, but I need to make it working with my brush. I need to do so:
// Next, we want a blendfunc that doesn't change the color of any pixels,
// but rather replaces the framebuffer alpha values with values based
// on the whiteness of the mask. In other words, if a pixel is white in the mask,
// then the corresponding framebuffer pixel's alpha will be set to 1.
glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ZERO);
// Now "draw" the mask (again, this doesn't produce a visible result, it just
// changes the alpha values in the framebuffer)
drawQuad(maskTexture);
would be not a static texture, but dynamic shape. I mean, i'm trying to implement brush witch is doing such a thing that is written by #Stefan Monov. So I need that this place could be implemented in other - (void) function, so that it could be called, when coordinates changes (when user draws). I tried a variety of ways to change the sequence of your code, but it does not work correctly then. Now my bursh code is:
glEnable(GL_BLEND);
glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ZERO);
glPointSize(100);
glBegin(GL_POINTS);
glColorMask(1.0,1.0,1.0, 1.0);
glVertex2f(loc.x, loc.y);
glEnd();
glDisable(GL_BLEND);
It is called when mouse is dragged. "loc" is dragged mouse coordinates. Afcourse its not working now at all, because of blendFunc and code's sequence. When I leave sequence as #Stefan Monov described, it works, but it draws one point and drags it when mouse is dragged. Becouse after drawing point, other textures is being redrawed too. Any, at least similar, solution for it?
To make it more clear i'll show how I want my APP to work.
Here is the original code:
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ZERO);
drawQuad(backgroundTexture);
glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ZERO);
drawQuad(maskTexture);
glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA);
drawQuad(foregroundTexture);
Now its working like this:
Draws background
Draws mask
Draws foreground
I need it to work like this:
Draws bacground
Draws foreground
Draws mask
But if i change the order of drawings it stops working. Ignores mask.
Expected result foto:
Your attempt to draw the mask last makes no sense really.
Drawing the mask only modifies what's in the alpha channel, and the alpha channel itself is not visible in any way in the final image.
The only use of the mask is to modify what's drawn after it.