Search Results

Search found 469 results on 19 pages for 'quartz composer'.

Page 9/19 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Is there a way to initialize ImageKit's IKSaveOptions to default to TIFF with LZW compression?

    - by Rei
    I'm using Mac OS X 10.6 SDK ImageKit's IKSaveOptions to add the file format accessory to an NSSavePanel using: - (id)initWithImageProperties:(NSDictionary *)imageProperties imageUTType:(NSString *)imageUTType; and - (void)addSaveOptionsAccessoryViewToSavePanel:(NSSavePanel *)savePanel; I have tried creating an NSDictionary to specify Compression = 5, but I cannot seem to get the IKSaveOptions to show Format:TIFF, Compression:LZW when the NSSavePanel first appears. I've also tried saving the returned imageProperties dictionary and the userSelection dictionary, and then tried feeding that back in for the next time, but the NSSavePanel always defaults to Format:TIFF with Compression:None. Does anyone know how to customize the default format/compression that shows up in the accessory view? I would like to default the save options to TIFF/LZW and furthermore would like to restore the user's last file format choice for next time. I am able to control the file format using the imageUTType (e.g. kUTTypeJPEG, kUTTypePNG, kUTTypeTIFF, etc) but I am still unable to set the initial compression option for TIFF or JPEG formats. Thanks, -Rei

    Read the article

  • Blending Three Images into Graphics Context Using Alpha Blend Mode kBlendModeOverlay

    - by steganous
    Does kCGBlendModeOverlay not work exactly like Photoshop's Overlay blending mode? I'm trying to overlay three images into a graphic context via: [uiimageGreen drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0]; [uiimageRed drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0]; [uiimageBlue drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0]; In the end, if I overlay just two of the three, the result is much closer to my desired output color in places where both images intersect. Adding the third image, however, causes the first-drawn image's color to be dominant in the resulting mix of colors. (e.g. in the above code, green comes out dominant, when the result should actually be white) Do you get the same result if you try?

    Read the article

  • CGContextSetRBStrokeColor to replace, not add, for alpha?

    - by Peter Hajas
    I use CGContexts to allow the user to draw in my application, here's an example: CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); CGContextSetLineWidth(UIGraphicsGetCurrentContext(), size); CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(),r,g,b,a); I want the user to have an "eraser" tool that actually erases - it can't draw white (that would add white to the image, which may not have a white background) or alpha (or else the stroke won't do anything). Is there a way to do this? Perhaps replacing contents of a CGContext or UIImage?

    Read the article

  • How do I remove those rotation artefacts from my CATiledLayer?

    - by Felix
    Hello all, I have a CATiledLayer into which I render content in the following method - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx I used the QuartzDemo code to draw a pattern. This works very well until I apply a rotation transform to the layer's parentLayer (a UIView): rotated: These zigzag artefacts become worse when I start drawing lines and texts into the CATiledLayer. I applied the transform as follows (I also tried using an affine transform on the view itself): self.containerView.layer.transform = CATransform3DMakeRotation(angleRadians, 0.0f, 0.0f, 1.0f); I transform the containerView rather than the layer itself, as I have several layers in that view that I would like to rotate at the same time without changing the relative positions. I did not have problems when rotating UIImageViews in the past. Is there a way that I can rotate the CATiledLayer without these problems? Any help would be greatly appreciated. Yours, Felix

    Read the article

  • How do I set the current point in a CG graphics context?

    - by Joe
    When running the code below in the iphone simulator I get the error : CGContextClosePath: no current point. Why is the current point not being set? Or is the context not set to the correct state? CGContextBeginPath(ctx); CGMutablePathRef pathHolder; pathHolder = CGPathCreateMutable(); //move to point for the initial point NSLog(@"Drawing a state point %f, %f", [[holder.points objectAtIndex:0] floatValue], [[holder.points objectAtIndex:1] floatValue]); CGPathMoveToPoint(pathHolder, NULL, [[holder.points objectAtIndex:0] floatValue], [[holder.points objectAtIndex:1] floatValue]); for(int x = 2; x < [holder.points count] - 1; x += 2) { NSLog(@"Drawing a state point %f, %f", [[holder.points objectAtIndex:x] floatValue], [[holder.points objectAtIndex:(x+1)] floatValue]); CGPathAddLineToPoint(pathHolder, NULL, [[holder.points objectAtIndex:x] floatValue], [[holder.points objectAtIndex:(x+1)] floatValue]); } CGContextClosePath(ctx); CGContextFillPath(ctx);

    Read the article

  • Add shading to clipped UIView

    - by huggie
    I'm creating an iphone application. I have this UIView whose content is clipped with a path. I want to add shading and/or shadow to it. What's the best way to do this? For shadow, I tried CGContextSetShadow() but it doesn't seem to have an effect (perhaps it's drawing outside the shown region?) . How about shading? I want it to appear along the path. What's the best way to go about it? Is it to create another narrow clip strip along the original clipping path (if it's possible to have two clip path... ) Or does this need to be done in another CALayer? I am not even sure what that is yet.

    Read the article

  • Can't compile code when working with CALayer

    - by Sheehan Alam
    For some reason I get linker errors when I try and use CALayer: "_OBJC_CLASS_$_CALayer", referenced from: I have imported the following headers: #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> Code: arrowImage = [[CALayer alloc] init];

    Read the article

  • How can I call the iPhone to draw using other method?

    - by Tattat
    I have a view with a class called "drawingViewController", and I have the drawRect method: - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor); CGContextMoveToPoint(context, 0.0f, 0.0f); CGContextAddLineToPoint(context, 100.0f, 100.0f); CGContextStrokePath(context); } But I wanna to define some other drawing method, but it did't work, how can I do so apart from calling drawRect method? thz in advance.

    Read the article

  • Creating a mask from a graphics context

    - by Magic Bullet Dave
    I want to be able to create a greyscale image with no alpha from a png in the app bundle. This works, and I get an image created: // Create graphics context the size of the overlapping rectangle UIGraphicsBeginImageContext(rectangleOfOverlap.size); CGContextRef ctx = UIGraphicsGetCurrentContext(); // More stuff CGContextDrawImage(ctx, drawRect2, [UIImage imageNamed:@"Image 01.png"].CGImage); // Create the new UIImage from the context UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); However the resulting image is 32 bits per pixel and has an alpha channel, so when I use CGCreateImageWithMask it doesn't work. I've tried creating a bitmap context thus: CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGContextRef ctx =CGBitmapContextCreate(nil, rectangleOfOverlap.size.width, rectangleOfOverlap.size.height, 8, rectangleOfOverlap.size.width , colorSpace, kCGImageAlphaNone); UIGraphicsGetImageFromCurrentImageContext returns zero and the resulting image is not created. Am I doing something dumb here? Any help would be greatly appreciated. Regards Dave

    Read the article

  • Custom UILabel does not show text.

    - by Oscar
    Hi! I've made an custom UILabel class in which i draw a red line at the bottom of the frame. The red line is showing but i cant get the text to show. #import <UIKit/UIKit.h> @interface LetterLabel : UILabel { } @end #import "LetterLabel.h" @implementation LetterLabel - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 2.0); CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0); CGContextBeginPath(UIGraphicsGetCurrentContext()); CGContextMoveToPoint(UIGraphicsGetCurrentContext(), 0.0, self.frame.size.height); CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), self.frame.size.width, self.frame.size.height); CGContextStrokePath(UIGraphicsGetCurrentContext()); } - (void)dealloc { [super dealloc]; } @end #import <UIKit/UIKit.h> #import "Word.h" @interface WordView : UIView { Word *gameWord; } @property (nonatomic, retain) Word *gameWord; @end @implementation WordView @synthesize gameWord; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundColor = [UIColor whiteColor]; LetterLabel *label = [[LetterLabel alloc] initWithFrame:CGRectMake(0, 0, 20, 30)]; label.backgroundColor = [UIColor cyanColor]; label.textAlignment = UITextAlignmentCenter; label.textColor = [UIColor blackColor]; [label setText:@"t"]; [self addSubview:label]; } return self; } - (void)drawRect:(CGRect)rect { // Drawing code } - (void)dealloc { [gameWord release]; [super dealloc]; } @end

    Read the article

  • iPhone Dev:Blurring of CALayers when rotated

    - by user153231
    Hello All, I have a CALayer with a png image as its content.When rotation is applied the layer looks blurry. I've searched for a cause for this problem and found out that the problem might be the half pixel problem, which makes the layer blurry if its frame.origin lays on fractions like 96.5, and they suggest to make the origin a whole number. Now, my layer's origin contains fractions because of the rotation i make as in: tempLayer.anchorPoint = CGPointMake(0.5,0.5); tempLayer.position = CGPointMake(200,100); tempLayer.bounds = CGRectMake(0,0,70,88); tempLayer.transform = CATransform3DMakeRotation(10.f*M_PI/180.f, 0.f, 0.f, 1.f); tempLayer.contents = (id)myImage; Basically i have three questions: 1) Is there a better way to rotate the layer? 2) The frame values are derived from the anchorPoint, position, bounds and transform values, how can i round my frame values to integer values and keep my rotation intact? 3) Can the CGRectIntegral function help me? If yes how? Thank you all in advance.

    Read the article

  • How to draw a drop shadow AND gradient with quartz2d?

    - by Luke
    Hello! I've a custom shape drawing using coregraphics and i want to add a drop shadow and a gradient to it also. I've been trying and searching a lot of informations on how to combine and do this, but i can't get it to work. I'm able to draw only one either. Anyone doing this already or know how to do this? Thank you.

    Read the article

  • Tinting iPhone application screen red

    - by btschumy
    I'm trying to place a red tint on all the screens of my iPhone application. I've experimented on a bitmap and found I get the effect I want by compositing a dark red color onto the screen image using Multiply (kCGBlendModeMultiply). So the question is how to efficiently do this in real time on the iPhone? One dumb way might be to grab a bitmap of the current screen, composite into the bitmap and then write the composited bitmap back to the screen. This seems like it would almost certainly be too slow. In addition, I need some way of knowing when part of the screen has been redrawn so I can update the tinting. I can almost get the effect I want by putting a red, translucent, fullscreen UIView above everything. That tints everything red within further intervention on my part, but the effect is much "muddier" than results from the composite. So do any wizards out there know of some mechanism I can use to automatically composite the red over the app in similar fashion to what the translucent red UIView does?

    Read the article

  • Drawing path by Bezier curves

    - by OgreSwamp
    Hello. I have a task - draw smooth curve input: set of points (they added in realtime) current solution: I use each 4 points to draw qubic Bezier curve (1 - strart, 2 and 3rd - control points, 4- end). End point of each curve is start point for the next one. problem: at the curves connection I often have "fracture" (angle) Can you tell me, how to connect my points more smooth? Thanks!

    Read the article

  • CALayer and Off-Screen Rendering

    - by Luke Mcneice
    I have a Paging UIScrollView with a contentSize large enough to hold a number of small UIScrollViews for zooming, The viewForZoomingInScrollView is a viewController that holds a CALayer for drawing a PDF page onto. This allows me to navigate through a PDF much like the ibooks PDF reader. The code that draws the PDF (Tiled Layers) is located in: - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx; And simply adding a 'page' to the visible screen calls this method automatically. When I change page there is some delay before all the tiles are drawn, even though the object (page) has already been created. What i want to be able to do is render the next page before the user scrolls to it, thus preventing the visible tiling effect. However, i have found that if the layer is located offscreen adding it to the scrollview doesn't call the drawLayer. Any Ideas/common gotchas here? I have tried: [viewController.view.layer setNeedsLayout]; [viewController.view.layer setNeedsDisplay]; NB: The fact that this is replicating the ibooks functionally is irrelevant within the context of the full app.

    Read the article

  • CGContextShowTextAtPoint: invalid context

    - by coure06
    I want to call a method responsible for drawing text on screen after each 5 seconds. Here is my code -(void) handleTimer: (NSTimer *)timer { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, currentColor.CGColor); CGContextTranslateCTM(context, 145.0, 240.0); CGContextScaleCTM(context, 1.0, -1.0); CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetCharacterSpacing(context, 1); CGContextSetTextDrawingMode(context, kCGTextFillStroke); CGContextSetRGBStrokeColor(context, 0.5,0.5,1,1); CGContextShowTextAtPoint(context, 100, 100, "01", 2); } But after 5 seconds when this method is called i am getting this error CGContextShowTextAtPoint: invalid context Another thing is how to show a thinner font?

    Read the article

  • Why I can't draw in a loop? (Using UIView in iPhone)

    - by Tattat
    I can draw many things using this : NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"dummy2.png" ofType:nil]; UIImage *img = [UIImage imageWithContentsOfFile:imagePath]; image = CGImageRetain(img.CGImage); CGRect imageRect; double x = 0; double y = 0; for (int k=0; k<someValue; k++) { x += k; y += k; imageRect.origin = CGPointMake(x, y); imageRect.size = CGSizeMake(25, 25); CGContextDrawImage(UIGraphicsGetCurrentContext(), imageRect, image); } } CGImageRelease(img.CGImage); So, it works, so, I put it into a command object's execute method. Then, I want to do similar thing, but this time, my execute method only do this: NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"dummy2.png" ofType:nil]; UIImage *img = [UIImage imageWithContentsOfFile:imagePath]; image = CGImageRetain(img.CGImage); CGRect imageRect; double x = inComingX; double y = inComingY; imageRect.origin = CGPointMake(x, y); imageRect.size = CGSizeMake(25, 25); CGContextDrawImage(UIGraphicsGetCurrentContext(), imageRect, image); CGImageRelease(img.CGImage); This time, this is also a Command, and it is the execute method. But I take the for loop away. I will have another method that pass the inComingX , and inComingY into my Command object. My Drawing method is simply execute the Cmd that passed in my drawingEngine: -(void)drawInContext:(CGContextRef)context { [self.cmdToBeExecuted execute]; } I also have the assign method to assign the command,: -(void)assignCmd:(Command* )cmd{ self.cmdToBeExecuted = cmd; } And this is the way I called the drawingEngine for(int k=0; k<5; k++){ [self.drawingEngine assignCmd:[DrawingCmd setDrawingInformation:(10*k):0:@"dummy.png"]]; [self.drawingEngine setNeedsDisplay]; } It can draw, but the sad thing is it only draw the last one. Why? and how to fix it? I can draw all the things in my First code, but after I take the loop outside, and use the loop in last code, it just only draw the last one. Plz help

    Read the article

  • Rotate using a transform, then change frame origin, and view expands??

    - by ZaBlanc
    This is quite the iPhone quandry. I am working on a library, but have narrowed down my problem to very simple code. What this code does is create a 50x50 view, applies a rotation transform of a few degrees, then shifts the frame down a few times. The result is the 50x50 view is now much larger looking. Here's the code: // a simple 50x50 view UIView *redThing = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 50, 50)]; redThing.backgroundColor = [UIColor redColor]; [self.view addSubview:redThing]; // rotate a small amount (as long as it's not 90 or 180, etc.) redThing.transform = CGAffineTransformRotate(redThing.transform, 0.1234); // move the view down 2 pixels CGRect newFrame = CGRectMake(redThing.frame.origin.x, redThing.frame.origin.y + 2, redThing.frame.size.width, redThing.frame.size.height); redThing.frame = newFrame; // move the view down another 2 pixels newFrame = CGRectMake(redThing.frame.origin.x, redThing.frame.origin.y + 2, redThing.frame.size.width, redThing.frame.size.height); redThing.frame = newFrame; // move the view down another 2 pixels newFrame = CGRectMake(redThing.frame.origin.x, redThing.frame.origin.y + 2, redThing.frame.size.width, redThing.frame.size.height); redThing.frame = newFrame; // move the view down another 2 pixels newFrame = CGRectMake(redThing.frame.origin.x, redThing.frame.origin.y + 2, redThing.frame.size.width, redThing.frame.size.height); redThing.frame = newFrame; So, what the heck is going on? Now, if I move the view by applying a translation transform, it works just fine. But that's not what I want to do and this should work anyway. Any ideas?

    Read the article

  • CGGradient Not Displaying Correctly on iPad 1 and 2

    - by daveMac
    I have been experimenting with creating my own gradients for the UI in my iOS app. I first used a CAGradientLayer but I was disappointed with the "stepped" look so I have been trying out CGGradient. enter code here I am having an issue with the Gradient displaying correctly. I have three iPads—one for each generation. The gradient looks right on the iPad 3 but not on the iPad 1 or 2. This is really strange. I was going to take a screenshot and post the two differences but even more strange, the screenshot look the same (and yes, the brightness is the same on both). The colors seem really washed out on the older iPads. I know the iPad 3 is a retina display, but I think it must be something more than that. Here is the code I am using: - (void)drawRect:(CGRect)rect { CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGGradientRef skyGradient; CGColorSpaceRef rgbColorspace; size_t num_locations = 3; CGFloat locations[3] = { 0.0, .5, 1.0 }; CGFloat components[12] = { .106, .73, .93333, 1., 0.0, 0.0 , 1.0, 1., .106, .73, .93333, 1. }; rgbColorspace = CGColorSpaceCreateDeviceRGB(); skyGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations); CGRect currentBounds = self.bounds; CGPoint topLeft = CGPointMake(0.0f, 0.0f); CGPoint bottomRight = CGPointMake(CGRectGetMaxX(currentBounds), CGRectGetMaxY(currentBounds)); CGContextDrawLinearGradient(currentContext, skyGradient, topLeft, bottomRight, 0); CGGradientRelease(skyGradient); CGColorSpaceRelease(rgbColorspace); }

    Read the article

  • Spring 3: task namespace: How to find out time of next execution?

    - by Bernd Haug
    I have a bean that has a method executed on a schedule using <task:scheduled> in the context configuration. Is there a way for me to find the time of the next scheduled run during execution of that method? The same method is also executed manually, and the mechanism for receiving scheduler information may not break executions from outside the scheduler...

    Read the article

  • [CA_COLOR_OPAQUE] things that make a layer non-opaque. scaled CAGradientLayer?

    - by mahal tertin
    i spent some time with the environment variable CA_COLOR_OPAQUE = 1 and have my findings to share. things that make a CALayer non-opaque (slow, more memory, ...): * contents with alpha (like an NSImage with an icon) * NSImage/CGImage from a pdf as contents (even when the pdf does not contain any alpha and opaque=YES) * backgroundColor = nil * CATextLayer with text in a (because it is contents with alpha) * rounded corners? maybe/sometimes * masksToBounds? not necessarily as we scale most of tree with CATransform3DScale on sublayerTransform i found also these rather irritating non-opaque: * CAGradientLayer that is somewhere down in this scaled tree (even when set all the gradient colors without alpha) * edgeAntialiasingMask != 0 of a layer that is somewhere down in this scaled tree the last two do not make sense to me. why should it be non opaque? what do i see? if anyone has any thoughts on these findings, i'm happy to learn as i couldn't find such a list yet.

    Read the article

  • How can I draw a shadow beyond a UIView's bounds?

    - by Christian
    I'm using the method described at http://stackoverflow.com/questions/805872/how-do-i-draw-a-shadow-under-a-uiview to draw shadow behind a view's content. The shadow is clipped to the view's bounds, although I disabled "Clip Subviews" in Interface Builder for the view. Is it possible to draw a shadow around a view and not only in a view? I don't want to draw the shadow inside the view because the view would receive touch events for the shadow area, which really belongs to the background.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >