drawing

Confusing WPF draw behavior

I'm currently trying to persist a canvas to a bitmap, and I've run into some very peculiar behavior. The source code for the 3 following cases appears at the end of the post. Case 1: A red rectangle appears in the output file (test.png), as expected. Case 2: No red rectangle appears in the output file. Case 3: No red rectangle appear...

How to test proximity to the outline of a QGraphicsPathItem?

I'm trying to test whether a given point (x, y) is located on or close to the outline of a QGraphicsPathItem. Using QGraphicsItem.contains() or .collidesWithItem() / Path() will not do: those also return True if the point is contained within the area on the interior of the path, while I want to test only for points on the outline. How ...

Drawing a single guideline over several NPlots or alternative solution

I am using NPlot charting library to draw several plots illustrating signal fluctuations. The plots are inserted one beneath the other in a flowlayoutpanel1. The x axis is the time. The y is the value of the signal. I've added a trackbar at the bottom, along the x axis. When the user moves the trackbar, the value of each signal is dis...

Does Quartz for iPhone draw non visible portions of a view?

Hi folks, I am wondering which is the best way, in terms of speed and efficiency, to draw a frame around an image on iPhone, especially when I have to draw lots of these images: 1) Drawing the image and then the frame around or 2) Drawing a rect, filling it with a color and then drawing the image within that rect leaving some offset pi...

Multiple Clipped Rects to Create Collage in Core Graphics

I am creating a collage combined with elements from other images. Here is some ASCII art to explain what I am doing: Given images A, B and C, AAA, BBB, CCC AAA, BBB, CCC AAA, BBB, CCC I take part of A, part of B and part of C as columns: Axx, xBx, xxC Axx, xBx, xxC Axx, xBx, xxC ...and combine them in one image like this: ABC ABC A...

How to get the paint event for Buttons in QT

Hi.. i am new to QT, i tried lot searching samples of how to get the button paint event in QT.. i am not getting the way to do it.. how to set the delegates for pushbutton in QT?. how to get the paint event for pushbutton? i read so many articles, it says we can get the paint event of button we can customize too. but i didnt get the ...

C++ Really basic drawing/GUI

I'm searching for some examples on drawing basic shapes on the screen using only the Win32 API in C++ Do you need other libraries beside the standard Win32 API? Could you give me a very short example on how to, e.g.: draw a single line on the screen? Are there libaries that are easier to use for basic drawing than Win32? ...

WPF: How can I change the way InkCanvas draws?

I've searched for examples for this, but the ones I've ran across seem to focus on simpler stuff like setting the InkCanvas DefaultDrawingAttributes such as Width, Height, Color etc. Doesn't seem like there's a lot of material for this. For example, if I hold down the mouse button I can see it drawing lines. What if I want to draw ellip...

drawRect - reusing NSBezierPath

Hi All. I'm learning Cocoa Drawing techniques. I am creating two NSBezierPath objects from NSRects in my drawRect method, one which never changes, and one which changes width depending on something happening. So in all likelyhood, my drawRect gets called numerous times, but it seems wrong to recreate the two NSBezierPath objects each t...

Transfering set of points to Bezier curve

In my WPF application I'm working on a drawing mechanism to make annotations on top of images. For now I have functionality to draw paths where my drawn path will consist of the collected points from the drawing. More closely I'm adding StylusPoints to an InkPresenter as I collect them through the MouseMoved event. The InkPresenter is se...

Get Image Width/Height without using a Drawing.Image

I know it sounds weird. I have a photo gallery that saves image info(url, name, date modified...) from the hard disk into an in memory collection. The thing is i want to have the image width/height stored into that collection. I can get it for each file using the Drawing.Image class. But considering the gallery can get quite big, creati...

Fixing the size of a GTK Widget?

I am attempting to fix the size of a widget in GTK+, specifically using Gtk2hs with Haskell. I have drawn an image in a DrawingArea and I would like to specify the exact size of this drawing area. I do not want other widgets or the user to make this widget larger or smaller. Is this possible? Note, I am using ghc version 6.10.4 under U...

NSTextView rounded border / stroke in Cocoa

Hi All I am subclassing NSTextView and over-riding the drawRect method in order to draw an NSBezierPathWithRoundedRect around the textview, however - as it has rounded edges, they interfere with the text in the text view. Is there any way to apply some kind of margin or padding all around the text input area of the NSTextView so that i...

Drawing lines with clickable points using JavaScript

I'm interested in doing some drawing using JavaScript. I'll get straight to an example: The green horizontal line would be static, and all the vertical lines would be clickable. An example of a clicked line would be the red one. I've seen many API's, but they all allow more complexity than I need, making it more complicated than neces...

CATiledLayer drawing crash

in my application I use have the following views hierarchy: UIView ----UIScrollView --------TiledView (UIView subclass, uses CATiledLayer for drawing) ----OverlayView (UIView subclass) In short - TiledView displays large tiled image I also apply custom rotation to that view: tiledView.transform = CGAffineTransformMakeRotation(angle);...

How to draw an arc from radius and inner angle in Silverlight

Hi, In a silverlight 3 project I have to draw an arc programatically and I have radius of circle and inner angle of the arc. Could you please direct me to some related articles. Thanks in anticipation! Haris ...

How to draw paths specified in terms of straight and curved motion.

I have information on paths I would like to draw. The information consists of a sequence of straight sections and curves. For straight sections, I have only the length. For curves, I have the radius, direction and angle. Basically, I have a turtle that can move straight or move in a circular arc from the current position (after which mov...

Gtk buttons over a Gtk drawing area

Hi! i' working with Gtk developing some app. I must put some buttons over a map. I'm drawing the map on a GtkDrawingarea, but i'm not able to put buttons over it. Any suggestion? Thanks ...

determine how much space is left on a drawing application

I have a drawing application like http://www.flashperfection.com/tutorials/Mouse-Drawing-in-AS3-96618.html where the user can select a brush size to draw. I need a way to determine that all the surface has been drawn. Any code or ideas on how to accomplish that? ...

Delphi OpenGL Drawing

I'm setting up my window like this: glMatrixMode (GL_PROJECTION); glLoadIdentity (); glOrtho (0, form1.Width, form1.height, 0, 0, 1); glMatrixMode (GL_MODELVIEW); glDisable(GL_DEPTH_TEST); And my drawing routine looks like this: tempdist:=0.3 / distance(i,0,1,2); xunit:=1 div 90; zunit:=1 div 74; glBegin(GL_LINE_LOOP); case players[i...