rounded-corners

UIImage with rounded corners

旧时模样 提交于 2019-11-27 17:44:53
I have read several posts already. And almost everyone suggest using QuartzCore/QuartzCore.h with layer.cornerRadius I have tried this method and some more methods. Well, everything works fine when an image doesn't move. But in my project I always move my images. If I add corner radius or a shadow the image movement is no longer smooth. And it looks aweful! That is the way I resize my image: CGSize newSize = CGSizeMake(200*height/image.size.height, 280); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(nil, newSize.width, newSize.height,

Bitmap in ImageView with rounded corners

时光毁灭记忆、已成空白 提交于 2019-11-27 17:36:05
I have an ImageView and I want to make it with rounded corners . I use this: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@null"/> <stroke android:width="1dp" android:color="#ff000000"/> <corners android:radius="62px"/> </shape> And set this code as background of my imageview. It works, but the src image that I put on the ImageView is going out of the borders and doesn't adapt itself into the new shape. How can I solve the problem? Anand try this one : public class CustomImageView

Algorithm for creating rounded corners in a polygon

↘锁芯ラ 提交于 2019-11-27 17:06:48
I'm looking for an algorithm that allows me to create rounded corners from a polygon. In Input, I get an array of points that represents the polygon (red line) and in output, an array of points that represents the polygon with rounded corner (black line). I would also like to have a way to control the radius of each corner. I already tried to use Bezier and Subdivision but it's not what I'm looking for. Bezier and Subdivision are smoothing all the polygon. What I want, it's only make the corners rounded. Somebody knows any good algorithm for doing that? I'm working in C# but the code has to be

How do I create a WPF Rounded Corner container?

冷暖自知 提交于 2019-11-27 16:53:24
We are creating an XBAP application that we need to have rounded corners in various locations in a single page and we would like to have a WPF Rounded Corner container to place a bunch of other elements within. Does anyone have some suggestions or sample code on how we can best accomplish this? Either with styles on a or with creating a custom control? kobusb You don't need a custom control, just put your container in a border element: <Border BorderBrush="#FF000000" BorderThickness="1" CornerRadius="8"> <Grid/> </Border> You can replace the <Grid/> with any of the layout containers... I know

How to put rounded corners on a Chart.js Bar chart

删除回忆录丶 提交于 2019-11-27 16:04:46
I have created a bar chart in chart.js using the below code. However I want to give the bars rounded corners instead of edged ones at the top of the bars. I can't find any way to do this using the global settings of chart.js. Is there any way to achieve the effect I want? var barContext = document.getElementById("canvas").getContext("2d"); var barGradientFirst = barContext.createLinearGradient(0, 0, 0, 450); barGradientFirst.addColorStop(0, 'rgba(112,122,157, 0.1)'); barGradientFirst.addColorStop(1, 'rgba(112,122,157, 1)'); var barGradientSecond = barContext.createLinearGradient(0, 0, 0, 450);

Rounded Corners on DIVs with Background Color

ぃ、小莉子 提交于 2019-11-27 15:56:38
问题 I've got some code that looks like this: <div id="shell"> <div id="title">TITLE HERE</div> <div id="content">Article Content Goes Here</div> </div> The shell div has a grey border that I want rounded corners on. The problem I'm running into is the title div has a green background and it's overlapping the rounded corners of the shell. It either overlaps or doesn't jut up against the edges to provide a fluid look. I'm looking for a solution that's backwards compatible with IE 7 and 8, but if

UIImage with transparent rounded corners

痴心易碎 提交于 2019-11-27 14:51:50
I'm using following code to add rounded corners to my UIImage, but the problem is that the rounded corners are showing "white" area instead of transparent or "clear". What am i doing wrong here: - (UIImage *)makeRoundCornerImageWithCornerWidth:(int)cornerWidth cornerHeight:(int)cornerHeight { UIImage * newImage = nil; if (self != nil) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int w = self.size.width; int h = self.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace,

How to draw rounded rectangle with variable width border inside of specific bounds

为君一笑 提交于 2019-11-27 14:37:04
问题 I have a method that draws a rounded rectangle with a border. The border can be any width, so the problem I'm having is the border is extending past the given bounds when it's thick because it's drawn from the center of a path. How would I include the width of the border so that it fits perfectly in the given bounds? Here's the code I'm using to draw the rounded rectangle. private void DrawRoundedRectangle(Graphics gfx, Rectangle Bounds, int CornerRadius, Pen DrawPen, Color FillColor) {

Draw round corners on top left top right bottom left bottom right using Path and RectF in Android

◇◆丶佛笑我妖孽 提交于 2019-11-27 13:21:28
问题 By making a custom ImageView and override the onDraw method with the following will make the ImageView to have rounded corners. Reference @Override protected void onDraw(Canvas canvas) { float radius = getContext().getResources().getDimension(R.dimen.round_corner_radius); Path path = new Path(); RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight()); path.addRoundRect(rect, radius, radius, Path.Direction.CW); canvas.clipPath(path); super.onDraw(canvas); } How can I selectively make

Rounded corners in a UITableView (iOS7)

假装没事ソ 提交于 2019-11-27 12:06:57
问题 In iOS7, how can I draw cell's rounded corners in a UITableView? See an example: 回答1: Your UITableview contains UIView , so just use this below lines of code for making it rounded corners. Also write this below line of code inside your tableview methods //If iOS version < 10 For Objective-C: cell.contentView.layer.cornerRadius = 5; cell.contentView.layer.masksToBounds = YES; For Swift: cell.contentView.layer.cornerRadius = 5 cell.contentView.layer.masksToBounds = true //If iOS version >= 10