Questions tagged [cgbitmapcontext]
35 questions
1
vote
1 answer
Black and White graphics context
I'm working in Quartz/Core-graphics. I'm trying to create a black and white, 1b per pixel graphics context.
I currently have a CGImageRef with a grayscale image (which is really black and white). I want to draw it into a black and white…

Brian Postow
- 11,709
- 17
- 81
- 125
1
vote
1 answer
iOS sdk, render image from unsigned char array, CGBitmapContextCreate returns NULL
I have an unsigned char* data with the following values, as seen while debugging in xcode,…

EnGassa
- 2,927
- 1
- 14
- 16
1
vote
0 answers
Generating Wrong Image with CGBitmapContext
I have this code
private static UIImage Copy(UIImage self) {
var inImage = self.CGImage;
var width = inImage.Width;
var height = inImage.Height;
var bits = inImage.BitsPerComponent;
var bitsPerRow =…

Murilo Amaru Gomes
- 146
- 5
1
vote
0 answers
Different images for same ALAssetsLibrary asset?
I get an image from the ALAssetsLibrary using:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
The image in the info dictionary has a format of kCGImageAlphaNoneSkipLast and…

mahboudz
- 39,196
- 16
- 97
- 124
1
vote
1 answer
how to resize a bitmap on iOS
I want to resize a bitmap for a project that I am doing. I managed to do this by converting the cgbitmapcontextref to a pixel array and then manipulating the array of pixels and then generated a new image from the manipulated pixel data. This way is…

jiminybob99
- 857
- 1
- 8
- 15
1
vote
1 answer
Create CGImage From CGBitmapContext and Add to UIImageView
I am trying to create a snapshot of a UICollectionViewCell by creating a CGBitMapContext. I am not entirely clear on how to do this or how to use the associated classes, but after a bit of research, I have written the following method which is…

jac300
- 5,182
- 14
- 54
- 89
1
vote
1 answer
CGBitmapContextCreate memory release responsibility
This is how I create a UIImage. I allocated piOutData with calloc. Now when I call CGImageRelease at the end, will it automatically release piOutData or I need to do it manually via free.
int m_iH = iInMaxDim;
int m_iW = iInMaxDim;
UInt8*piOutData…

TorukMakto
- 2,066
- 2
- 24
- 38
0
votes
1 answer
Posterization effect when using CGContextDrawImage, float CGBitmapContext
To retrieve pixel values from CGImage I use CGContextDrawImage (like described here:
How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?). The only difference is that I create 128 bpp float components context, not usual 32…

Alexander B
- 407
- 2
- 17
0
votes
1 answer
Cocoa + Quartz Newbie: Getting the color of pixels in an NSImage & drawing offscreen
I'm attempting to create a custom color picker for my Cocoa (Mac, not iOS) application, and I'm having some trouble. I'm familiar enough with the various patterns of computer graphics and drawing, but I'm new to Cocoa, and I think the issue is…

Jake Z
- 105
- 7
0
votes
1 answer
CGBitmapContextCreate returns NULL for some pixels of width and height
I have the following code to create a new bitmap graphics context.
NSLog(@"newRect Width %f",newRect.size.width);
NSLog(@"newRect Height %f",newRect.size.height);
NSLog(@"imageRef %@",imageRef);
CGContextRef bitmap = CGBitmapContextCreate(NULL,
…

Nyein Ei Ei Tun
- 168
- 2
- 13
0
votes
1 answer
UIImage bad quality in iOS Xamarin
I have been using the code from here to add some text to my UIImage, however the quality on the image gets really bad. I have narrowed down the code a lot, to this:
public UIImage EditImage(UIImage myImage)
{
using (CGBitmapContext…

mathkid91
- 659
- 2
- 10
- 27
0
votes
2 answers
Bitmap context for wide color range
I am trying to create an image mask with kCGColorSpaceDisplayP3 colorspace to support the iPhone 7's wide color range.
I am able to create image mask correctly when using sRGB colorspace on iPhone 6 and earlier devices using iOS 10 and earlier iOS.…

maven25
- 231
- 2
- 12
0
votes
1 answer
Objective-C to Swift Conversion Issue on CGBitmapInfo
I have this Objective-C code that takes out the opaque background of a filter. I am trying to convert it to latest Swift and having errors all over the place.
-(UIImage*)removeColorFromImage:(UIImage*)sourceImage grayLevel:(int)grayLevel
{
int…

Gizmodo
- 3,151
- 7
- 45
- 92
0
votes
1 answer
App using MonoTouch Core Graphics mysteriously crashes
My app launches with a view controller and a simple view consisting of a button and a subview. When the user touches the button, the subview is populated with scrollviews that display the column headers, row headers, and cells of a spreadsheet. To…

Stephen Ashley
- 1
- 1
0
votes
1 answer
Losing NSTextEffectLetterpressStyle when drawing into CGBitmapContext
I am drawing text on top of a solid background color, and while it is appearing, the NSTextEffectLetterpressStyle effect applied to the attributed string isn't showing up - you can only see the text color not the additional white outline that…

Jordan H
- 52,571
- 37
- 201
- 351