Search Results

Search found 2702 results on 109 pages for 'drawing'.

Page 3/109 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to get the "real" colors when exporting a GDI drawing to bmp

    - by Rodrigo
    Hi guys I'm developing a ASP.Net web handler that returns images making a in-memory System.Windows.Forms.Control and then exports the rendered control as a bitmap compressed to PNG, using the method DrawToBitmap(). The classes are fully working by now, except for a problem with the color assignment. By example, this is a Gauge generated by the web handler. The colors assigned to the inner parts of the gauge are red (#FF0000), yellow (#FFFF00) and green (#00FF00) but I only get a dully version of each color (#CB100F for red, #CCB70D for yellow and #04D50D for green). The background is a bmp file containing the color gradient. The color loss happens whether the background is a gradient as the sample, a black canvas, a white canvas, a transparent canvas, even when there is not a background set. With black background With transparent background With a white background Without a background set With pixel format in Format32bppArgb I've tried multiple bitmap color deeps, output formats, compression level, etc. but none of them seems to work. Any ideas? This is a excerpt of the source code: Bitmap bmp = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); Image bgimage = (Image) HttpContext.GetGlobalResourceObject("GraphicResources", "GaugeBackgroundImage"); Canvas control_canvas = new Canvas(); .... //the routine that makes the gauge .... control_canvas.DrawToBitmap(bmp, new Rectangle(0, 0, w, h));

    Read the article

  • C# WinForm Drawing - how to clear and redraw

    - by StoneHeart
    Here is screen shot of my game. On the left is my problem, seem "old draw" still existing. On the right is what it should be. http://img682.imageshack.us/img682/1058/38995989.jpg drawing code Graphics g = e.Graphics; for (int i = 1; i < 27; i += 1) { for (int j = 0; j < 18; j += 1) { ZPoint zp = zpoints[i, j]; if (zp != null) { g.DrawImage(zp.sprite_index, new Point(zp.x, zp.y)); Image arrow; if (zp.sprite_index == spr_green_zpoint) { arrow = spr_green_arrows[zp.image_index]; } else if (zp.sprite_index == spr_red_zpoint) { arrow = spr_red_arrows[zp.image_index]; } else { arrow = spr_grey_arrows[zp.image_index]; } g.DrawImage(arrow, new Point(zp.x - 4, zp.y - 4)); } } } if (latest_p1 != -1 && latest_p2 != -1) { ZPoint zp = zpoints[latest_p1, latest_p2]; if (zp != null) { g.DrawImage(spr_focus, new Point(zp.x - 6, zp.y - 6)); } }

    Read the article

  • WPF drawing performance with large numbers of geometries

    - by MyFaJoArCo
    Hello, I have problems with WPF drawing performance. There are a lot of small EllipseGeometry objects (1024 ellipses, for example), which are added to three separate GeometryGroups with different foreground brushes. After, I render it all on simple Image control. Code: DrawingGroup tmpDrawing = new DrawingGroup(); GeometryGroup onGroup = new GeometryGroup(); GeometryGroup offGroup = new GeometryGroup(); GeometryGroup disabledGroup = new GeometryGroup(); for (int x = 0; x < DisplayWidth; ++x) { for (int y = 0; y < DisplayHeight; ++y) { if (States[x, y] == true) onGroup.Children.Add(new EllipseGeometry(new Rect((double)x * EDGE, (double)y * EDGE, EDGE, EDGE))); else if (States[x, y] == false) offGroup.Children.Add(new EllipseGeometry(new Rect((double)x * EDGE, (double)y * EDGE, EDGE, EDGE))); else disabledGroup.Children.Add(new EllipseGeometry(new Rect((double)x * EDGE, (double)y * EDGE, EDGE, EDGE))); } } tmpDrawing.Children.Add(new GeometryDrawing(OnBrush, null, onGroup)); tmpDrawing.Children.Add(new GeometryDrawing(OffBrush, null, offGroup)); tmpDrawing.Children.Add(new GeometryDrawing(DisabledBrush, null, disabledGroup)); DisplayImage.Source = new DrawingImage(tmpDrawing); It works fine, but takes too much time - 0.5s on Core 2 Quad, 2s on Pentium 4. I need <0.1s everywhere. All Ellipses, how you can see, are equal. Background of control, where is my DisplayImage, is solid (black, for example), so we can use this fact. I tried to use 1024 Ellipse elements instead of Image with EllipseGeometries, and it was working much faster (~0.5s), but not enough. How to speed up it? Regards, Oleg Eremeev P.S. Sorry for my English.

    Read the article

  • iphone quartz drawing 2 lines on top of each other causes worm effect

    - by Leonard
    I'm using Quartz-2D for iPhone to display a route on a map. The route is colored according to temperature. Because some streets are colored yellow, I am using a slightly thicker black line under the route line to create a border effect, so that yellow parts of the route are spottable on yellow streets. But, even if the black line is as thick as the route line, the whole route looks like a worm (very ugly). I tought this was because I was drawing lines from waypoint to waypoint, instead using the last waypoint as the next starting waypoint. That way if there is a couple of waypoints missing, the route will still have no cuts. What do I need to do to display both lines without a worm effect? -(void) drawRect:(CGRect) rect { CSRouteAnnotation* routeAnnotation = (CSRouteAnnotation*)self.routeView.annotation; // only draw our lines if we're not int he moddie of a transition and we // acutally have some points to draw. if(!self.hidden && nil != routeAnnotation.points && routeAnnotation.points.count > 0) { CGContextRef context = UIGraphicsGetCurrentContext(); Waypoint* fromWaypoint = [[Waypoint alloc] initWithDictionary:[routeAnnotation.points objectAtIndex:0]]; Waypoint* toWaypoint; for(int idx = 1; idx < routeAnnotation.points.count; idx++) { toWaypoint = [[Waypoint alloc] initWithDictionary:[routeAnnotation.points objectAtIndex:idx]]; CLLocation* fromLocation = [fromWaypoint getLocation]; CGPoint fromPoint = [self.routeView.mapView convertCoordinate:fromLocation.coordinate toPointToView:self]; CLLocation* toLocation = [toWaypoint getLocation]; CGPoint toPoint = [self.routeView.mapView convertCoordinate:toLocation.coordinate toPointToView:self]; routeAnnotation.lineColor = [fromWaypoint.weather getTemperatureColor]; CGContextBeginPath(context); CGContextSetLineWidth(context, 3.0); CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor); CGContextMoveToPoint(context, fromPoint.x, fromPoint.y); CGContextAddLineToPoint(context, toPoint.x, toPoint.y); CGContextStrokePath(context); CGContextClosePath(context); CGContextBeginPath(context); CGContextSetLineWidth(context, 3.0); CGContextSetStrokeColorWithColor(context, routeAnnotation.lineColor.CGColor); CGContextMoveToPoint(context, fromPoint.x, fromPoint.y); CGContextAddLineToPoint(context, toPoint.x, toPoint.y); CGContextStrokePath(context); CGContextClosePath(context); fromWaypoint = toWaypoint; } [fromWaypoint release]; [toWaypoint release]; } } Also, I get a <Error>: CGContextClosePath: no current point. error, which I think is bullshit. Please hint me! :)

    Read the article

  • Using Visual Studio 2010 Express to create a surface I can draw to

    - by Joel
    I'm coming from a Java background and trying to port a simple version of Conway's Game of Life that I wrote to C# in order to learn the language. In Java, I drew my output by inheriting from JComponent and overriding paint(). My new canvas class then had an instance of the simulation's backend which it could read/manipulate. I was then able to get the WYSIWYG GUI editor (Matisse, from NetBeans) to allow me to visually place the canvas. In C#, I've gathered that I need to override OnPaint() to draw things, which (as far as I know) requires me to inherit from something (I chose Panel). I can't figure out how to get the Windows forms editor to let me place my custom class. I'm also uncertain about where in the generated code I need to place my class. How can I do this, and is putting all my drawing code into a subclass really how I should be going about this? The lack of easy answers on Google suggests I'm missing something important here. If anyone wants to suggest a method for doing this in WPF as well, I'm curious to hear it. Thanks

    Read the article

  • Introduction to Shop Drawing Structures

    A shop drawing is a three dimensional drawing and it consisting of three detailed views like plans, elevations and sections. The shop drawing normally shows more detail than the construction document... [Author: Prahlad Parmar - Computers and Internet - April 06, 2010]

    Read the article

  • Drawing multiple objects from one Vertex Buffer Object in OpenGL/OpenTK

    - by stoney78us
    I am trying to experimenting drawing method using VBO in OpenGL. Many people normally use 1 vbo to store one object data array. I was trying to do something quite opposite which is storing multiple object data into 1 vbo then drawing it. There is story behind why i want to do this. I want to group many of objects as a single object sometime. However my code doesn't do the justice. Following is my pseudo code: //Data double[] vertices = {line strip 1, line strip 2, line strip 3}; //series of vertices int linestrip1offset = index of the first vertex in line strip 1; int linestrip2offset = index of the first vertex in line strip 2; int linestrip3offset = index of the first vertex in line strip 3; int linestrip1VertexNum = number of vertices in linestrip 1; int linestrip2VertexNum = number of vertices in linestrip 2; int linestrip3VertexNum = number of vertices in linestrip 3; //Setting Up void init() { int[] vBO = new int[1]; GL.GenBuffer(1, vBO); GL.BindBuffer(BufferTarget.ArrayBuffer, vBO[0]); GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(_vertices.Length * sizeof(double)), _vertices, BufferUsageHint.StaticDraw); GL.EnableClientState(Array.VertexArray); } //Drawing void draw() { GL.BindBuffer(BufferTarget.ArrayBuffer, vBO[0]); GL.EnableClientState(ArrayCap.VertexArray); GL.VertexPointer(3, VertexPointerType.Double, 0, linestrip1offset); //drawing first linestrip GL.DrawArrays(drawMode, linestrip1offset , linestrip1VertexNum ); GL.VertexPointer(3, VertexPointerType.Double, 0, linestrip2offset); //drawing second linestrip GL.DrawArrays(drawMode, linestrip2offset , linestrip2VertexNum ); GL.VertexPointer(3, VertexPointerType.Double, 0, linestrip3offset); //drawing third linestrip GL.DrawArrays(drawMode, linestrip3offset , linestrip3VertexNum ); GL.DisableClientState(ArrayCap.VertexArray); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); } I don't know what i did wrong but i think technically it should work where we can tell OpenGL which part of the data in the vBO to be drawn.

    Read the article

  • Flex: drawing a connector line between shapes

    - by artemb
    Hi! I am building a diagramming tool using Adobe Flex 3. I am about to implement connector lines and I have a question. Imagine I have 2 squares at random positions on the canvas. I need to draw an arrowed connector line between them. I need it to tend to the target square's center but end on its border. How do I find out the exact points between which to draw the line? Thank you

    Read the article

  • Drawing a FrameworkElement within another FrameworkElement

    - by Carlo
    Hello I have this code: public class VisualCue : FrameworkElement { public List<Indicator> Indicators { get; set; } public VisualCue() { this.Indicators = new List<Indicator>(); } protected override int VisualChildrenCount { get { return this.Indicators.Count; } } protected override Visual GetVisualChild(int index) { return this.Indicators[index]; } } public class Indicator : FrameworkElement { protected override void OnRender(DrawingContext context) { context.DrawEllipse(Brushes.Red, new Pen(Brushes.Black, 2), new Point(0, 0), 10, 10); base.OnRender(context); } } And in XAML: <local:VisualCue x:Name="visualCue"> <local:VisualCue.Indicators> <local:Indicator /> </local:VisualCue.Indicators> </local:VisualCue> But the indicator doesn't get drawn. What am I missing?

    Read the article

  • Drawing and Animating with UIView or CALayer?

    - by Markus
    hello, i am trying to implement a graph which a uiview draws. There are 3 UIViews to animate a left/right slide. The problem is, that i can't cancel the UIView animation. So I replaced the UIViews by CALayer. Now, the question is if CALayer is appicable for this? Is it normal to draw on a CALayer like this? And why is a CALayer so slow when I manipulate the frame properties. CGRect frame = curve.frame; frame.origin.x -= diffX; [curve setFrame:frame]; Is there a alternativ? P.S. I am a german guy. Sorry for mistakes.

    Read the article

  • Ellipse Drawing WPF Animation

    - by widmayer
    I am developing a control that is a rectangle area and will draw an ellipse in the rectangle area when a trigger occurs. This control will be able to host other controls like, textbox's, buttons, etc. so the circle will be drawn around them when triggered. I want the circle being drawn as an animation like you were circling the inner controls with a pen. My question is whats the best way to accomplish this. I've been doing some research and I could use WPF animation or I could use GDI+ to accomplish the tasks. I am new to WPF animation so that is why I am asking the question.

    Read the article

  • Circle drawing with SVG's arc path

    - by ????
    The following SVG path can draw 99.99% of a circle: (try it on http://jsfiddle.net/DFhUF/46/ and see if you see 4 arcs or only 2, but note that if it is IE, it is rendered in VML, not SVG, but have the similar issue) M 100 100 a 50 50 0 1 0 0.00001 0 But when it is 99.99999999% of a circle, then nothing will show at all? M 100 800 a 50 50 0 1 0 0.00000001 0 And that's the same with 100% of a circle (it is still an arc, isn't it, just a very complete arc) M 100 800 a 50 50 0 1 0 0 0 How can that be fixed? The reason is I use a function to draw a percentage of an arc, and if I need to "special case" a 99.9999% or 100% arc to use the circle function, that'd be kind of silly. Again, a test case on jsfiddle using RaphaelJS is at http://jsfiddle.net/DFhUF/46/ (and if it is VML on IE 8, even the second circle won't show... you have to change it to 0.01) Update: This is because I am rendering an arc for a score in our system, so 3.3 points get 1/3 of a circle. 0.5 gets half a circle, and 9.9 points get 99% of a circle. But what if there are scores that are 9.99 in our system? Do I have to check whether it is close to 99.999% of a circle, and use an arc function or a circle function accordingly? Then what about a score of 9.9987? Which one to use? It is ridiculous to need to know what kind of scores will map to a "too complete circle" and switch to a circle function, and when it is "a certain 99.9%" of a circle or a 9.9987 score, then use the arc function.

    Read the article

  • Java Swing NullPointerException when drawing

    - by juFo
    I'm using a custom JLayeredPane. I have several Shapes which needed to be drawn on different layers in the JLayeredPane. To test this I create a JPanel and ask its graphics. Then I draw a test rectangle on that JPanel (preparing the graphics) and in my paintComponent method from the JLayeredPane I finally draw everything. But this fails (NullPointerException). public class MyCustomPanel extends JLayeredPane { // test JPanel testpane; Graphics g2; // test // constructor public MyCustomPanel() { testpane = new JPanel(); this.add(testpane, new Integer(14)); g2 = testpane.getGraphics(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g2.drawRect(10, 10, 300, 300); } } // run: //Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException // at view.MyCustomPanel.paintComponent(MyCustomPanel.java:65) Why can't I draw on such a JPanel from within my JLayeredPane? I can draw directly on my JLayeredPane from within my paintComponent method but that's on the default Panel from the JLayeredPane. I need to create and draw on several layers which are added in my JLayeredPane. What am I doing wrong? :s

    Read the article

  • Java Swing - Drawing markers on JSlider.

    - by Tony Day
    Hi, I have a progress bar which inherits from JSlider to provide highlighting functionality. Highlights can be added to the slider at a point (and a Color) and these are then painted onto the control. As follows: The problem is that I cannot get the highlights in the right place, they need to be in the same location as the markers. I also do not know how to retrieve the left and right margins to where the markers start and end. Is there anyway to get the coordinates of each marker? Or perhaps a better way of performing this task? Many Thanks!

    Read the article

  • Drawing N-width lines?

    - by user146780
    Given a series of points, how could I calculate the vector for that line 5 pixels away? Ex: Given: \ \ \ How could I find the vector for \ \ \ \ \ \ The ones on the right. But bear in mind that it may not always be a nice straight line. I'm trying to figure out how programs like Flash can make thick outlines. Thanks

    Read the article

  • Drawing Mirrored Text

    - by Jeff
    I'm trying to draw mirrored (as in, it looks like you held it up to a mirror) text, and I want to do it the easiest way possible. It is possible to do a transform on a UILabel? Or do I have to use Quartz and do CGContextShowTextAtPoint() ?

    Read the article

  • Symmetric drawing of a Graph

    - by xxxxxxx
    is there any known algorithm(or package with the algorithm already implemented) to draw a graph in a way that it has symmetry ? for example most of these show symmetry. but putting the nodes evenly distributed on a circle isn't the best way to symmetry is exposed.

    Read the article

  • Drawing tree diagram in ASP.Net MVC

    - by Ivan Crojach Karacic
    I am creating an web application for my tae kwon do club. People are able to register online for a tournament. After the registration deadline the web application generates a dendrogram. Something like this: I am wondering now how to draw it. Because of the fact that there are my weight and age categories i have to draw them dynamicly for each group. What is the easiest way to draw this inside a MVC view?

    Read the article

  • Drawing on top of every windows on X11

    - by Vítor Baptista
    Hi, I am trying to make an arcade machine. The user will purchase credits, which will allow him to play for X minutes. I want to write "9:42 minutes left" at the left corner of the screen, even if he's playing a full screen game (UrbanTerror, for example). I would really like if I could do this with Ruby, but any other language is OK. Any ideas? Thanks in advance.

    Read the article

  • C#: Drawing only a portion of a path

    - by John
    I have a series of points in a GraphicsPath; for our purpose lets assume its the outline of an uppercase B. I want to be able to be able to draw only the bottom portion that would resemble an uppercase L. I'd like to be able to select a window of points from the GraphicsPath. Is there a handy way to do this without doing point interpolation?

    Read the article

  • Drawing outlines around organic shapes

    - by ThunderChunky_SF
    One thing that seems particularly easy to do in the Flash IDE but difficult to do with code is to outline an organic shape. In the IDE you can just use the inkbucket tool to draw a stroke around something. Using nothing but code it seems much trickier. One method I've seen is to add a glow filter to the shape in question and just mess with the strength. But what if i want to only show the outline? What I'd like to do is to collect all of the points that make up the edge of the shape and then just connect the dots. I've actually gotten so far as to collect all of the points with a quick and dirty edge detection script that I wrote. So now I have a Vector of all the points that makeup my shape. How do I connect them in the proper sequence so it actually looks like the original object? For anyone who is interested here is my edge detection script: // Create a new sprite which we'll use for our outline var sp:Sprite = new Sprite(); var radius:int = 50; sp.graphics.beginFill(0x00FF00, 1); sp.graphics.drawCircle(0, 0, radius); sp.graphics.endFill(); sp.x = stage.stageWidth / 2; sp.y = stage.stageHeight / 2; // Create a bitmap data object to draw our vector data var bmd:BitmapData = new BitmapData(sp.width, sp.height, true, 0); // Use a transform matrix to translate the drawn clip so that none of its // pixels reside in negative space. The draw method will only draw starting // at 0,0 var mat:Matrix = new Matrix(1, 0, 0, 1, radius, radius); bmd.draw(sp, mat); // Pass the bitmap data to an actual bitmap var bmp:Bitmap = new Bitmap(bmd); // Add the bitmap to the stage addChild(bmp); // Grab all of the pixel data from the bitmap data object var pixels:Vector.<uint> = bmd.getVector(bmd.rect); // Setup a vector to hold our stroke points var points:Vector.<Point> = new Vector.<Point>; // Loop through all of the pixels of the bitmap data object and // create a point instance for each pixel location that isn't // transparent. var l:int = pixels.length; for(var i:int = 0; i < l; ++i) { // Check to see if the pixel is transparent if(pixels[i] != 0) { var pt:Point; // Check to see if the pixel is on the first or last // row. We'll grab everything from these rows to close the outline if(i <= bmp.width || i >= (bmp.width * bmp.height) - bmp.width) { pt = new Point(); pt.x = int(i % bmp.width); pt.y = int(i / bmp.width); points.push(pt); continue; } // Check to see if the current pixel is on either extreme edge if(int(i % bmp.width) == 0 || int(i % bmp.width) == bmp.width - 1) { pt = new Point(); pt.x = int(i % bmp.width); pt.y = int(i / bmp.width); points.push(pt); continue; } // Check to see if the previous or next pixel are transparent, // if so save the current one. if(i > 0 && i < bmp.width * bmp.height) { if(pixels[i - 1] == 0 || pixels[i + 1] == 0) { pt = new Point(); pt.x = int(i % bmp.width); pt.y = int(i / bmp.width); points.push(pt); } } } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >