paint

Java Swing transparency drawing issues

…衆ロ難τιáo~ 提交于 2019-12-23 03:37:15
问题 Edit: I submitted a bug for the below (it may take a a few days to become approved though): http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7043319 Some more details: It works with Windows Sun JDK 1.6 versions 13 and 17 It fails on Ubuntu 11.04 x64 with both OpenJDK 1.6.0_22 and Sun JDK 1.6.0_24 What I want is to make a background image panel with additional panels on top of it (with additional components - e.g. JButtons, custom shapes, etc. - in them) and draw all that correctly. I'm

How to change the background color for a QTreeView Header (aka QHeaderView)?

大兔子大兔子 提交于 2019-12-23 02:51:14
问题 I am trying to change the background color for certain header sections. Some will use the default coloring, others will get a different color. The HeaderView doesn't accept delegates like the QTreeView does; it does all the painting itself. It does this using two methods -- paintEvent paintSection My initial attempt was to try and override paintSection, letting it paint the default stuff, and then adding my own. def paintSection(self, painter, rect, logicalindex): QHeaderView.paintSection

java applet paint method trouble

老子叫甜甜 提交于 2019-12-22 09:46:40
问题 In code I am calling repaint() method from init() method but Output is not as per I expect. I called repaint() method 10 times but It called paint() only once(See Screenshot of O/P). Am I making any mistake. please help me. Thanks code import java.awt.*; import java.applet.Applet; /* <applet code="test" height=300 width=300> </applet> */ public class test extends Applet { int x,y; public void init() { x=5; y=10; for(int i=1;i<10;i++) { System.out.println("From init "+i); x+=(i*2); y+=(i*3);

In CoreGraphics drawing how can I keep the point of overlap from being darker than the rest of the line?

拟墨画扇 提交于 2019-12-22 09:02:05
问题 My app uses core graphics for custom finger paint drawing. I allow the user to change the alpha of the line and a new line is continuously drawn on touches moved. When I make the alpha lower than 1.0 the point of overlap is darker than the rest of the line. I know why this occurs but how can I stop this? 回答1: I suppose you want a single stroke not to darken itself, but still to darken previous strokes (that's how most painting apps work). For this to work, you need two views/buffers, one for

changing the intensity of lighten/darken on bitmaps using PorterDuffXfermode in the Android Paint class

主宰稳场 提交于 2019-12-21 20:34:12
问题 Ok my orignal question has changed. How do i change the intensity of how something like this is effected? DayToNight.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); in my dream world it would have worked like this DayToNight.setXfermode(new PorterDuffXfermode(Mode.DST_IN(10))); the 10 being a level of intensity. An example would be if I had a flickering candle, when the candle burns bright I want the bitmaps I am drawing to the screen to retain their origanol color and brightness, when it

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

大兔子大兔子 提交于 2019-12-21 20:22:10
问题 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

Drawing rotated bitmap with anti alias

限于喜欢 提交于 2019-12-21 09:19:31
问题 I tried to paint a rotated bitmap with anti alias turned on, but it still has alias and it's not smooth, any help? I did as following: final Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setAntiAlias(true); canvas.rotate(-mValues[0]); canvas.drawBitmap(compass, -compass.getWidth()/2,-compass.getHeight()/2,p); 回答1: Paint.setAntiAlias() is for text. You want p.setFilterBitmap(true) ;. 回答2: In case you're rotating without a canvas (with createBitmap ), set filter to true . Example: private

Unity3D looking for setPixels example to paint with texture in C#

不打扰是莪最后的温柔 提交于 2019-12-21 06:57:14
问题 I need to find a way that allow me to paint a gameObject using a texture, the goal is to make a clone of this game I already thought that i can fake the painting feature by using depthMask solution which i explained here, however, after many hours of research it seems that setPixels,setPixel and setPixels32 can be used to create a real painting but For some reason all the setPixels related topics at the Script Reference are in JavaScript, i tried to port it to c# but i always got errors, plus

How to draw signature with lines on iPhone screen?

旧街凉风 提交于 2019-12-21 06:02:08
问题 I want to let user draw a signature on iPhone screen, so I add a subclass of UIView and add some code to its 'touchesMoved' method. -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; firstTouch = [touch locationInView:self]; CGSize mySize = CGSizeMake(5, 5); UIGraphicsBeginImageContext(mySize); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextBeginPath(ctx); CGContextSetRGBFillColor(ctx, 1, 0, 0, 1); CGContextAddRect(ctx,

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

社会主义新天地 提交于 2019-12-21 04:03:22
问题 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 Java's different AA hints is a lost cause because no sub-pixel method will work for all users. Is there any way to inherit system AA settings for a given graphics