Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: drawing an image in a cocoa-java app [newbie]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing an image in a cocoa-java app [newbie]



Let me see if i understood it: the drawAtPoint method draws the NSImage at (x, y) = (10, 10), inside a rectangle the size of the custom view. It draws the picture over what may be at the destination. Is this right?

Yes, it seems.

- How can i flip the y axis coordinates? I've seen on the documentation that there's the isFlipped() method (that returns a boolean), but i didn't find a variable or a method to set if it's flipped or not..

Add the following method to your customview:

public boolean isFlipped()
{
return true;
}

- Does the NSRect used in the drawAtPoint method crop the picture?

Yes.


As an alternate method, the following draws the entire image at the size of the customview:


public void drawRect(NSRect rect)
{
NSSize size=img.size();
img.drawInRect(bounds(),new NSRect(0,0,size.width(),size.height()),NSImage.compositeSourceOver,1);

}
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.