drawing

Extract colour gradient pixel information

心已入冬 提交于 2019-12-25 03:32:58
问题 I am attempting to control a 240 long line of RGB pixels (ws2812b) using an artnet to dmx controller and need to generate colour gradients down the length of the line of pixels. I had the idea of using the C# built in graphics libraries to generate the colour gradients and then extract the individual pixel values and send these to the dmx controller. Is it possible to extract individual interpolated values from a LinearGradientBrush or a LinearGradientBrush applied to a shape (line/rectangle

Bitmap from Drawing not render outside of Load_Form

我们两清 提交于 2019-12-25 02:57:14
问题 I'm trying to render bitmap created from drawing to screen but only render after minimize and maximize again. I follow these steps: Using Bitmaps for Persistent Graphics in C# But only can render bitmap in screen outside of Load_Form. If I put the code: using System.Drawing; ... Graphics graphicsObj; myBitmap = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height, Imaging.PixelFormat.Format24bppRgb); graphicsObj = Graphics.FromImage(myBitmap); Pen myPen = new Pen(Color.Plum, 3);

Read regiondata as rectangles

拈花ヽ惹草 提交于 2019-12-25 02:28:47
问题 I have a Region, from which I am subtracting n number of Rectangles, now I need to get all the remaining space in terms of rectangles. Is there a way of doing it? Thanks 回答1: First you should realize that any set of rectangles you get may be an approximation if the region contains any curves. Second, try calling GetRegionScans with an indentity matrix. RectangleF[] rects = region.GetRegionScans(new Matrix()); 来源: https://stackoverflow.com/questions/16882292/read-regiondata-as-rectangles

How to rotate a RectangleShape in VB.net?

孤者浪人 提交于 2019-12-25 02:25:14
问题 Is it possible to rotate a rectangle shape in VB.net? Code to my rectangle shape is this baseDice.Parent = shapeContainer baseDice.CornerRadius = 5 baseDice.Height = 50 baseDice.Width = 50 baseDice.BackColor = Color.Blue baseDice.BackStyle = BackStyle.Opaque baseDice.Left = 50 baseDice.Top = 50 baseDice.Name = "baseDice" baseDice is an object of Microsoft.VisualBasic.PowerPacks.RecntangleShape 回答1: Use the VB Class Matrix, here's an example Dim myPen As New Pen(Color.Blue, 1) Dim myPen2 As

How to highlight a given color in C#

感情迁移 提交于 2019-12-25 02:22:26
问题 How could I highlight a given color in C#. The user selects an arbitrary color for the objects I'm displaying. When I select the objects I would like to highlight them. Do you know what is the best way to do this? I need something like this: private Color HighLight(Color c) { //calculate a highlight color from c return highlighted; } Thanks in advance 回答1: You need to convert your RGB color to HSL (follow this post). Then increase L value (lightness) and convert back to RGB. Changing R, G, B

JButton is drawing behind an image

拈花ヽ惹草 提交于 2019-12-25 02:19:27
问题 I am making a starting screen, and it's working out pretty fine, got a background image when it starts, now I am trying to draw a JButton on the startmenu, which is a JFrame. But when I run my program, the button appears behind the background picture. If I hover above the area where the button is placed, it's flickering, and when I click it that happens too. Is there any way to draw the Button INFRONT of the background? I made the button as last in the code. My code to draw the background and

Drawing lines between 2 elements onclick

主宰稳场 提交于 2019-12-25 02:00:42
问题 is there a way (i guess its always) to draw a line between 2 elements? A div and an img tags wwith different ids. Heres is some html <div id="textHolder"> <div class="text" id="text0"><p>masă</p></div> </div> <div id="objectHolder"> <img class="obiecte" id="obj0" src="images/Macara.svg"> </div> Ok,so i need to draw a line between the div inside of another div with id="textHolder" and an image inside a div with id="objectHolder".First clicking on the div inside of textHolder then drawing the

Draw Cosx with specific period width

天大地大妈咪最大 提交于 2019-12-25 01:14:57
问题 how can i draw a period of Cosx with width =100 and height 50? my recent code is very hard to control them :( // this to find y with each x to draw Cos for (int i = 0, j = 0; i < 50; i += 1, j++) { int y = (int)((Math.Cos((double)i * height/10F * Math.PI / cy) + 1.0) * (cx - 1) / widtd/10F); poi.SetValue(new Point(i, y),j); // poi is an aray of point } 回答1: Based on OP's last comment I assume "width" means a single period. Therefore to calculate the points of a cosine function with amplitude

overlapping partially transparent shapes in openGL

扶醉桌前 提交于 2019-12-25 01:14:47
问题 Please check this neat piece of code I found: glEnable(GL_LINE_SMOOTH); glColor4ub(0, 0, 0, 150); mmDrawCircle( ccp(100, 100), 20, 0, 50, NO); glLineWidth(40); ccDrawLine(ccp(100, 100), ccp(100 + 100, 100)); mmDrawCircle( ccp(100+100, 100), 20, 0, 50, NO); where mmDrawCircle and ccDrawLine just draws these shapes [FILLED] somehow... (ccp means a point with the given x, y coordinates respectively). My problem .... Yes, you guessed it, The line overlaps with the circle, and both are translucent

AS3 photoshop brushes

。_饼干妹妹 提交于 2019-12-24 22:57:38
问题 I'm searching for a way to build a photoshop like drawing tool in ActionScript 3. Especially I want to build something like the brushes in photoshop. So that you can use different PNG's as a brush. I tried it with saving a brush in photoshop as a transparent png, import it into my AS3 project and with a mouse move event, draw the png everytime you move the mouse into a bitmapdata object. But that doesn't look like photoshop. Here's a example, first the photoshop drawing, then the as3 drawing: