quartz-graphics

Where can I find examples of Quartz 2D drawing on the iPhone?

China☆狼群 提交于 2019-11-30 07:34:39
I am going to develope the 2D game in Iphone using Quartz. what is the main Difference between Quartz and QuartzCore? I have searched a lot over the internet, but only able to find out the MAC OS with Quartz Examples. If any body has any Link/URL for Examples of Quartz(2D) using Iphone Developement,which would be run in the Real Iphone Device? Also if possible than give the Link for Bunch of examples/repository for Quartz Iphone. Thanks, Mishal Shah There are a number of very nice Quartz2D and CoreAnimation animation examples in this project, from the 360iDev conference session on Core

Releasing renderInContext result within a loop

吃可爱长大的小学妹 提交于 2019-11-30 07:29:11
问题 I have a method which is called in a loop, that looks something like this: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; UIImageView *background = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, PAGE_WIDTH, PAGE_HEIGHT)]; background.image = backgroundImg; for (UIView *view in viewArray) { [background addSubview:view]; } UIGraphicsBeginImageContext(background.frame.size); [background.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image =

Quartz 2D drawRect method (iPhone)

做~自己de王妃 提交于 2019-11-30 06:14:50
问题 I've got 4 different iPhone/Cocoa/Core Animation/Objective-C books in front of me, along with numerous sample code from the web. Yet somehow I still feel like I'm missing some fundamental understanding of how drawing works in Quartz 2D . Is drawRect() meant to simply be a hook in which to execute your drawing code? Or is this method supposed to also redraw regions that are "damaged", and need repainting? Can I just draw my stuff once and then it "sticks", or must I repaint the whole scene at

water effect in cocos2d

吃可爱长大的小学妹 提交于 2019-11-30 04:06:39
I'd like to have a water effect on a background layer in my app. The effect doesn't need to react to touch or anything - it just needs to wave an image a little bit. CCWaves3D seem ok, but leave have nasty black artifacts around the edges when I run it. Similarly CCShaky3D. CCLiquid brings my app down from 20fps to 5fps.. Is there any other effect I might want to try out? Or perhaps I'm using the current effects in a wrong way? id shaky = [CCShaky3D actionWithRange:4 shakeZ:NO grid:ccg(15,10) duration:4]; id liquid = [CCLiquid actionWithSize:ccg(15,10) duration:1]; id wave = [CCWaves3D

Drawing shadow with Quartz is slow on iPhone & iPad. Another way?

一曲冷凌霜 提交于 2019-11-29 21:03:46
I was pretty excited when I found out just how easy it is to add shadows to my UIViews on the iPhone/iPad. Just add the framework in Xcode, add the import to the top of the file: #import <QuartzCore/QuartzCore.h> Then later: self.contentView.layer.shadowRadius = 3.0; self.contentView.layer.shadowOffset = CGSizeMake(-2.0, -3.0); self.contentView.layer.shadowOpacity = 0.5; self.contentView.layer.shadowColor = [UIColor blackColor].CGColor; While this does create a beautiful shadow in my app, it also lags it to death now when the view is shown... even when launched outside of the debugger. Is

Mac OS X: Can one process render to another process's window?

前提是你 提交于 2019-11-29 20:38:58
Greetings! I'm currently porting a web browser plugin from Win32 to MacOSX. One of the features of the plugin is that when the plugin is loaded, it spawns a separate process that serves as the "engine" of the plugin and executes drawing operations into the window of the plugin (specifically, by attaching an OpenGL context to the parent process's window and executing OpenGL rendering commands into that context). We do this because the plugin is typically loaded as a thread within the browser process, so crashes in the plugin would take down the whole browser. By partitioning the 'heavy lifting'

Creating mask with CGImageMaskCreate is all black (iphone)

此生再无相见时 提交于 2019-11-29 20:31:12
I'm trying to create an image mask that from a composite of two existing images. First I start with creating the composite which consists of a small image that is the masking image, and a larger image which is the same size as the background: UIImage * BaseTextureImage = [UIImage imageNamed:@"background.png"]; UIImage * MaskImage = [UIImage imageNamed:@"my_mask.jpg"]; UIImage * ShapesBase = [UIImage imageNamed:@"largerimage.jpg"]; UIImage * MaskImageFull; CGSize finalSize = CGSizeMake(480.0, 320.0); UIGraphicsBeginImageContext(finalSize); [ShapesBase drawInRect:CGRectMake(0, 0, 480, 320)];

Clear CATiledLayers Cache When Changing Images

旧巷老猫 提交于 2019-11-29 20:09:03
问题 I have a UIScrollView with a single subview, a UIView backed by a CATiledLayer. All is working well with one exception: when I change images from one to another the CATiledLayer caches the previous images zoom levels. Scrolling around then displays the old image for a split second before the updated image loads. Is there any way to totally clear out the CATiledLayer's cache so it doesn't show old images? The CATiledLayer obviously knows that the backing image changed because it asks it's

(Scale) Zoom into a UIView at a point

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 19:54:57
Something I don't understand about transformations. I want to zoom in to say the top right corner of a UIView (the main view). I use CGAffineTransformScale and have tried both setting the center/anchorPoint as well as CGAffineTransformMakeTranslation to no avail. I can't figure out how to set the translation properly so that it will zoom in on this point. CGAffineTransform tr = CGAffineTransformScale(self.view.transform, 2, 2); [UIView animateWithDuration:2.5 delay:0 options:0 animations:^{ self.view.transform = tr; self.view.center = CGPointMake(480,0); } completion:^(BOOL finished) {}]; mvds

How to get color components of a CGColor correctly

眉间皱痕 提交于 2019-11-29 19:30:27
问题 I have a UILabel with black color; i am writing the following code to get black color's components. UIColor *aColor = [aLabel.textColor retain]; const CGFloat* components = CGColorGetComponents(aColor.CGColor); CGColorSpaceRef colorSpace=CGColorSpaceCreateDeviceRGB(); but always this is giving Green color components instead of black color components; Is any one have idea about this? Am i passing different color space? :-( Please help me. 回答1: Most likely wrong colorspace. I guess the alpha