graphicscontext

Internal graphics not initialized yet in JUunit test case

蹲街弑〆低调 提交于 2020-12-14 05:01:10
问题 I'm making a light weight painting application with JavaFx. I've been having some issues with my LayerController class and it's methods addLayer etc. So I thought that writing some JUunit test cases would be a good idea to check the correctness of my methods. To make the story short, I'm painting on a Canvas using its GraphicsContext in a selfmade class which I call PaintGraphics . This class does all the painting. The LayerController needs a PaintGraphics to do its work on the layers. But it

Creating a UIImage from a rotated UIImageView

强颜欢笑 提交于 2019-12-17 08:59:17
问题 I have a UIImageView with an image in it. I have rotated the image prior to display by setting the transform property of the UIImageView to CGAffineTransformMakeRotation(angle) where angle is the angle in radians. I want to be able to create another UIImage that corresponds to the rotated version that I can see in my view. I am almost there, by rotating the image context I get a rotated image: - (UIImage *) rotatedImageFromImageView: (UIImageView *) imageView { UIImage *rotatedImage; // Get

How do I capture UIImage of complete contents of UITableView / UIScrollView and make it work on an ios device

我与影子孤独终老i 提交于 2019-12-12 08:15:35
问题 I am using this wonderfully elegant piece of code Getting a screenshot of a UIScrollView, including offscreen parts to capture the entire contents of a UITableView to be exported to a UIImage. UIGraphicsBeginImageContextWithOptions(self.controller.tableView.contentSize, YES, 0); { CGPoint savedContentOffset = self.controller.tableView.contentOffset; CGRect savedFrame = self.controller.tableView.frame; self.controller.tableView.contentOffset = CGPointZero; self.controller.tableView.frame =

Set graphics context to display UIImage (Obj-C)

人走茶凉 提交于 2019-12-11 05:48:33
问题 I'm trying to render a UIImage in Objective-C (working on a simple iPhone app (breakout-type thing) to get used to the environment). However, I'm getting an "Error: CGContextDrawImage: invalid context" error when I try and draw it. My question is: how do I set the context that the DrawAtPoint method of UIImage uses? Here the relevant code for how I'm initializing / calling everything: @interface GameItem : NSObject { IBOutlet UIImage * sprite; CGPoint pos; } - (id) initWithPositionAndSprite:

How do I capture UIImage of complete contents of UITableView / UIScrollView and make it work on an ios device

强颜欢笑 提交于 2019-12-03 17:06:07
I am using this wonderfully elegant piece of code Getting a screenshot of a UIScrollView, including offscreen parts to capture the entire contents of a UITableView to be exported to a UIImage. UIGraphicsBeginImageContextWithOptions(self.controller.tableView.contentSize, YES, 0); { CGPoint savedContentOffset = self.controller.tableView.contentOffset; CGRect savedFrame = self.controller.tableView.frame; self.controller.tableView.contentOffset = CGPointZero; self.controller.tableView.frame = CGRectMake(0, 0, self.controller.tableView.contentSize.width, self.controller.tableView.contentSize.height

JavaFX: How can a Path be painted on a GraphicsContext?

混江龙づ霸主 提交于 2019-12-01 11:23:14
JavaFX provides both low-level path painting methods on a GraphicsContext and a high-level Path node. I want to store shapes in classes and draw them in a GraphicsContext . The Path class seems convenient for me. I know, it is meant to be used as a node in the scene graph, but it contains all drawing elements I need. I am looking for a method like GraphicsContext.fillPath(Path) but there is none. Do I have to iterate over the Path elements by hand and translate them into low-level GraphicsContext methods, or did I miss something? Do I have to iterate over the Path elements by hand and

JavaFX: How can a Path be painted on a GraphicsContext?

為{幸葍}努か 提交于 2019-12-01 08:40:47
问题 JavaFX provides both low-level path painting methods on a GraphicsContext and a high-level Path node. I want to store shapes in classes and draw them in a GraphicsContext . The Path class seems convenient for me. I know, it is meant to be used as a node in the scene graph, but it contains all drawing elements I need. I am looking for a method like GraphicsContext.fillPath(Path) but there is none. Do I have to iterate over the Path elements by hand and translate them into low-level

On iOS, after we create a layer from context and get the layer's context, how do these contexts relate to each other?

拟墨画扇 提交于 2019-11-29 15:48:17
We can create a layer from the current graphics context and then get the layer's context: CGContextRef context = UIGraphicsGetCurrentContext(); CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(self.frame.size.width, self.frame.size.height), NULL); CGContextRef contextOfLayer = CGLayerGetContext(layer); So we now have 2 contexts: context and contextOfLayer . How do these two contexts relate to each other? Is contextOfLayer actually part of context and context has a array of layer context pointers? If I print out their addresses using NSLog(@"%p", ...) , they have different

On iOS, after we create a layer from context and get the layer's context, how do these contexts relate to each other?

两盒软妹~` 提交于 2019-11-28 08:56:50
问题 We can create a layer from the current graphics context and then get the layer's context: CGContextRef context = UIGraphicsGetCurrentContext(); CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(self.frame.size.width, self.frame.size.height), NULL); CGContextRef contextOfLayer = CGLayerGetContext(layer); So we now have 2 contexts: context and contextOfLayer . How do these two contexts relate to each other? Is contextOfLayer actually part of context and context has a array of

Creating a UIImage from a rotated UIImageView

雨燕双飞 提交于 2019-11-27 07:08:19
I have a UIImageView with an image in it. I have rotated the image prior to display by setting the transform property of the UIImageView to CGAffineTransformMakeRotation(angle) where angle is the angle in radians. I want to be able to create another UIImage that corresponds to the rotated version that I can see in my view. I am almost there, by rotating the image context I get a rotated image: - (UIImage *) rotatedImageFromImageView: (UIImageView *) imageView { UIImage *rotatedImage; // Get image width, height of the bounding rectangle CGRect boundingRect = [self getBoundingRectAfterRotation: