Questions tagged [cgcontextref]
90 questions
2
votes
1 answer
Get Color Of Pixel At Point In Swift
I have found an example of Objective-C code that gets the color of a pixel at a point here:
How to get the pixel color on touch?
The specific section of code I need help with is where the context is created using CGColorSpaceCreateDeviceRGB:
---This…

Aggressor
- 13,323
- 24
- 103
- 182
2
votes
1 answer
How to get know that CGContext is drawing to screen
I want to get know that current CGContext is used for image, PDF or for screen drawing. In Cocoa I just use [[NSGraphicsContext currentContext] isDrawingToScreen] ([NSGraphicsContext currentContextDrawingToScreen] on 10.10). How can I get the same…

Volodymyr Dudchak
- 45
- 5
2
votes
1 answer
Generating image of first PDF page in iOS
I have an iPad system that holds a large number of PDF files. For each PDF file I generate an image of the first page (to support a visual index within the UI).
The code I use to generate the images has worked successfully for thousands of…

Journeyman
- 10,011
- 16
- 81
- 129
2
votes
2 answers
MapKit route over custom pin & callout
I have customized pins in my mapview with custom callout.
While drawing path on map, the route is coming over callout & pins. Image Attached.
I have used google API to get polylines and drawing it after decoding it.
Here is the code:
…

DAddict
- 207
- 1
- 2
- 5
2
votes
1 answer
Why I receive invalid context 0x0 error in document-based applications?
I use this code to draw some rects in a view.
This is the code:
CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
CGContextSetRGBFillColor (myContext, 1, 0, 0, 1);
CGContextFillRect (myContext, CGRectMake (0, 0, 200, 100…

Aug
- 595
- 9
- 22
2
votes
1 answer
Memory Leak in iOS with CGContextRef
I have a set of code that takes an image stored in a UIImageView and modify's its contents to copy into a new image for a different UIImageView. The problem is that this code always receives a memory warning from my compiler when I analyze the…

Andrew
- 63
- 1
- 7
2
votes
1 answer
CGContextRef as OpenGL Context
Normally, I would just use NSOpenGLContext, but in this case I have to have a CGContextRef as the OpenGL context in order to support some other frameworks I am using. My question is: can this be done?
I cannot afford to use glReadPixels() to fill…

Justin
- 2,122
- 3
- 27
- 47
2
votes
1 answer
iOS: Change contents of self (UIImage)
I have written some code in a UIImage category that takes a UIImage (self) and then redraws it using CGContextRef. Is there any way to rewrite the UIImage (self) while using CGBitmapContext? Currently, I have it returning the image that was created…

RileyE
- 10,874
- 13
- 63
- 106
1
vote
1 answer
iOS Application - Memory warning when drawing using cgcontextref
I am developing an application where I am drawing in drawRect method of a customClass.
I draw lines in the Graphics context of the View. When I redraw them again and again using setNeedsDisplay, I get memory warnings and my App immediately crashes.…

RK-
- 12,099
- 23
- 89
- 155
1
vote
0 answers
iOS-Drawing on an image with CGContextRef
I'm trying to draw on an image using CGContextRef with the following piece of code:
UIGraphicsBeginImageContextWithOptions(size, false, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
// After getting the context i pass it to a C++ backend…

Mo Abdul-Hameed
- 6,030
- 2
- 23
- 36
1
vote
1 answer
wide color on iPhone7
The Question is :
When working on iPhone7,
I get CGContextRef from UIView, then the bitsPerPixel is 64. Cause my .a can only work with traditional RGB colorspace bitmap buffer whose bitsPerPixel is 32,
Could someone know how to convert…

CoderHunter
- 19
- 2
1
vote
1 answer
How to correctly update a uiview magnified and translated with CGContextScaleCTM and CGContextTranslateCTM
I have a uiview B that is meant to be a magnified portion of another uiview A (the area around "touchPoint" is magnified).
When "touchPoint" changes I want B to update its display. I have the following function in B and it does update (when I call…

I'm stuck
- 23
- 5
1
vote
0 answers
iOS9 Heap Buffer Overflow Detected - CGContextSetFillColor
I've got a custom drawRect: function where I'm drawing to the context. At two different points I've been hitting "Heap buffer overflow detected". The two lines of code are:
CGContextSetFillColor(context,…

FishStix
- 4,994
- 9
- 38
- 53
1
vote
0 answers
iOS CGContextRef Draw Stroke Color and Border Text on UIImage
I'm trying to implement draw stroke text with color and border on UIImage but I can't get the solution.
I have used this THLabel for stroke and border of text and it works fine but only when I copy that code into draw image so at that time it's…

Nikunj Jadav
- 3,417
- 7
- 38
- 54
1
vote
1 answer
iOS 8 CGContextRef unsupported parameter combination
Anyone know how to update this code for iOS 8? I am getting this error message:
CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 32 bits/pixel; 3-component color space; kCGImageAlphaPremultipliedFirst; 4294967289…

mikomi
- 5
- 5