Questions tagged [paint]

The act of displaying a GUI component on a screen output device

Painting is the act of displaying a GUI component on a screen output device, and is responsible for visually representing the component object to the user. For example, displaying a Button object should paint a 'button' shape on the screen, with the text or icon that relates to the button.

2808 questions
26
votes
6 answers

How to get the pixel color on touch?

I know this is a common question and there are a lot of answers of this question. I've used some of this. Although many of them are the same. But the sad thing for me is that none of them worked for me. The following codes i've used till…
Erfan
  • 1,284
  • 1
  • 13
  • 21
24
votes
5 answers

Create window without titlebar, with resizable border and without bogus 6px white stripe

I want a window without title bar but with resizable frames and shadow. This can easily be achieved by removing WS_CAPTION and adding WS_THICKFRAME, however, since Windows 10, there's a 6px white non-client area. With the following code I create a…
Sergio Martins
  • 897
  • 2
  • 8
  • 18
23
votes
9 answers

how to convert rgb color to int in java

Paint.setColor is expecting an integer. But what I have is a Color object. I don't see a color.getIntValue() in Java? So how do I do that? What I want is something like public Something myMethod(Color rgb){ myPaint.setColor(rgb.getIntValue()); …
Cote Mounyo
  • 13,817
  • 23
  • 66
  • 87
23
votes
3 answers

paint() and repaint() in Java

I've spent maybe the last two hours browsing and reading up on these methods and the Graphics class, and maybe I'm stupid, haha, but I'm just not understanding them. What are they for? I understand that they're supposed redraw or update components…
Daniel
  • 581
  • 1
  • 5
  • 11
20
votes
2 answers

Make certain area of bitmap transparent on touch

My idea is to overlap 2 images on top of each other and upon onTouch, the top image should be made transparent on that touched radius, thus exposing the bottom image. This is how I overlay the 2 images: Bitmap bmOverlay =…
SteD
  • 13,909
  • 12
  • 65
  • 76
20
votes
6 answers

How to improve painting performance of DataGridView?

(sorry for bad English) I have a big problem with performance of DataGridView when it re-paints. I'm using a DataGridView to show logs from an external application stream. Messages from the stream come in with a high frequency (less than 1 ms). If I…
Yuriy
  • 2,670
  • 6
  • 33
  • 48
19
votes
5 answers

Undo for a paint program

I am looking into how to write a paint program that supports undo and seeing that, most likely, a command pattern is what I want. Something still escapes me, though, and I'm hoping someone can provide a simple answer or confirmation. Basically, if…
Joey
  • 7,537
  • 12
  • 52
  • 104
19
votes
2 answers

How to prevent Android's drawBitmap from only drawing black images?

As per the original question, The end result is a rounded-rect png in an ImageView with a natural looking drop shadow. I have the shadow working, but when it draws, it makes the entire image black. How can I prevent the original image (definitely…
coneybeare
  • 33,113
  • 21
  • 131
  • 183
19
votes
4 answers

Android: digital signature using Bezier

I am trying two draw digital signature using Bezier as show in above image.when i touch and try to draw line then the result is dot line but not getting continuous line. Simple signature done by using simple signature but I want to create more a…
kyogs
  • 6,766
  • 1
  • 34
  • 50
18
votes
3 answers

Efficient Line Smoothing and/or Simplification

I am creating a painting application in Actionscript (although my question is not Actionscript related). The basic idea is to start painting when the mouse is pressed and tracking the mouse movements. What I want to achieve is: reduce mouse "noise"…
justin
  • 302
  • 1
  • 3
  • 12
17
votes
4 answers

Android: measureText() Return Pixels Based on Scaled Pixels

So I use Paint's measureText() method to measure the width of a segment of text, but I wanted to measure text based on a certain text size. Say I wanted to get the width of a text segment that will be 20 scaled pixels when it occupies a certain…
Vinay
  • 6,204
  • 6
  • 38
  • 55
16
votes
4 answers

how to fill color in image in particular area?

I want to fill the color in white area for Paint based application so please give me suggestion for how to do this work..
Hardik Gajjar
  • 5,038
  • 8
  • 33
  • 51
16
votes
5 answers

Mixing two RGB color vectors to get resultant

I am trying to mix two source RGB vectors to create a third "resultant vector" that is an intuitive mix of the first two. Ideally, I would be able to emulate "real paint mixing characteristics", but for simplicity, I am trying to find a method…
yos
  • 223
  • 2
  • 3
  • 7
16
votes
1 answer

Can you increase line thickness when using Java Graphics for an applet? I don't believe that BasicStroke works

I am having trouble adjusting line thickness. Can I do that in Graphics or do i have to do it in Graphics2D? If so, how do I alter the program to make it run? Thanks! import java.applet.Applet; import java.awt.*; public class myAppletNumberOne…
user2465406
  • 169
  • 1
  • 1
  • 7
15
votes
4 answers

Canvas' drawLine and drawRect not including end position?

To my surprise I've just discovered that drawLine and drawRect don't include the ending position, i.e.: canvas.drawLine(100, 100, 100, 100, paint); or RectF rect = new RectF(100, 100, 100, 100); canvas.drawRect(rect, paint); won't draw…
javaxian
  • 1,815
  • 1
  • 21
  • 26