drawing

drawRect - Draw Star

淺唱寂寞╮ 提交于 2019-12-13 16:24:42
问题 I am drawing annotations on a view. The approach i am using to draw star is below. -(void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGFloat xCenter = rect.size.width / 2; CGFloat yCenter = rect.size.height / 2; float width; if(rect.size.width > rect.size.height) { width = rect.size.height; } else { width = rect.size.width; } double r = width / 2.0; float flip = -1.0; double theta = 2.0 * M_PI * (2.0 / 5.0); // 144

draw an image to gtk.DrawingArea?

不想你离开。 提交于 2019-12-13 15:41:20
问题 I'm writing a PyGtk paint program based on the basic tutorial found here. Is there any way to add an image to the drawing area so that you can still draw over the image? Like a stamp, or an imported photo for example. I've tried adding a gtk.Image() but gtk.DrawingArea object has no attribute add . self.window = gtk.Window((gtk.WINDOW_TOPLEVEL)) self.window.set_title ("Canvas") self.window.set_position(gtk.WIN_POS_CENTER) hbox = gtk.HBox(False, 0) self.window.add(hbox) self.window.set

Alternative of blur effect on DrawingVisual

喜你入骨 提交于 2019-12-13 15:40:16
问题 I want to give a blur effect to my DrawingVisual . I can do this using BitmapEffect properties like: DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); var effect = new System.Windows.Media.Effects.BlurBitmapEffect(); effect.Radius = 10; drawingVisual.BitmapEffect = effect; But the compiler give me a warning that Bitmap effect properties is obsolete. What other alternative I can use to achive the effect on DrawingVisual ? 回答1: Effect

Drawing half-circles with CoreGraphics

风流意气都作罢 提交于 2019-12-13 15:30:40
问题 I know how to draw lines and shapes with CGPath s . But I couldn't figure out how to draw this symbol for a circuit diagram What code should I write to get that half circle shape? This is what I have so far: - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 5.0); CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor); CGContextMoveToPoint(context, 60, 80); CGContextAddLineToPoint(context, 120, 80);

Custom Drawing of Alpha Images

泪湿孤枕 提交于 2019-12-13 15:23:58
问题 I am trying to do custom drawing of an image(with alpha) and eventually going to apply different color tints to it. Right now I am just trying to draw it correctly. This might be simple problem but the result is the ALPHA on my image is black. Image is .png created from photoshop with correct alpha. - (void) drawRect:(CGRect)area { [imgView.image drawInRect: area blendMode:blendMode alpha:alpha]; // draw image } blendMode is normal and alpha is 1.0. The image is good except alpha being black.

How can I get rid of these 'spike' visual artifacts when drawing with WPF?

北战南征 提交于 2019-12-13 13:19:06
问题 I'm current drawing some tile (small square images) for a mapping app. I'm using WPF to draw shapes on to these tiles. I have a list of geospatial coordinates that make up polygons that are drawn. The geospatial coordinates that make up these polygons are converted in to pixel coordinates. The tiles are created at various set levels of detail. At most of these levels of detail the drawing is fine; but at certain levels a visual artifact appears in the form of a spike or a line. Here's an

Drawing curved lines to connect elements on web page

坚强是说给别人听的谎言 提交于 2019-12-13 12:32:02
问题 I have been tasked with turning this rough idea into a live page. While I have a basic structure established, I am wondering the best way to go about creating the curved lines that connect the months. Should I just create images and over lay them? Is there a way to draw them with some kind of scripting/coding? Canvas? I don't know the best way to do this. 回答1: I just put this together to show you that it is very possible and there are probably other ways to do it. #upper-line { border: solid

Drawing a circle segment [closed]

旧街凉风 提交于 2019-12-13 09:07:17
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I am wondering if anyone here can help me with some pseudocode or at least point me in the right direction on how to draw a circle segment without anti-aliasing. 回答1: The formula for points on a circle are: x = xcenter + radius * sin(theta) y = ycenter + radius * cos(theta) where

'System.ArgumentException' when trying to use SetPixel (x, y, Color)

家住魔仙堡 提交于 2019-12-13 08:29:03
问题 I am trying to create a white picture (greyscale format). So here is the code I use: Bitmap bmp = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format16bppGrayScale); bmp.SetPixel(0, 0, Color.FromArgb(255, 255, 255)); bmp = new Bitmap(bmp, i.Width, i.Height); "I" is an existing Bitmap image. I am playing with its channels. The principle is to create a 1 pixel image in greyscale, give this pixel the white color and then enlarge it to the good size. But I have this as a result: "An

I have a drawing pad, and want to overlay an image that is just an outline (so the image is transparent except for some black lines).

为君一笑 提交于 2019-12-13 08:08:50
问题 I have it so that you can draw under the image, but you must start drawing outside of the image border and move under the image. So you can't start right on the image. How do I fix this? My html is just: <canvas id="canvas"></canvas> <img id="html5" src="http://i.imgur.com/Wpx3Vum.png" style="position:absolute;left:100px;top:15px;" /> 回答1: You can use two canvas elements instead: Put two canvas elements on top of each other Draw the image you want to superimpose on the top canvas Add mouse