Questions tagged [quartz-2d]

6

votes
2

answer
38

Views

Does CGImage support 16 bits per channel?

bitsPerComponent says it's at most 8, but a couple of Stack Overflow questions imply 16 is supported.
Vaddadi Kartick
1

votes
1

answer
49

Views

CGContext draw rotated rectangles

I am trying to draw rectangles that are separated by equal angles. To do this, I first draw a CGPath and then apply a transform to context. I do it in succession 5 times. Here is my code and output. As you can see, output in screenshot is not correct, rectangles get skewed, not sure why. Need to kn...
Deepak Sharma
1

votes
1

answer
3k

Views

Quartz2D: How to draw an arc of a circle?

I would like to draw an arc of a circle like in this sketch: sketch http://i28.tinypic.com/35d229v.jpg The angle of the arc should be variable and it should be colored with a gradient (e.g. starting with red and going to green). How do you do this in Quartz2D? Thanks for your answers! Stefan
1

votes
2

answer
1.2k

Views

iPhone: Quartz2d vs. OpenGL ES

OK, I'm still brand new to iPhone development. I have a free game on the app store, Winner Pong, but it's just a Pong clone (who would've guessed) that uses the standard UIImageViews for the sprites. Now I want to do something a little more complicated, and port my game for the Xbox 360, Trippin Ali...
Ben
1

votes
1

answer
711

Views

iphone quartz draw border around line

what's the best way to draw a (black) border around a line in quartz for iphone? I'm drawing lines on streets on map and if the line is yellow (which is a legit use case), it blends in with the street color. One thing I could do is lay my lines over a little thicker black line, but this doesn't soun...
Lex
1

votes
2

answer
189

Views

Do I have a memory management problem in here?

Something must be wrong with this code right here: + (UIImage*)captureView:(UIView *)theView { UIGraphicsBeginImageContext(theView.frame.size); [theView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();...
1

votes
1

answer
392

Views

Simulating graphing paper on iPhone

I need to implement 'graphing paper' in an iPhone app. The user should be presented with a grid. They user can touch individual squares to turn them on, or if they're already on, off.The user can pinch to zoom and scroll around the paper as well.. So far I'm thinking Quartz 2D + UIScrollView is the...
Nicholas Gresham
1

votes
2

answer
533

Views

Quartz 2D Layers

I want to create 2 separate layers using quartz 2D. Can i handle there redraw methods separately? so that i can redraw 1 layer without redrawing the whole screen or other layers. Is it possible? any code sample?
coure2011
1

votes
1

answer
3.5k

Views

ipad pdf unreadable text

I'm using the Quartz 2d apis to display a pdf document in an iPad app I am currently working on, however the text shows up real funky and is unreadable. The text shows up fine on my laptop so its not an issue with the pdf document itself as far as I know. I'm not sure why the document is displayin...
marchinram
1

votes
1

answer
1.8k

Views

Draw over screen with Quartz

I'm trying to work out what the best way to draw over the top of all other items on the screen on OS X. I don't want to impede the user's ability to interact with their applications, but want to 'annotate' them. I want to be able to draw up to 20 different annotations. The top half of this screensho...
Who
1

votes
2

answer
175

Views

How can I easily change the overall opacity of a bitmap context using Quartz2D?

I'd like to create a fade out affect with one of my bitmap contexts that I use to draw a static image in one of my views. What's an easy way to adjust the overall opacity of the bitmap context on the fly before I render it to the view? Thanks so much in advance for your help! I'm going to continu...
BeachRunnerFred
1

votes
1

answer
641

Views

Quartz 2D Drawing String in Rect, how can I get an ellipsis?

[infoText drawInRect:CGRectMake(10, 10, 310, 40) withFont:infoTextFont lineBreakMode:UILineBreakModeWordWrap]; Any suggestions on how to produce an ellipsis when the text exceeds the size of the rect?
E-Madd
1

votes
1

answer
565

Views

Porting Quartz 2d python demo to pure Core Graphics C

let me first off noting that I have absolutely no idea what I'm doing with objective-c and mac development (though I'm fine with c). I made a wonderfully simple graphics utility on leopard with the Quartz-2d binding for python: http://developer.apple.com/graphicsimaging/pythonandquartz.html that ba...
Ralphleon
1

votes
1

answer
5.4k

Views

How to get a glow effect in Quartz for the iphone?

I am searching for a glow effect in quartz 2d for the iphone. I tried making lines with different alpha values to simulate glow but it didn't work... Can anyone help me with that ?? p.s. I'm making an app where the user can draw with glow. I have the basic lines, but no glow :(
DailyDoggy
1

votes
1

answer
1.1k

Views

Getting PDF document outline

I'm using Quartz 2D to render PDF on the iPad, this works fine. Now I need a way to get the document outline (table of content), I found the following function CGPDFDocumentGetCatalog which seems to be relevant, but the returned info is an opaque dictionary from which I don't know the keys. I want t...
Nicolas Goy
1

votes
1

answer
253

Views

Setting a CGPDFObjectRef to value

Does anyone have a way to change the information contained in a CGPDFObjectRef? Basically since CGPDFObject can represent any of the subtypes (CGPDFInteger, ie.) you would think you could set an existing CGPDFObjectRef that is type integer to an integer; however, I have played with this for quite so...
Jesse Naugher
1

votes
2

answer
1.7k

Views

Free hand drawing on the iphone/ipad

I am pretty new to graphics but I want to create an iphone/ipad app that does free hand drawing. That is as the finger moves, a path is painted. Where do I start (books, resources, etc)? The stuff I see on apple's docs talk about lines and arcs. These are simple. They talk about bezier curves briefl...
user482393
1

votes
1

answer
1.3k

Views

Quartz 2D: how apply UIImageView transformation to a CGImage?

i have an UIImageView that the user can rotate and resize touching the screen. I want apply the same changes the user has made on the UIImageView to the UIImage inside it. Then i will use the UIImage for masking another image. Please can you explain me what is the correct procedure for doing that? T...
Igon83
1

votes
1

answer
2.7k

Views

Clipping a CGGradient to a CGPath

I've been banging my head against the wall for a long while trying to figure out why this is not working. Basically, I am trying to plot a graph (chart) with CGPath and then use that to clip a gradient. The end effect should be like the Stocks app which comes with the iPhone. The gradient and the pa...
avance
1

votes
1

answer
2.9k

Views

UIGraphicsGetCurrentContext Problem

I have a problem drawing objects passing this graphic context CGContextRef context = UIGraphicsGetCurrentContext(); Here is the code I use to draw - (void) draw: (CGContextRef) gc { CGFloat black[4] = {0.0f, 0.0f, 0.0f, 1.0f}; // R G B + Alpha CGPoint p [2]; p[0].x = xStart ; p[0].y = yStart...
Michele
1

votes
4

answer
1.2k

Views

32 bit Grayscale Image with CGBitmapContextCreate always Black

I'm using the following code to display a 32 bit Grayscale image. Even if I explicitly set every pixel to be 4294967297 (which ought to be white), the end result is always black. What am I doing wrong here? The image is just 64x64 pixels. CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();...
saad
1

votes
1

answer
825

Views

function CGAffineTransformMakeRotation and CGAffineTransformMake can not work together using quartz-2d

It seems that function CGAffineTransformMakeRotation and CGAffineTransformMake can not work together. CGContextSetTextMatrix (context, CGAffineTransformMakeRotation (degreesToRadians(40))); CGContextSetTextMatrix(context, CGAffineTransformMake(1.0,0.0, 0.0, -1.0, 0.0, 0.0)); I got this CGContextSet...
1

votes
1

answer
1.6k

Views

How to draw a triangle with QUARTZ 2D?

I'm developing an iPhone app with 3.1.3 SDK. I'm trying to draw a triangle with transparent fill an 1px black stroke with this code: CGContextMoveToPoint(ctx, position.X, position.Y - (size.height / 2)); CGContextAddLineToPoint(ctx, position.X - (size.width / 2), position.Y + (size.height / 2)); CGC...
VansFannel
1

votes
1

answer
326

Views

iPhone: anti-aliasing after rotating

I've load an image into narrow UIImageView - the width is 3px, the height is approx. 10 Then I've rotate the view - and I've got not pleasant picture, with visual distortion (like http://upload.wikimedia.org/wikipedia/commons/f/fd/Anti-aliased-diamonds.png on the left part of picture). Is any way to...
QuickNick
1

votes
1

answer
450

Views

iPhone/ipad convert quartz2d line drawing to opengl

This is a completely rookie question but I'm looking for some beginners guidance with opengl. I've got an app that uses quartz 2d to draw static lines on a view. This has been working fine but we are hitting some performance issues on ipad 1 and we don't feel like we can optimize it any more to try...
Thomas
1

votes
1

answer
189

Views

Quartz 2D : draw on a view without subclassing it?

Can I get the context of a view with out subclassing it? Is that possible?
shannoga
1

votes
1

answer
297

Views

high resolution pdf causing crashing while navigating between pages

I am implementing a pdf reader.The way i am writing code is sufficient for many pdf's suddenly one single pdf came into picture with 300MB(total 1000 pages).The pdf is working fine up to 70 pages later it is killing my application i am checking in the divice(IPad1,V5.0) and simulator(V 5.0).In simul...
ajay
1

votes
1

answer
358

Views

iOS search and replace PDF string

Is it possible to search and replace a known string from a PDF with Objective-C/Quartz 2D? I've some nice formatted PDF with tabular data, created with Latex (and generated with pdflatex). Every pdf will have a placeholder string, something like XXXXXX that I would like to change programmatically. T...
microspino
1

votes
1

answer
229

Views

Displaying a CGContextRef

How can I draw a CGContextRef created with CGBitmapContextCreate() to a NSView? Should I convert it to a image first? If that's the case, wouldn't it be an expensive operation?
winck
1

votes
2

answer
732

Views

How to search for non-ASCII characters ( cyrillic) in PDF using QuartzPDF?

I've stumbled upon a searching cyrillic (as well as any other non-ASCII) characters in PDF using PDDScanner. The code I am using is similar to mentioned to SO code from Randon ideas blog. The problem is that for cyrilic PDFs the output of scanner is a complete garbage, which can't be decoded to anyt...
Adviser2010
1

votes
1

answer
566

Views

Using setNeedsDisplayInRect still erases the underlying content

I've subclassed a UIView and overridden the touchesBegan, touchesMoved, touchesEnded, and drawRect methods to create an app that allows the user to draw by touching the screen. I'm using the Quartz 2D library to do the drawings. In touchesBegan, touchesMoved, and touchesEnded, I keep track of the cu...
Vishay Nihalani
1

votes
1

answer
439

Views

iOS: Simple Physics for a UIView

I have a UIView that a user drags around via setting its center in the touchesMoved: method. When the user lets go, I want the UIView to fall off the screen according to how fast and what direction they were moving it in. Do I need to somehow create a vector by comparing the UIView's last center po...
Derek
1

votes
2

answer
475

Views

slow pattern drawing for a backgroundView

for my tableview I've done a custom background view which I call on viewDidLoad on each tableView on my project: - (void)viewDidLoad{ [super viewDidLoad]; //other unrelated sutff self.tableView.backgroundView=[[BlueStyleBackground alloc]init]; } It was my understanding that doing quartz2D stuff was...
Marcal
1

votes
2

answer
978

Views

undo redo issues with CGLayer

I am working with unod redo operations on CgLayer, I have tried some code, but not able to get it working, dont know , where I am getting wrong, below is my code, which i have written this is my drawRect function - (void)drawRect:(CGRect)rect { m_backgroundImage = [UIImage imageNamed:@'bridge.jp...
Ranjit
1

votes
1

answer
376

Views

CGContextAddEllipse - overlapping get's clipped - Quartz

I like to draw a glass with a few Elements - Top Ellipse - Bottom Ellipse - and the Lines Inbetween Next, it should be filled with a Gradient. The Elements work, but at the point, where the middle of the glass comes in touch with the top or bottom ellipse the area get's clipped. - (void)drawRect:(CG...
Thomas
1

votes
1

answer
463

Views

cropping UIImage

I have 4 points on an image (not perfectly a rectangle, just a 4 point polygon). For example: I want to extract the image bounded by the 4 points, resulting image: Using Quartz, I can only specify a rectangle to do this. However, i might not have a perfect rectangle all the time, so what's the best...
0xSina
1

votes
2

answer
1.1k

Views

Efficient way to draw a graph line by line in CALayer

I need to draw a line chart from values that come to me every half a seconds. I've come up with my custom CALayer for this graph which stores all the previous lines and every two seconds redraws all previous lines and adds one new line. I find this solution non-optimal because there's only need to d...
mgamer
1

votes
1

answer
111

Views

How to draw into a subview with Quartz2D

What I did earlier: Created a new project in XCode to test out Quartz2D. Created an UIView, overwrote drawRect and made some graphics with it. What I want to do: Integrate this UIView in a bigger project. The hierarchy is like this: View1Controller->View1->View2->View3 (A view in a view in a view)...
Close Call
1

votes
2

answer
320

Views

How does CGContextClipToMask work internally?

I am trying to replicate the behavior of CGContextClipToMask on iOS without any luck so far. Does anyone know how CGContextClipToMask works internally? I have read the documentation and it says it simply multiplies the image alpha value by the mask alpha value, so that is what I am doing in my custo...
jjxtra
1

votes
1

answer
300

Views

How is the in-call status bar impacting my CGAffineTransform'd view?

My app (target iOS 5+, uses ARC and storyboards, for the App Store) uses some rotation transforms. There's a bug where an in-call status bar (such as if there's an ongoing phone call or microphone recording) causes the views to mutate beyond what the transform describes. To diagnose the problem I wr...
Spencer Williams

View additional questions