paint

Android Scratch card app

不想你离开。 提交于 2019-12-04 19:33:29
I am doing a small project for college and wondering if someone can tell me how I would go about doing a scratch card app. This app should have one image overlaying another. The one on top should allow the user to remove the image depending on where they rub on the image and thus part of the image that was removed revealing the image underneath. Pretty much like a scratch card. Any help would be great! This is the code im using at the moment . public class workinggraphics extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle

Paint foreign component (i.e. belonging to a different frame's content pane) in another component

与世无争的帅哥 提交于 2019-12-04 19:29:44
Hallo all. I want to paint a foreign component (i.e. belonging to a different frame's content pane), lets call it frame B, inside a component in frame A. The problem is that when I paint the component it is painted also in the content pane of the frame A, also it flickers or all gets ugly when the frame is re-sized (i.e. painted few times inside the component, some blue squares are appearing, etc.). The issue becomes more visible if I try to, for example, scale or translate the foreign component before painting. After a while I sorted it, I think. But I do not feel good with this solution, for

onDraw fill shape create with canvas.drawLine

十年热恋 提交于 2019-12-04 17:11:53
i draw 4 lines (canvas.drawLine) in order to draw a rectangle. Is there any possibility to fill the area of the rectangle? (I know that android have a rectDraw. Mine is only curiosity) thanks in advance. ok.. I ve also a path created a path segment. Following the code.. Please can u explain how fill the internal area? `Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStrokeWidth(2); paint.setColor(android.graphics.Color.RED); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); path.reset(); path.setFillType(Path.FillType.INVERSE_EVEN_ODD); path.moveTo(mPin[0].getX()

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

泪湿孤枕 提交于 2019-12-04 15:41:30
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 persistent Graphics object. The problem, of course, is when can i create that Graphics object? i need to

In Android Studio message “Paint.setShadowLayer.. graphics not accurate..” without this code

◇◆丶佛笑我妖孽 提交于 2019-12-04 15:13:59
问题 I get this message in android studio xml preview: "The graphics preview in the layout editor may not be accurate: -Paint.setShadow is not supported." Without having this line of code at all in my project. Also I tried to run "Edit-Find-Find in Path" and didn't find this line of code at all in all my project, so why do I get this message? I read this question, but don't think its the right answer cause this message start to appear after I tried few lines of code containing shadow values, but

DrawText on imageview

六眼飞鱼酱① 提交于 2019-12-04 14:27:30
问题 I tried to write the text in this way but it does not work and I do not understand where I'm wrong. mImageView.buildDrawingCache(); Bitmap bmap = mImageView.getDrawingCache(); Canvas c = new Canvas (bmap); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Style.FILL); paint.setTextSize(20); c.drawText("Some Text", 0, 25, paint); I tried several times but the display can not display any text. I have to make sure that this image is then saved with the written text. thanks 回答1

iOS- How to paint in the within limits

て烟熏妆下的殇ゞ 提交于 2019-12-04 12:55:12
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 excuse typing errors.) Use a two pass approach. Use the same algorithm as the fill algorithm to create

Example code for a minimal paint program (MS Paint style)

試著忘記壹切 提交于 2019-12-04 12:36:50
I want to write a paint program in the style of MS Paint. On a most basic level, I have to draw a dot on the screen whenever the user drags the mouse. def onMouseMove(): if mouse.button.down: draw circle at (mouse.position.x, mouse.position.y) Unfortunately, I'm having trouble with my GUI framework (see previous question ), I'm not getting mouse move messages frequently enough. I'm using the GUI framework wxWidgets and the programming language Haskell. Question: Could you give me some example code that implements such a minimal paint procedure? Preferably, your code should be use wxWidgets ,

Qt drawRect in background

走远了吗. 提交于 2019-12-04 10:12:45
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(); } To set the background of a widget you could set the style sheet: theSlider->setStyleSheet("QSlider { background-color: green; }"); The following will set the background of the widget

How to draw a path with variable stroke width

风格不统一 提交于 2019-12-04 08:44:07
问题 My code is basically from this example (http://corner.squareup.com/2010/07/smooth-signatures.html) and Google APIs (FingerPaint) but now I want to use the class VelocityTracker in order to change the stroke width depending on the speed of my finger. I thought I could split a path into smaller parts but I didn't find any examples. There's also this second post (http://corner.squareup.com/2012/07/smoother-signatures.html) but I do neither have a specific bezier curve class nor do I collect all