• 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
[SOLVED] Fwd: Incorrect flipping when manually drawing NSCells (was: Fwd: -isFlipped not working right when drawing IconAndTextCell to NSImage)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] Fwd: Incorrect flipping when manually drawing NSCells (was: Fwd: -isFlipped not working right when drawing IconAndTextCell to NSImage)


  • Subject: [SOLVED] Fwd: Incorrect flipping when manually drawing NSCells (was: Fwd: -isFlipped not working right when drawing IconAndTextCell to NSImage)
  • From: "Lawrence Sanbourne" <email@hidden>
  • Date: Sat, 29 Apr 2006 23:24:07 -0500

Solved! To create the drag image, I was having the cell draw to an
intermediate image (cellImage) and then compositing the intermediate
image to a final image at 50% opacity. This fixed the problem:

[cellImage setFlipped:[self isFlipped]];

Larry

---------- Forwarded message ----------
From: Lawrence Sanbourne <email@hidden>
Date: Apr 29, 2006 5:47 PM
Subject: Incorrect flipping when manually drawing NSCells (was: Fwd:
-isFlipped not working right when drawing IconAndTextCell to NSImage)
To: Apple Mailing List <email@hidden>


Hello again,

After some more testing, I've determined that this also happens with
other NSCells besides IconAndTextCell. In particular, I get the same
behavior with a custom cell I wrote myself. (It's viewed in an
NSMatrix subclass.)

So, what am I doing wrong when I try to draw NSCells to images?

       // Draw cell in cellImage.
       BOOL highlighted = [cell isHighlighted];
       [cell setHighlighted:NO];

       [cellImage lockFocus];
       [cell drawWithFrame:cellDrawingFrame inView:self]; // self is the
NSControl containing the cell
       [cellImage unlockFocus];
       [cell setHighlighted:highlighted];

Somehow, if the cell draws text, it comes out OK. But if the cell
draws images, they come out flipped.

Does this help? Any ideas?

Larry

---------- Forwarded message ----------
From: Lawrence Sanbourne <email@hidden>
Date: Apr 28, 2006 8:13 PM
Subject: -isFlipped not working right when drawing IconAndTextCell to NSImage
To: Apple Mailing List <email@hidden>


Hello,

I'm fairly new to Cocoa drawing, and I'm having a problem with
-isFlipped that I haven't been able to figure out. From a subclass of
NSTableView, I'm drawing one of the table's IconAndTextCell objects
into an NSImage to create a custom drag image:

- (NSImage *)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows
tableColumns:(NSArray *)tableColumns event:(NSEvent *)dragEvent
offset:(NSPointPointer)dragImageOffset {
//...
               [dragImage lockFocus];
               [cell drawWithFrame:cellDrawingFrame inView:self];
               [dragImage unlockFocus];
//...
return dragImage;
}

IconAndTextCell is careful to check the -isFlipped status of its
controlView. However, this is causing the icon in the cell to draw in
the wrong place. If I negate the conditional on the if([controlView
isFlipped]) in IconAndTextCell, the problem is fixed for drag images
-- but then of course all the other IconAndTextCells look weird.

What am I doing wrong?

Larry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Incorrect flipping when manually drawing NSCells (was: Fwd: -isFlipped not working right when drawing IconAndTextCell to NSImage) (From: "Lawrence Sanbourne" <email@hidden>)

  • Prev by Date: undo in a sheet
  • Next by Date: Re: refactoring tools and xcode plugins
  • Previous by thread: Incorrect flipping when manually drawing NSCells (was: Fwd: -isFlipped not working right when drawing IconAndTextCell to NSImage)
  • Next by thread: Re: Incorrect flipping when manually drawing NSCells (was: Fwd: -isFlipped not working right when drawing IconAndTextCell to NSImage)
  • Index(es):
    • Date
    • Thread