paint

How to fill different color on same area of imageview (Color over another Color on same area of imageview)?

徘徊边缘 提交于 2019-12-06 06:46:55
I have one imageview and i set image for filling the different colors. But when i fill color then other color is not fill on same area on imageview which previous color is filled. I use color pallet button for getting different color for fill on imageview. Below is my code and image description. public class Play_Screen extends Activity implements OnTouchListener, OnClickListener { private Thread thread; private boolean running = false; // DrawImageView iv; // ImageView imageView; private Context context = this; private int paintAlpha = 255; // initial color private int paintColor; MediaPlayer

iOS- How to paint in the within limits

本小妞迷上赌 提交于 2019-12-06 06:38:13
问题 I used the scanning line seed filling algorithm to realize the color filling function. But I don't know how to do that. When my pen lands in the flower, I need to draw only Inside the black edge of the flower,do not draw in the hair. I have tried to use : CALayer *layer = [CALayer layer]; layer.contents = (__bridge id)(image.CGImage); self.drawView.layer.mask = layer; But the plan didn't work. if any one gives solution it would be so great,Thank you. (English is not my native language; please

Delphi/GDI+: When is a Device Context created/destroyed?

隐身守侯 提交于 2019-12-06 06:29:01
问题 Normally using GDI+ in Delphi you can use a TPaintBox , and paint during the OnPaint event: procedure TForm1.PaintBox1Paint(Sender: TObject); var g: TGPGraphics; begin g := TGPGraphics.Create(PaintBox1.Canvas.Handle); try g.DrawImage(FSomeImage, 0, 0); finally g.Free; end; end; The problem with this paradigm is that creating a destroying a Graphics object each time is wasteful and poorly performing. Additionally, there are a few constructs availabe in GDI+ you can only use when you have a

Java Swing JScrollPane line number glitch

僤鯓⒐⒋嵵緔 提交于 2019-12-06 05:25:06
I have a simple JEditorPane inside a JScrollPane that displays line numbers on the left side. It works great except when you move the window off screen and pull it back again, it looks the this when you stop dragging: any ideas? Should I need to be listening for a move/drag event and calling repaint/revalidate somewhere? Thought it might be something obvious, but here is some code. I am using the JSyntaxPane. public EditorPanel() { this.setLayout(new BorderLayout()); PythonSyntaxKit.initKit(); codeEditor = new JEditorPane(); JScrollPane scrPane = new JScrollPane(codeEditor); Dimension d = new

How to draw a Round rectangle in java with normal rectangle outline

匆匆过客 提交于 2019-12-06 05:12:15
问题 For my java application i need a Round rectangle with an outline that looks like a normal rectangle, like this I know you can do that by drawing a normal rectangle and a RoundRect inside it but i don't want to draw a RoundRect inside it because I want to draw something else in it. So a round rect with normal corners. How do I draw that in Java? The problem is that the rectangle looks like this if I use layers: The corners are filled up with the wrong color. How do I prevent that? 回答1: I can

How to calculate the percentage of erased area of a bitmap in android?

天大地大妈咪最大 提交于 2019-12-06 04:56:13
问题 I'm new to android. I'm doing an application which can erase the bitmap on canvas using finger. Something like finger paint eraser. I want to calculate the percentage of erased area (eg. 60% has been erased from complete image). Please help me to do this.. Thanks in advance.. I tried some method. It always give me 0%. Its not working. See the bottom of the code for that method.. Customized View public class MyView extends View { private final Paint mPaint; private Bitmap mBitmap; private

Qt drawRect in background

筅森魡賤 提交于 2019-12-06 04:13:19
问题 I want to paint the background of a slider. I tried this but the color covers up the whole slider. This is in an inherited class of QSlider void paintEvent(QPaintEvent *e) { QPainter painter(this); painter.begin(this); painter.setBrush(/*not important*/); // This covers up the control. How do I make it so the color is in // the background and the control is still visible? painter.drawRect(rect()); painter.end(); } 回答1: To set the background of a widget you could set the style sheet: theSlider

Canvas object is not displaying, but location is updating correctly in Java Applet

狂风中的少年 提交于 2019-12-06 03:22:20
My basic bouncing ball Applet should have a ball moving around according to the values in loc variable, but nothing shows up. Printing out loc shows that the numbers/math behind moving it around and bouncing off boundaries is indeed working as it should, but nothing shows up. Looking at examples online I didn't see why my drawing/painting code wasn't working as intended. Here's what I have, issues are probably focused about halfway down where the Ball object is. I posted most of the program as it does compile/run if someone will run it. import java.awt.*; import java.applet.*; import java.awt

Override JButton paintComponent() doesn't work java

 ̄綄美尐妖づ 提交于 2019-12-06 02:55:43
I wanted to paint my own version of JButton, so I have overridden the paintComponent() method, and drew a gradient roundRect. This works, but after that, I want to draw the String of the Button over it, and at compile-time, I got no error messages. But at runtime, I only see the roundRect, gradient, just as I intended it to be (I can click on it too), but the String is invisible... Here's my code: import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; public class JIconButton extends JButton implements MouseListener { private boolean mouseInside; public

Animate color of Paint object

无人久伴 提交于 2019-12-06 02:17:37
I am trying to animate a Paint object in my custom view between colors. But the animation is not working. ObjectAnimator colorFade = ObjectAnimator.ofObject(mCirclePaint, "color", new ArgbEvaluator(), getColor(), 0xff000000); colorFade.setDuration(1500); colorFade.start(); invalidate(); I have previously set the paints color like this: mCirclePaint.setColor(Color.RED); UPDATE I don't think the Handler makes a difference to whether it animated or not. Even without the Handler I cannot animate the paint object. This is the solution I found: ObjectAnimator colorFade = ObjectAnimator.ofObject