drawing

OnPaint method is being call for every child control.

I've a UserControl (WinForms, .net 2.0), and I've this: protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var rect = e.ClipRectangle; var pen = new Pen(Brushes.LightGray, 1); e.Graphics.DrawRectangle(pen, rect); } I basically want to draw a border on the UserControl, but the rectangle is being draw in all the ...

Designing chart drawing software

I am designing software that needs to draw several different kinds of charts--bar charts, pie charts, flow charts/graphs, charts over time. I am looking for resources related to both the programming side of the issue as well as the UI/display side. Books, online resources would all be helpful. Thanks. ...

Find most readable colour of text that is drawn on a coloured surface

I'm not sure how to ask this but here goes. I draw a filled coloured rectangle on screen. The colour is in form of R,G,B I then want to draw text on top of the rectangle, however the colour of the text has to be such that it provides the best contrast, meaning it's readable. Example: If I draw a black rectangle, the obvious colour f...

Java GraphViz

Is there an Open Source java alternative to GraphViz? I'm aware of the existence of Grappa which basically wraps the Graph interface to GraphViz as an JavaAPI. However the layouting is still done by the GraphViz binaries. I'm looking for a pure-java, open source library providing the same functions and layouting algorithms as GraphViz. ...

Copy one Bitmap onto a larger Bitmap using without using Graphics.DrawImage

This is a follow up from http://stackoverflow.com/questions/648975/rendering-to-a-single-bitmap-object-from-multiple-threads What im trying to achieve is to take a bitmap of say 50x50 pixels and draw it onto a larger bitmap(100x100 pixels) at any point on the larger image, using the bitmaps LockBits function or any other but NOT graphic...

What do you recommend for accepting in-browser user drawings?

I need to write an application that accepts very simple doodles by users, kind of like in tenthousandcents and thesheepmarket. For example, I might want users to write their name using their mouse. Any suggestions? I don't even need to host it myself. If there are services offered somewhere that I can just use that is fine. ...

How was "ten thousand cents" implemented?

How was ten thousand cents implemented? I am particularly interested in the implementation of the interface that accepted the drawings from the user? Are there libraries available that facilitate this? ...

Library for drawing musical notes

I'm looking for a Windows library that can draw musical notes on the screen in some way. I'm going to use it to write an app in C#, but a pure Win32-based solution is good enough. Does anybody know of any such library? Edit: I'm going to update the notes in real-time, and they need not look incredibly fancy. ...

How to retrieve coords (x,y,w,h) of a rendered canvas element?

How i can get coords of a rendered canvas element? I need them to apply clearRect, fillRect etc to its area. I get the canvas: //html <div><canvas id="canvas_id">some useless text..</canvas></div> //javascript var ctx = document.getElementById('canvas_id').getContext('2d'); Then? there is a way to get top left x, top left y, widt...

How to fill color on triangle

Hi everyone, I draw a triangle using line. How can I fill color on it? So far I can only success color the line but not fill the color. public void paintComponent(Graphics g){ super.paintComponents(g); int k=0; for (j=0 ; j < numOfLines; j++){ // the values of numOfLines retrieved from other method. g....

perl GD draw a shape

I am using GD library to draw an image. Image I am drawing is this http://i39.tinypic.com/apd1f7.png I am able to manage most of the image however, I do not know how to draw the red portion of the image. The red portion has a sideways triangle on both sides...how can I manage that using the GD lib? ...

How do you load a bitmap file into a BitmapData object?

In Flash, the BitmapData object can be used to store bitmaps in RAM, you can later draw them to a MovieClip using the beginBitmapFill() method. How do you load an external bitmap file (.jpg) into a BitmapData object? Even AS3 code would be helpful. Thanks. ...

Changing TextRenderingHint in a C# COM control causes all forms to stop using hinting

My application C# IDeskBand COM component. I'm drawing a custom control to a transparent Bitmap and then the IDeskBand control draws that Bitmap. ClearType doesn't render properly on a transparent background (logically), so I use g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; The problem is that after ...

CDC text drawing issue

I'm trying to draw text using CDC::ExtTextOut() to a device context (CDC), but I'm getting garbage outputs. The output text was drawn is weird fonts. The CDC pointer that got passed to me was originated from a unicode build ActiveX control (.ocx). The text drawing code resides in an ANSI build DLL. It seems like there're some kind of ...

Photoshop Undo System

The question probably applies to drawing systems in general. I was wondering how the undo functionality is implemented in PS. Does the program take snapshots of the canvas before each operation? If so, wouldn't this lead to huge memory requirements? I've looked into the Command pattern, but I can't quite see how this would be applied to ...

GDI+ Offscreen Buffered Scrolling

Hello, I am creating a custom control using C# GDI+. Quick explanation...the control will be say 500 pixels on screen but will contain perhaps 500000 pixels of information. So although i'm only showing 500px at a time i need to obviously scroll in the horizontal plane (left & right). The tricky part is that each 500px chunk of bitmap t...

WPF - Draw overlay on an image

I have an image that the user can zoom/scroll. I want to draw on a different layer some rectangles/circles (for example: drawing a circle for each person's face that was identified in the picture). The rectangle position is relative to the image. How do I create such an overlay? Thanks. ...

GDI+: Alternatives to DrawReversible for visual selection indicators?

I've searched around for an alternative way of drawing selection indicators for visual objects (like selected edges, lines etc.) without the use of ControlPaint.DrawReversibleFrame and related XOR methods. The reasons are unwanted XOR-ing "artifacts", reversibility not applying to bitmaps, no control of the actual visual look and slownes...

How can I clear the corners outside of a rounded rect using the iPhone SDK?

I am attempting to implement a custom view. This view should display an image surrounded by a gray, rounded rect border. I can get the image to display fine, as well as the border, however, since the border has rounded corners, I need a way to clear those corners such that they correctly display whatever is behind the view. How can I acc...

Vista glass border effect in Java Swing/AWT

I'm trying to create an overlay with a Vista Aero Glass -like background in place of a normal window. Part of my answer seems to be here, but I'm wondering how to get a blur effect in Swing/AWT. This looks like a start: public BufferedImage processImage(BufferedImage image) { float[] blurMatrix = { 1.0f / 9.0f, 1.0f / 9.0f, 1.0f / 9...