graphics

How is transparency actually implemented ?

五迷三道 提交于 2020-01-04 23:06:46
问题 Given two images A,B I want a third image C which is as if B had transparency of t=0.5 and placed on top of A. How is C calculated in reality and how n affects it ? I am not interested in any program or pseudo code I just want to know the basic rationale. One way I think is C is nothing but alternating pixels of A and B. What are the other ways ? 回答1: The color and optionally transparency of each pixel of A and B is combined according to the weight. If the transparency is 0.75, then typically

Windows Forms graphics not being drawn

本小妞迷上赌 提交于 2020-01-04 19:07:10
问题 I have some code that looks pretty simple and should draw an ellipse, but it doesn't seem to appear. Here is my code: public partial class ThreeBodySim : Form { public ThreeBodySim() { InitializeComponent(); this.DoubleBuffered = true; Graphics graphics = displayPanel.CreateGraphics(); // Separate panel to display graphics Rectangle bbox1 = new Rectangle(30, 40, 50, 50); graphics.DrawEllipse(new Pen(Color.AliceBlue), bbox1); } } Am I missing something important? 回答1: Use the Paint() event to

“Beveled” Shapes in Quartz 2D

寵の児 提交于 2020-01-04 09:13:50
问题 I'm familiar with some of the basics of Quartz 2D drawing, like drawing basic shapes and gradients and so on, but I'm not sure how to draw a shape with a "beveled" look, like this: beveled circle http://www.shaggyfrog.com/junk/beveled-circle.jpg Essentially we've got a shine on one corner, and maybe some shading in the opposite corner. I think -- I didn't make this image, although I'd like to be able to approximate it. Any ideas? This is on the iPhone, and I'd like to use built-in frameworks

White Square in SFML, Sprite and texture stored in different objects

試著忘記壹切 提交于 2020-01-04 08:11:00
问题 I'm experiencing the white square problem in SFML. I'm working on a game that uses a tiled map. A Game class will load the tile set as a sf::Texture from a file and then a getTileById function in Game will "Cut" out the appropriate tile from the tileset texture. Eg. sf::Sprite GameScreen::getSpriteByPos(int pos, sf::Texture texture, int tileSize) { sf::IntRect subRect; subRect.left = (pos-1)*tileSize; subRect.top = (pos-1)*tileSize; subRect.width = tileSize; subRect.height = tileSize; sf:

Is it possible to resize a UIImage without losing quality?

半世苍凉 提交于 2020-01-04 06:04:09
问题 I have a UIImage that I put in a UIImageView which has a pinch gesture recognizer attached to it which I use to scale the image. When I scale the image in the UIImageView, there is no distortion and it scales perfectly. However, I need to resize the UIImage while not in the UIImageView, and when I do this using the following code, the result is slightly skewed: CGFloat width = self.imageView.frame.size.width; CGFloat height = self.imageView.frame.size.height; UIGraphicsBeginImageContext

How to read OS X *.icns file with Java

旧城冷巷雨未停 提交于 2020-01-04 05:22:14
问题 I want to read *.icns files in OS X into a BufferedImage. Help 回答1: Try this: http://code.google.com/p/appengine-awt/source/browse/trunk/apache-sanselan/src/main/java/org/apache/sanselan/formats/icns/IcnsDecoder.java?spec=svn8&r=8 Which is actually from: http://incubator.apache.org/sanselan/site/index.html 回答2: You need to convert ICNS to another image type first, and after load this image you can delete it. This is how to convert PNG to ICNS, so you just need to do in the opposite way:

When I minimize my application all of my drawings disappears

萝らか妹 提交于 2020-01-04 05:09:45
问题 I am building a C# app that shows the trajectory of a cannonball. But when I minimize it the trajectory I have drawn to a picture box are gone when I bring it back up. Is there an easy way to stop this? 回答1: I bet your drawing in the mouse event. Use the onpaint event and you should be good to go. Edit: Here is a decent drawing tutorial using the onpaint() event: http://www.geekpedia.com/tutorial50_Drawing-with-Csharp.html 回答2: When the window is restored it will need to redraw the form. If

How to add a neon glow effect to an widget border / shadow?

孤者浪人 提交于 2020-01-04 04:56:08
问题 Is there any way to create effects like these using flutter (a CustomPaint with a special shadder or something like this)? For example. I have this container and I drew some lines on it using a CustomPainter. Could I draw these lines using a neon effect just like the pictures? The Paint class has a shader property that I thought I could set up to achieve this goal, but I don't realize how. Container( color: Colors.white, width: 300, height: 300, child: CustomPaint( painter: NeonPainter(), ),

Asynchronous threads drawing in Bitmaps Delphi

孤者浪人 提交于 2020-01-04 04:41:04
问题 If many asynchronous threads draw in a global TBitmap, it will rise me an error? Should I create my code using a critical section? (From my surf on the internet I found that the TBitmap.Draw is not thread safe) Another question: If many synchronous threads draw in a global TBitmap and a VCL Timer read asynchronously the content from the TBitmap will this rise me an error? Thanks! 回答1: Since your threads are all modifying the same bitmap, you need to serialize all access to that bitmap. That

How to save a uiimageview on top of another uiimageview (swift3)

跟風遠走 提交于 2020-01-04 04:19:29
问题 Right Now I have two image views. All the button does is save the photo with the red box over the blue box and it will save image2 in the blue box and image1 in the red box. I would like red box to be saved over the blue box in just the small bottom right section of the blue box. Just like a lower third you see on tv ]] import UIKit class ViewController: UIViewController { var image1 = UIImage(named: "f.jpg") var image2 = UIImage(named: "l.jpg") override func viewDidLoad() { super.viewDidLoad