• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem with paths and images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with paths and images


  • Subject: Problem with paths and images
  • From: Livio Isaia <email@hidden>
  • Date: Tue, 19 Dec 2006 16:59:26 +0100

The problem is that I draw (NSBezierPath stroke method) a black rect path in an image with locked focus, and then I draw the image in a rect bigger than the image's size. I'd expect a big black rect drawn, but get a very different result (see figure please): the color seems gray, not black, it seems transparent and shouldn't be, it's two times thicker, has dark little rects at the vertexes etc..

The code is:

... after created the image and the path...
... and supposing the image bounds are (0, 0, 32 32) and the view bounds (0, 0, 256, 256)...


[path appendBezierPathWithRect:NSMakeRect(6, 6, 20, 20)];//for example...

[image lockFocus];
[image clearImage];
[pathColor set];
[path stroke];
[image unlockFocus];
then in a view's draw method:


[image drawInRect:[self bounds] fromRect:[image sourceRect] operation:NSCompositeSourceOver fraction:1.0];

([image sourceRect] simply returns the image bounds; [image clearImage] simply fills with clearColor the image bounds)

Can anyone tell me something about (why the black rect is not merely a rect)?

Sorry if I'm tedious with too much code...
Many thanks to all of you,
livio.

TIFF image

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Problem with paths and images
      • From: Ronny Reichmann <email@hidden>
    • Re: Problem with paths and images
      • From: Ryan Britton <email@hidden>
  • Prev by Date: capturing user reaction times in msecs
  • Next by Date: Re: capturing user reaction times in msecs
  • Previous by thread: capturing user reaction times in msecs
  • Next by thread: Re: Problem with paths and images
  • Index(es):
    • Date
    • Thread