painting

Need a little help with the Qt painting classes

I'm trying to write a paint program (paint where ever a mouse press/hold is detected), but I'm having trouble using the Qt QPainter. I have read the documentation on their web site and I'm still kind of lost. A link to a tutorial that isn't on their web site would be nice or maybe explain to me how I can accomplish this in Qt. The only t...

What Windows message is sent to repaint a partially occluded window?

I know that WM_PAINT tells a window that it needs to repaint itself entirely, but apparently that's not the message that gets sent when it's been covered partially and then the window that was in front of it is no longer in the way and it needs to repaint the dirty portion. Does anyone know what message is sent in this case? EDIT: Foun...

Delphi Form Painting Black Flash When Restoring

When I minimize and restore my Delphi application, the window contents flash a horrible black before (re)painting on Vista/Win7. This can also be seen with the Delphi 2007 IDE - the Object Inspector, Project Manager, Messages window (but not the editor contents) also flash black when restoring. None of the ususal flicker-free painting t...

How can I inherit the system's anti-alias setting for painting text to off-screen images like swing does?

When I run my swing GUI applications under Java 6, they automatically use my configured sub-pixel anti-alias settings for all fonts. The result is much improved over standard AA options. But when I paint to an image I can find no way to initialize the graphics context to use the system's AA configuration. Trying to play around with Ja...

Drawing pixels based on mouse position

Scenario: I have an area on the browser screen n x n in size (500px x 500px for example, ie 250,000 pixels). As the mouse rolls over the area, it "paints" the pixels it passes. Percentage of filled/unfilled pixels are displayed Optional advanced scenario: As the mouse rolls over already painted pixels will "unpaint" those pixels, or pa...

Paint all pixels (excluding transparant) in PNG with Javascript/CSS?

Hello, I need to create a silhouette of a PNG with Javascript/CSS. Is this possible? I tried the following: Stack the PNG with lowered opacity multiple times with absolute positioning and z-index. This does not work. Unfortunately I can't use PHP or something else then Javascript and CSS. I got some ideas with overlays and such but I...

Re-paint problem on translucent frame/panel/component.

I'm trying to create a translucent window with Java on OSX and add a JLabel to it. This JLabel changes its text every second.... However the component is not repainting well. How can I solve this problem? I've found the these articles, but I can't figure out how to solve it. If possible, please paste the fixing source code, he...

How can I achieve a smooth painted curve for a white board app?

I'm building a simple white board app in ActionScript 3. Most white board or painting apps in ActionScript tend to use an interval, timer, mouseMove event, or enterFrame event to track the mouse position and paint lines or brushes in between the tracked points. What I'm trying to achieve is the nice smooth painted line that a program l...

JCombobox's popup list is not painted completely

I have a JInternalFrame in a JDesktop, and I also have a JComboBox in the internal frame. The problem is shown below. How can I make JComboBox paint outside JInternalFrame, so that the popup list can be shown completely? Is using glass pane an optimal solution, or would it be bad practice? SOLUTION: I have found the solution; just...

Java optimizing painting a background image for a game

I'm working on recreating "Legend of Zelda a Link to the Past" as part of an assignment. And I've got the following problem, the game world is a BufferedImage of which I subImage() the part I need for the current location of the player. The game works but uses 80 / 110 percent of the CPU. A profile revealed that the culprit is the drawi...

Should I reuse Points and Rectangles or create new ones?

In a method that gets called frequently, like a painting event, is it more efficient to reuse Point and Rectangle Objects (for specifying locations and bounds), or should I create new ones. ...

Avoid painting over nested controls

I am writing a toolbar-style control and use the ThemeServices unit to paint the background required by the toolbar. Like so: ThemeServices.DrawElement(Canvas.Handle, ThemeServices.GetElementDetails(trRebarRoot), ARect); I then drop child controls onto the toolbar and voila - instant toolbar. Except that every now and again I notic...

WPF doesn't always repaint when using WindowsFormsHost

I have a simple application which is hosting a Managed DirectX Control using WindowsFormsHost. I've overridden the paint methods in the Control to prevent flicker: protected override void OnPaint(PaintEventArgs e) { if (this.Visible == true) { base.OnPaint(e); } } // Don't paint the background unless the control is not visible prot...

QT: QPainter + GDI in the same widget?

I'm trying to use the method described here to use a QPainter and GDI calls on the same widget. Unfortunately this tutorial seem to have been written on an earlier version of QT and now it does not work. I set the WA_PaintOnScreen flag and reimplement paintEngine() to return NULL. Then on the paintEvent() I create a QPainter, use it an...

Disable Painting of the VScrollbar in a System.Windows.Forms.RichTextBox

I have a custom control inherited from RichTextBox. This control has the ability to "disable" rich text editing. I achive this by just setting the Rtf property to the text property during the TextChanged event. this is how my code looks like: private bool lockTextChanged; void RichTextBox_TextChanged(object sender, Even...

BlackBerry - Convert EncodedImage to byte []

I am using below code where i don't want to use JPEGEncodedImage.encode because it increases the size. So I need to directly convert from EncodedImage to byte array. FileConnection fc= (FileConnection)Connector.open(name); is=fc.openInputStream(); byte[] ReimgData = IOUtilities.streamToBytes(is); EncodedImage encode_image = Enco...

Changing The Underlying Background Color Of A Swing Window

As discussed here, when resizing a Swing application in Vista (and Windows 7, which is what I'm using) you get a black background in the right/bottom corner while Swing's repaint catches up to the changes. Playing with other applications (Windows Explorer (Native), Firefox (C++?), and Eclipse (Java)) I notice that they all have this sam...

Java/Swing offscreen rendering (Cobra HTMLPanel -> BufferedImage) Problem: Component doesn't finish redrawing first

I'm trying to render the contents of a the Java/Swing Cobra HTML renderer to an offscreen BufferedImage, for use elsewhere in my app: slideViewPanel.setDocument(document, rendererContext); BufferedImage test = new BufferedImage(300,300,BufferedImage.TYPE_INT_RGB); Graphics g = test.getGraphics(); slideViewPanel.paint(g); The resul...

Paint java GUI component to image file

Let's say I have JButton test = new JButton("Test Button"); and I want to draw the button into an image object and save it to a file. I tried this: BufferedImage b = new BufferedImage(500, 500, BufferedImage.TYPE_INT_ARGB); test.paint(b.createGraphics()); File output = new File("C:\\screenie.png"); try { ImageIO.write(b, "png...

Measure the time required for an image to show on the screen?

Hey all, I would like to measure the time it takes for an image to appear on-screen in Java. I can override the paint() method and see how long that method takes to execute, but I am not sure if the image is on the screen at the end of that method. Basically, I want to fill these requirements: Time to show an image on-screen is cons...