Questions tagged [graphicscontext]

64 questions
79
votes
6 answers

iOS: what's the fastest, most performant way to make a screenshot programmatically?

in my iPad app, I'd like to make a screenshot of a UIView taking a big part of the screen. Unfortunately, the subviews are pretty deeply nested, so it takes to long to make the screenshot and animate a page curling afterwards. Is there a faster way…
swalkner
  • 16,679
  • 31
  • 123
  • 210
18
votes
3 answers

iOS " current graphics context" - What is that

When I draw lines and shapes etc I get the " current graphics context" in iOS. What exactly though is " current graphics context" - I'm looking for the 30,000 foot description. Right now I just copy and paste UI code, not exactly sure what it's…
15
votes
1 answer

Creating a UIImage from a rotated UIImageView

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…
Magic Bullet Dave
  • 9,006
  • 10
  • 51
  • 81
8
votes
1 answer

JavaFX GraphicsContext change text size

I would like to be able to change the font size and possibly the font itself before the strokeText() method is called. I can change the color but I don't see anyway to change the font. Pane canvas = new Pane(); GraphicsContext gc =…
user1958884
  • 303
  • 3
  • 8
  • 14
6
votes
2 answers

Why isn't text anti-aliasing working, while using a SWT GC to draw text?

Right now my goal is to have anti-aliased text on my Labels. If my research was correct, SWT Labels do not natively support anti-aliasing on text, so my current workaround attempt is to create an image, turn text anti-aliasing on, draw my text to…
Dylan
  • 13,645
  • 3
  • 40
  • 67
4
votes
2 answers

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

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…
Andi
  • 3,234
  • 4
  • 32
  • 37
3
votes
2 answers

JavaFX GraphicsContext Inverted Circle

I've been trying to find a way to do this online, but I haven't been able to find anything. I want to draw an "inverse circle" with the JavaFX GraphicsContext. These images show what I want. Original: With "Inverted Circle" (What I want to…
MCMastery
  • 3,099
  • 2
  • 20
  • 43
3
votes
2 answers

Override path with transparent color in javafx Canvas/GraphicsContext

I'm wondering if there is any way in the GraphicsContext of a Canvas in JavaFX to override all pixels in a path in such a way that they become transparent again. Like the clearRect function but for any path. I have looked at the different BlendModes…
illfang
  • 65
  • 1
  • 4
3
votes
1 answer

Don't clear the context before drawing

I'm trying to find a way to draw lines on a view without redrawing all the context. Here is my drawing methods : -(void)drawInContext:(CGContextRef)context { for (int i = 0; i < self.drawings.count; ++i) { Drawing* drawing =…
Seb
  • 545
  • 9
  • 29
3
votes
1 answer

On iOS, Is there a way to get the size of an ImageContext after creating it using UIGraphicsBeginImageContextWithOptions?

If an image context is created using: UIGraphicsBeginImageContextWithOptions(CGSizeMake(768, 768), YES, 1.0); is there a way to get the size of the context later on? The size for sure is there when the image is obtained from the context, but while…
Jeremy L
  • 3,770
  • 6
  • 41
  • 62
3
votes
1 answer

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

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…
Ben Priebe
  • 365
  • 5
  • 11
3
votes
1 answer

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

We can create a layer from the current graphics context and then get the layer's context: CGContextRef context = UIGraphicsGetCurrentContext(); CGLayerRef layer = CGLayerCreateWithContext(context, …
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
2
votes
1 answer

How to clear an inclined rectangle in JavaFX Canvas efficiently?

Currently I have the following problem: I would like to draw a straight angled line in JavaFX Canvas like so (Recalling from memory so method names might not be accurate): Canvas canvas = new Canvas(500, 600); GraphicsContext gc =…
nick16384
  • 41
  • 5
2
votes
1 answer

JavaFx canvas filltext rendering quality

I am working on a JavaFx application which use canvas to represent a diagram. The canvas is painting text using graphicsContext.fillText(). In the image below the canvas is on the right, on the left is a Label using the same font. My question is…
DbSchema
  • 413
  • 5
  • 16
2
votes
1 answer

Internal graphics not initialized yet in JUunit test case

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…
Skarsh
  • 63
  • 1
  • 5
1
2 3 4 5