drawing

ios detecting line angle or degree

白昼怎懂夜的黑 提交于 2019-12-21 22:22:35
问题 I'm new to iOS , i am trying to develop a freehand drawing app, using uibezierPath .is there a way to calculate or receive the total line length, even if i drew straight line, curved or a circle. i am using addline on the the touchmove method, and i don't have any control points. 回答1: Inside your touchesBegan method, you can use this code { UITouch * touch = [touches anyObject]; CGPoint present = [touch locationInView:self]; CGPoint previous = [touch previousLocationInView:self]; CGFloat

.NET graphics Ghosting

拈花ヽ惹草 提交于 2019-12-21 21:30:01
问题 I'm making a sample GUI for a new application we are developing at work. The language has already been decided for me, but I am allowed to use any 3rd party DLLs or add-ins or whatever I need in order to make the GUI work as seamlessly as possible. They want it very mac/ubuntu/vista/Windows 7-like, so I've come up with some very interesting controls and pretty GUI features. One of which are some growing/shrinking buttons near the top of the screen that increase in size when you mouse over

Fast pixel drawing library

旧街凉风 提交于 2019-12-21 21:22:36
问题 My application produces an "animation" in a per-pixel manner, so i need to efficiently draw them. I've tried different strategies/libraries with unsatisfactory results especially at higher resolutions. Here's what I've tried: SDL : ok, but slow; OpenGL : inefficient pixel operations; xlib : better, but still too slow; svgalib , directfb , (other frame buffer implementations): they seem perfect but definitely too tricky to setup for the end user. (NOTE: I'm maybe wrong about these assertions,

How to Draw Box,Rectangle in a C# Console application

拜拜、爱过 提交于 2019-12-21 20:47:52
问题 I ask for 2 related questions. 1-How we can Put outputs(such as Results and Messages) inside a box in a c# console application. 2-How we can draw rectangle in a c# console application.thank u for any sample tutorial or advice 回答1: Assuming you just meant a character box this will do it. private static void DrawABox( int x, int y, int width, int height,char Edge,string Message ) { int LastIndex =0 ; Console.SetCursorPosition(x, y); for ( int h_i = 0; h_i <= height ; h_i++ ) { if ( LastIndex !=

How can I draw on a video while recording it in android, and save the video and the drawing?

心不动则不痛 提交于 2019-12-21 20:39:16
问题 I am trying to develop an app that allows me to draw on a video while recording it, and to then save both the recording and the video in one mp4 file for later use. Also, I want to use the camera2 library, especially that I need my app to run for devices higher than API 21, and I am always avoiding deprecated libraries. I tried many ways to do it, including FFmpeg in which I placed an overlay of the TextureView.getBitmap() (from the camera) and a bitmap taken from the canvas. It worked but

CoreGraphics: Using finger strokes to erase part of image?

巧了我就是萌 提交于 2019-12-21 20:37:58
问题 I'm working on drawing code to erase part of an image. I'm not an expert on CoreGraphics and could use some help. This routine works fine, however, when moving fast, it loses touches (Not very smooth). Can this routine be modified to make CGContextClearRect smoother? Is there a better, faster way to do this? -(void)drawRect:(CGRect)rect { if (!myDrawing) { // touchpoints stored here myDrawing = [[NSMutableArray alloc] initWithCapacity:0]; } UIGraphicsBeginImageContext(frontImage.frame.size);

How to make a chain of ggplots and draw arrows between them?

孤人 提交于 2019-12-21 20:37:46
问题 For a project I need to draw some plots and put arrows between them as and indication of a sequence. I was wondering if I could do that with ggplot. Is it possible to draw a clean, big arrow with ggplot2 and add it two the final multiplot? As an example I use this code to draw a plot: library(ggplot2) ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar() For the project I need to draw three plots like that. The result should be something like this: Does anyone have a solution? Many thanks in

Graphics.DrawImage alternatives for large images

冷暖自知 提交于 2019-12-21 20:33:05
问题 I am trying to draw a crosshair ("plus sign") with inverted colors over an image to show the location of a selected point within the image. This is how I do it: private static void DrawInvertedCrosshair(Graphics g, Image img, PointF location, float length, float width) { float halfLength = length / 2f; float halfWidth = width / 2f; Rectangle absHorizRect = Rectangle.Round(new RectangleF(location.X - halfLength, location.Y - halfWidth, length, width)); Rectangle absVertRect = Rectangle.Round

Making an image circular with white circular border

◇◆丶佛笑我妖孽 提交于 2019-12-21 07:36:37
问题 How to make an image circular and give it white circular border? Is it necessary to use two image views – one for the image and other for the white border? Is there any other way to do this? 回答1: Try this... public static Bitmap getCircularBitmapWithWhiteBorder(Bitmap bitmap, int borderWidth) { if (bitmap == null || bitmap.isRecycled()) { return null; } final int width = bitmap.getWidth() + borderWidth; final int height = bitmap.getHeight() + borderWidth; Bitmap canvasBitmap = Bitmap

(Delphi THintWindow) How to draw a transparent PNG?

爷,独闯天下 提交于 2019-12-21 06:39:33
问题 I have this delphi 2010 code: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Math, ExtCtrls, pngimage; type TMyHintWindow = class(THintWindow) private FBitmap : TBitmap; ThePNG : TPngImage; FRegion : THandle; procedure FreeRegion; protected procedure CreateParams(var Params : TCreateParams); override; procedure Paint; override; procedure Erase(var Message : TMessage); message WM_ERASEBKGND; public constructor Create