Re: Adding a background image to the GLPaint sample

2012-03-28 Thread David Duncan
GLPaint is a really old sample, and appears to have not been updated to use a 
UIViewController subclass to manage its view, and as such will elicit this 
warning because the window's rootViewController property will not have been 
set. I would recommend you look at a more recent sample, or even at one of the 
application templates, for a better example along this vein.

On Mar 28, 2012, at 10:15 AM, David Delmonte wrote:

> Thanks David, I will work with that..
> 
> I have a follow-up question. In the GLPaint sample,  there is an 
> AppController rather than an AppDelegate, and another warning "Application 
> windows are expected to have a root view controller at the end of application 
> launch".
> 
> When you can, would you mind explaining both of these.
> 
> I'm much obliged, and am learning, albeit slwly.

--
David Duncan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Adding a background image to the GLPaint sample

2012-03-28 Thread David Duncan
On Mar 28, 2012, at 6:22 AM, David Delmonte wrote:

> Hi, I'm trying to do the above. I've added a simple UIButton at the 
> AppDelegate level (as there is no ViewController).
> 
> When the button is tapped:
> 
> - (IBAction)pictureButtonTapped:(id)sender {
>   NSLog(@"%s", __FUNCTION__);
>   drawingView.backgroundColor = [UIColor colorWithPatternImage:[UIImage 
> imageNamed:@"background.png"]];
>   [drawingView playRay];
> }
> 
> and this results in:
> 
> : calling -display has no effect.
> 
> I only know enough to be dangerous, so any advice on using the GLPaint sample 
> (or alternatives) and this issue specifically, would be most welcome...


Given that you are working from GLPaint, the solution is to upload the image as 
a texture and draw it via OpenGL (at least, this is the most expedient and 
performant solution).

For some background since it explains the warning you got:
When you set a background color with a pattern on a UIView, UIKit will may need 
to draw that pattern via -drawRect:, which involves calling -setNeedsDisplay 
(and eventually -display) on the underlying CALayer. The CAEAGLLayer however 
doesn't draw via its -display method, and just logs the message above.
--
David Duncan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Adding a background image to the GLPaint sample

2012-03-28 Thread David Delmonte
Hi, I'm trying to do the above. I've added a simple UIButton at the AppDelegate 
level (as there is no ViewController).

When the button is tapped:

- (IBAction)pictureButtonTapped:(id)sender {
NSLog(@"%s", __FUNCTION__);
drawingView.backgroundColor = [UIColor colorWithPatternImage:[UIImage 
imageNamed:@"background.png"]];
[drawingView playRay];
}

and this results in:

: calling -display has no effect.

I only know enough to be dangerous, so any advice on using the GLPaint sample 
(or alternatives) and this issue specifically, would be most welcome...

David



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: background image

2012-03-09 Thread Roland King
Nope. 


On 9 Mar, 2012, at 19:16, Luca Ciciriello  wrote:

> Hi All.
> Is there a way from iOS code to set an UIImage as iPad desktop wallpaper?
> 
> Luca.
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please 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:
> https://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
> 
> This email sent to r...@rols.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


background image

2012-03-09 Thread Luca Ciciriello
Hi All.
Is there a way from iOS code to set an UIImage as iPad desktop wallpaper?

Luca.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Change background image in select behavior in the NSToolbarItem

2010-05-05 Thread Kyle Sluder
2010/5/5 Junio Gonçalves Vitorino :
> Doesn't exist some way or i'm speaking bullshit.

Huh? Are you bumping this thread or something? If someone feels like
responding, they will respond.

Though I must say it would help your chances of getting a response if
you explained what you wanted better. Maybe a screenshot?

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Change background image in select behavior in the NSToolbarItem

2010-05-05 Thread Junio Gonçalves Vitorino
Doesn't exist some way or i'm speaking bullshit.

2010/5/5 Junio Gonçalves Vitorino 

> Hi everyone,
>
> I'd like know if i can change the background image of select behavior when
> i click in a NSToolbarItem. An example of the i wanna is the AppZapper
> toolbar, I'd like put a image with a closed square more rounded. That's
> possible?
>
> --
> Atenciosamente, Cordially
>
> Junio Vitorino
> http://www.lamiscela.net
> 55 31 9901-7499
>



-- 
Atenciosamente, Cordially

Junio Vitorino
http://www.lamiscela.net
55 31 9901-7499
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Change background image in select behavior in the NSToolbarItem

2010-05-05 Thread Junio Gonçalves Vitorino
Hi everyone,

I'd like know if i can change the background image of select behavior when i
click in a NSToolbarItem. An example of the i wanna is the AppZapper
toolbar, I'd like put a image with a closed square more rounded. That's
possible?

-- 
Atenciosamente, Cordially

Junio Vitorino
http://www.lamiscela.net
55 31 9901-7499
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableview background image for column?

2010-04-26 Thread Sean McBride
On Sat, 24 Apr 2010 14:28:02 -0400, Izak van Langevelde said:

>An NSTableView needs a column with one single image, spanning the entire
>column.
>
>I have got this working by setting as the background colour of the
>NSTableView a pattern, consisting of the background image, scaled big
>enough so it does not tile. However, this is somewhat limiting with
>respect to column reordering and resizing.
>
>I considered using an NSImageView next to theNSTableView within the same
>NSScrollView, or making a table cell span all rows, but each of these
>has its own problems.
>
>Any suggestions on how to improve?

Have you looked at:
<http://developer.apple.com/mac/library/samplecode/ImageBackground/
Introduction/Intro.html>

"ImageBackground shows how to draw an image in the background of an
NSOutlineView and NSTableView..."

Pathetically, searching the sample code section for 'table' does not
reveal this sample. :(

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableview background image for column?

2010-04-25 Thread Kyle Sluder
On Apr 24, 2010, at 12:52 PM, Izak van Langevelde   
wrote:


The table shows a so-called 'exposure sheet' for an animation, where  
each row corresponds to one frame, and the columns correspond to the  
various foreground and background animation layers. There is one  
column for audio, and for synchronization purposes it is nice to  
show a wave form of the audio. However, the waveform is fixed, i.e.  
not editable, so adding and deleting table rows only affects the  
position fn table rows with respect to the audio: the audio is  
background, both as audio and as picture. Columns are not sortable,  
although it would be nice to be able to reorder them.


It sounds like you're going for something similar to what you'd see if  
you looked at a reel of 8mm film.


Since at some point you have to generate the entire waveform as one  
image, I'd probably use a custom NSCell subclass in the appropriate  
column, and point it at the NSImage that contains your waveform. Then  
when the tableview goes to draw that cell in a row (I believe the  
delegate method informing you of this is called - 
tableView:willDisplayCell: or something similar) I'd poke the cell to  
tell it what offset into the image it should draw. The cell's drawing  
method would then draw the subset of the waveform image.


This avoids the problem you describe of creating tons of image slices;  
there's only one NSImage object but your cells are smart enough to  
share it and only draw the relevant parts when asked.


HTH,
--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableview background image for column?

2010-04-24 Thread Izak van Langevelde
The table shows a so-called 'exposure sheet' for an animation, where each row 
corresponds to one frame, and the columns correspond to the various foreground 
and background animation layers. There is one column for audio, and for 
synchronization purposes it is nice to show a wave form of the audio. However, 
the waveform is fixed, i.e. not editable, so adding and deleting table rows 
only affects the position fn table rows with respect to the audio: the audio is 
background, both as audio and as picture. Columns are not sortable, although it 
would be nice to be able to reorder them.

So, 'slicing' the wave form to fit the cells of the audio column will do, but 
then removing/reordering/adding a row from the table means that lots of cell 
images need to be shuffled to restore the audio track.

On 2010-04-24, at 2:44 PM, Andy Lee wrote:

> What about a custom table cell whose draw method draws the appropriate 
> subrectangle of the image?  Would that work?  You might have to work around 
> the table's intercellSpacing so there aren't breaks in the image.
> 
> What's in this image anyway?  I'm having a hard time imagining an app that 
> would use a table column this way.  Are the columns of your table sortable, 
> and if so, does the image remain the same?
> 
> --Andy
> 
> 
> On Apr 24, 2010, at 2:28 PM, Izak van Langevelde wrote:
> 
>> An NSTableView needs a column with one single image, spanning the entire 
>> column.
>> 
>> I have got this working by setting as the background colour of the 
>> NSTableView a pattern, consisting of the background image, scaled big enough 
>> so it does not tile. However, this is somewhat limiting with respect to 
>> column reordering and resizing.
>> 
>> I considered using an NSImageView next to theNSTableView within the same 
>> NSScrollView, or making a table cell span all rows, but each of these has 
>> its own problems. 
>> 
>> Any suggestions on how to improve?
>> 
>> Regards,
>> Izak
>> ---
>> Grinnikend door het leven...
> 
> 

---
Grinnikend door het leven...

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableview background image for column?

2010-04-24 Thread Andy Lee
Or look into overriding some combination of NSTableView's 
drawBackgroundInClipRect:, drawGridInClipRect:, and drawRow:clipRect:, possibly 
using information about the appropriate NSTableColumn to help calculate 
coordinates.

--Andy

On Apr 24, 2010, at 2:44 PM, Andy Lee wrote:

> What about a custom table cell whose draw method draws the appropriate 
> subrectangle of the image?  Would that work?  You might have to work around 
> the table's intercellSpacing so there aren't breaks in the image.
> 
> What's in this image anyway?  I'm having a hard time imagining an app that 
> would use a table column this way.  Are the columns of your table sortable, 
> and if so, does the image remain the same?
> 
> --Andy
> 
> 
> On Apr 24, 2010, at 2:28 PM, Izak van Langevelde wrote:
> 
>> An NSTableView needs a column with one single image, spanning the entire 
>> column.
>> 
>> I have got this working by setting as the background colour of the 
>> NSTableView a pattern, consisting of the background image, scaled big enough 
>> so it does not tile. However, this is somewhat limiting with respect to 
>> column reordering and resizing.
>> 
>> I considered using an NSImageView next to theNSTableView within the same 
>> NSScrollView, or making a table cell span all rows, but each of these has 
>> its own problems. 
>> 
>> Any suggestions on how to improve?
>> 
>> Regards,
>> Izak
>> ---
>> Grinnikend door het leven...
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please 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:
> http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
> 
> This email sent to ag...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableview background image for column?

2010-04-24 Thread Andy Lee
What about a custom table cell whose draw method draws the appropriate 
subrectangle of the image?  Would that work?  You might have to work around the 
table's intercellSpacing so there aren't breaks in the image.

What's in this image anyway?  I'm having a hard time imagining an app that 
would use a table column this way.  Are the columns of your table sortable, and 
if so, does the image remain the same?

--Andy


On Apr 24, 2010, at 2:28 PM, Izak van Langevelde wrote:

> An NSTableView needs a column with one single image, spanning the entire 
> column.
> 
> I have got this working by setting as the background colour of the 
> NSTableView a pattern, consisting of the background image, scaled big enough 
> so it does not tile. However, this is somewhat limiting with respect to 
> column reordering and resizing.
> 
> I considered using an NSImageView next to theNSTableView within the same 
> NSScrollView, or making a table cell span all rows, but each of these has its 
> own problems. 
> 
> Any suggestions on how to improve?
> 
> Regards,
> Izak
> ---
> Grinnikend door het leven...


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTableview background image for column?

2010-04-24 Thread Izak van Langevelde
An NSTableView needs a column with one single image, spanning the entire column.

I have got this working by setting as the background colour of the NSTableView 
a pattern, consisting of the background image, scaled big enough so it does not 
tile. However, this is somewhat limiting with respect to column reordering and 
resizing.

I considered using an NSImageView next to theNSTableView within the same 
NSScrollView, or making a table cell span all rows, but each of these has its 
own problems. 

Any suggestions on how to improve?

Regards,
Izak
---
Grinnikend door het leven...

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Background image of CustomTableView Cells

2009-10-15 Thread Symadept
Hi,Can anybody please help me regarding this.

Regards
Symadept

On Wed, Oct 14, 2009 at 6:50 PM, Symadept  wrote:

>
> Hi,
> Can you help me to fix this problem.
>
> I am customizing my table view to show various images in the background of
> the cells accordingly as
>
> Selected : Font Changed to While Colour, Background image, Highlighted.png
> Deselected/Normal: Font -> Black colour, Bg Image: Default.png
>
> I tried to override
>  - (void)drawInteriorWithFrame:(NSRect)theCellFrame 
> inView:(NSView*)theControlView
>
>  of NSCell to change the Font Color and BgImage according to the state as I
> mentioned earlier.
>
> Result: Once the application launched it is ok. Once I select col1 and
> select col2, my Col1 still shows the Highlighted image, infact it is
> deselected and supposed to show the Default Image. This because my Default
> image is a transparent image. Even after overlapping Default.png on
> Highlighted.png it is showing the same Highlighted.png.
>
> I guess what I need to do is to remove the image from the Cell before
> redrawing it. How to do I really don't know.
>
> Kindly look into this and help me in this regards.
>
>  CustomTableCell
>
> @interface CustomTableCell : NSCell {
>
>
> }
>
>
> @end
>
>
> #import "CustomTableCell.h"
>
>
>
> @implementation CustomTableCell
>
> - (void)drawInteriorWithFrame:(NSRect)theCellFrame 
> inView:(NSView*)theControlView
>
> {
>
> NSLog(@"CustomTableCell drawInteriorWithFrame");
>
> NSImage *bgImage = [NSImage imageNamed:@"DefaultCell"];
>
>  // Make attributes for our strings
>
> NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle
> alloc] init] autorelease];
>
> [aParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
>
> [aParagraphStyle setAlignment:NSCenterTextAlignment];
>
>// Title attributes: system font, 14pt, black, truncate tail
>
> NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc]
> initWithObjectsAndKeys:
>
>[NSColor blackColor],NSForegroundColorAttributeName,
>
>[NSFont systemFontOfSize:21.0],NSFontAttributeName,
>
>aParagraphStyle, NSParagraphStyleAttributeName,
>
>nil] autorelease];
>
>  // Make a Title string
>
> NSString * aTitle = [self stringValue];
>
> NSLog(@"CellFrame:[%f %f] [%f %f]", theCellFrame.origin.x, theCellFrame.
> origin.y, theCellFrame.size.width, theCellFrame.size.height);
>
> NSRect anIconBox = theCellFrame;
>
> NSRect aTitleBox = NSMakeRect(theCellFrame.origin.x,
>
>   theCellFrame.origin.y + theCellFrame.size.height/2-10,
>
>   theCellFrame.size.width,
>
>   theCellFrame.size.height);
>
>
>  if( [self isHighlighted])
>
> {
>
> // if the cell is highlighted, draw the text white
>
> [aTitleAttributes setValue:[NSColor whiteColor] forKey:
> NSForegroundColorAttributeName];
>
> bgImage = [NSImage imageNamed:@"FocusedCell"];
>
> }
>
> else
>
> {
>
> // if the cell is not highlighted, draw the title black and the subtile
> gray
>
> [aTitleAttributes setValue:[NSColor orangeColor] forKey:
> NSForegroundColorAttributeName];
>
> }
>
>  // Draw the icon
>
> [bgImage drawInRect:anIconBox fromRect:NSZeroRect operation:
> NSCompositePlusLighter fraction:1.0];
>
>  // Draw the text
>
> [aTitle drawInRect:aTitleBox withAttributes:aTitleAttributes];
>
> }
>
> @end
>
>
>  CustomTableView
>
> @interface CustomTableView : NSTableView {
>
>
> }
>
>
> @end
>
>
> #import "CustomTableView.h"
>
>
>
> @implementation CustomTableView
>
>
> - (void)awakeFromNib
>
> {
>
> NSLog(@"CustomTableView awakeFromNib");
>
> [[self enclosingScrollView] setDrawsBackground:NO];
>
> }
>
>
> - (void)drawBackgroundInClipRect:(NSRect)clipRect
>
> {
>
> NSLog(@"CustomTableView drawBackgroundInClipRect");
>
> }
>
>
> #pragma mark -
>
> #pragma mark Selection Highlighting
>
>
> - (id)_highlightColorForCell:(NSCell *)cell
>
> {
>
> // we need to override this to return nil
>
> // or we'll see the default selection rectangle when the app is running
>
> // in any OS before leopard
>
>  // you can also return a color if you simply want to change the table's
> default selection color
>
> return nil;
>
> }
>
>
> @end
>
>
> Thanks in advance
>
> Regards
> symadept
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Background image of CustomTableView Cells

2009-10-14 Thread Symadept
Hi,
Can you help me to fix this problem.

I am customizing my table view to show various images in the background of
the cells accordingly as

Selected : Font Changed to While Colour, Background image, Highlighted.png
Deselected/Normal: Font -> Black colour, Bg Image: Default.png

I tried to override
 - (void)drawInteriorWithFrame:(NSRect)theCellFrame
inView:(NSView*)theControlView

 of NSCell to change the Font Color and BgImage according to the state as I
mentioned earlier.

Result: Once the application launched it is ok. Once I select col1 and
select col2, my Col1 still shows the Highlighted image, infact it is
deselected and supposed to show the Default Image. This because my Default
image is a transparent image. Even after overlapping Default.png on
Highlighted.png it is showing the same Highlighted.png.

I guess what I need to do is to remove the image from the Cell before
redrawing it. How to do I really don't know.

Kindly look into this and help me in this regards.

 CustomTableCell

@interface CustomTableCell : NSCell {


}


@end


#import "CustomTableCell.h"



@implementation CustomTableCell

- (void)drawInteriorWithFrame:(NSRect)theCellFrame
inView:(NSView*)theControlView

{

NSLog(@"CustomTableCell drawInteriorWithFrame");

NSImage *bgImage = [NSImage imageNamed:@"DefaultCell"];

 // Make attributes for our strings

NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle alloc]
init] autorelease];

[aParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];

[aParagraphStyle setAlignment:NSCenterTextAlignment];

   // Title attributes: system font, 14pt, black, truncate tail

NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc]
initWithObjectsAndKeys:

   [NSColor blackColor],NSForegroundColorAttributeName,

   [NSFont systemFontOfSize:21.0],NSFontAttributeName,

   aParagraphStyle, NSParagraphStyleAttributeName,

   nil] autorelease];

 // Make a Title string

NSString * aTitle = [self stringValue];

NSLog(@"CellFrame:[%f %f] [%f %f]", theCellFrame.origin.x, theCellFrame.
origin.y, theCellFrame.size.width, theCellFrame.size.height);

NSRect anIconBox = theCellFrame;

NSRect aTitleBox = NSMakeRect(theCellFrame.origin.x,

  theCellFrame.origin.y + theCellFrame.size.height/2-10,

  theCellFrame.size.width,

  theCellFrame.size.height);


 if( [self isHighlighted])

{

// if the cell is highlighted, draw the text white

[aTitleAttributes setValue:[NSColor whiteColor] forKey:
NSForegroundColorAttributeName];

bgImage = [NSImage imageNamed:@"FocusedCell"];

}

else

{

// if the cell is not highlighted, draw the title black and the subtile gray

[aTitleAttributes setValue:[NSColor orangeColor] forKey:
NSForegroundColorAttributeName];

}

 // Draw the icon

[bgImage drawInRect:anIconBox fromRect:NSZeroRect operation:
NSCompositePlusLighter fraction:1.0];

 // Draw the text

[aTitle drawInRect:aTitleBox withAttributes:aTitleAttributes];

}

@end


 CustomTableView

@interface CustomTableView : NSTableView {


}


@end


#import "CustomTableView.h"



@implementation CustomTableView


- (void)awakeFromNib

{

NSLog(@"CustomTableView awakeFromNib");

[[self enclosingScrollView] setDrawsBackground:NO];

}


- (void)drawBackgroundInClipRect:(NSRect)clipRect

{

NSLog(@"CustomTableView drawBackgroundInClipRect");

}


#pragma mark -

#pragma mark Selection Highlighting


- (id)_highlightColorForCell:(NSCell *)cell

{

// we need to override this to return nil

// or we'll see the default selection rectangle when the app is running

// in any OS before leopard

 // you can also return a color if you simply want to change the table's
default selection color

return nil;

}


@end


Thanks in advance

Regards
symadept
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-06-01 Thread cocoa learner
On Sun, May 31, 2009 at 9:37 PM, Andy Lee  wrote:

> On May 31, 2009, at 8:51 AM, Uli Kusterer wrote:
>
> Another approach would be to try changing the class of your content view in
> Interface builder. Simply click the background of the window, that should
> show the content view in the inspector. Go to the "Identity" tab and change
> the class to NSImageView. Then you can probably just do
>
> [(NSImageView*)[myWindow contentView] setImage: [[[NSImage alloc]
> initWithContentsOfFile: path] autorelease]];
>
>
> I had the same thought but when I tried it (and added a call to
> setImageScaling:) the image didn't appear.  I wonder what I'm doing wrong:
>
> - (void)awakeFromNib
> {
> NSLog(@"-[AppDelegate awakeFromNib]");
>
> NSImage *whiteRoomImage = [NSImage imageNamed:@"WhiteRoom"];
> NSImageView *backgroundImageView = (NSImageView *)[_imageWindow
> contentView];
>
> NSLog(@"image: %@", whiteRoomImage);
> NSLog(@"contentView: %@", [_imageWindow contentView]);
>
> [backgroundImageView setImageScaling:NSScaleToFit];
> [backgroundImageView setImage:whiteRoomImage];
> }
>
> Yet another approach would be to use IB to add an image view as a subview
> of the window's content view, and use autoresizing to have it always fill
> the content view.  The benefit of this approach is that you can see the
> background image in IB, so you can see what it looks like as you lay out its
> subviews.
>

This is same as what I had in the start of mail thread. [my first mail in
this mail thread].

Regards
Cocoa.learner


> --Andy
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-31 Thread Andy Lee

On May 31, 2009, at 8:51 AM, Uli Kusterer wrote:
Another approach would be to try changing the class of your content  
view in Interface builder. Simply click the background of the  
window, that should show the content view in the inspector. Go to  
the "Identity" tab and change the class to NSImageView. Then you can  
probably just do


[(NSImageView*)[myWindow contentView] setImage: [[[NSImage alloc]  
initWithContentsOfFile: path] autorelease]];


I had the same thought but when I tried it (and added a call to  
setImageScaling:) the image didn't appear.  I wonder what I'm doing  
wrong:


- (void)awakeFromNib
{
NSLog(@"-[AppDelegate awakeFromNib]");

NSImage *whiteRoomImage = [NSImage imageNamed:@"WhiteRoom"];
NSImageView *backgroundImageView = (NSImageView *)[_imageWindow  
contentView];


NSLog(@"image: %@", whiteRoomImage);
NSLog(@"contentView: %@", [_imageWindow contentView]);

[backgroundImageView setImageScaling:NSScaleToFit];
[backgroundImageView setImage:whiteRoomImage];
}

Yet another approach would be to use IB to add an image view as a  
subview of the window's content view, and use autoresizing to have it  
always fill the content view.  The benefit of this approach is that  
you can see the background image in IB, so you can see what it looks  
like as you lay out its subviews.


--Andy

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-31 Thread Uli Kusterer

Am 30.05.2009 um 19:45 schrieb cocoa learner:
Yah Andy and Michael you all were right. But still I have some  
problem.1>.

While resizing the window Image is not getting resized.


 You could probably fix that using setImageScaling: on the image view.


2>. My controls (NSButton and NSTextField) are not visible after the
awakeFromNib call.


 You are replacing the window's content view with a new view. That  
means that the entire content view and all its subviews get removed.  
You may want to loop over the subviews of the previous content view  
and move them all to your image view.


 Another approach would be to try changing the class of your content  
view in Interface builder. Simply click the background of the window,  
that should show the content view in the inspector. Go to the  
"Identity" tab and change the class to NSImageView. Then you can  
probably just do


[(NSImageView*)[myWindow contentView] setImage: [[[NSImage alloc]  
initWithContentsOfFile: path] autorelease]];


 I haven't actually tried this, but I know you can select the content  
view that way since Interface Builder 3.x, and I know you can change  
classes of objects that way, so this should work.



NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];

NSLog(@"AppController::init : Image file path : %@", path);

// winImageView is a data member of this class

winImageView = [[NSImageView alloc] init];

[winImageView setImage: [[NSImage alloc] initWithContentsOfFile:  
path]];



 Are you using garbage collection? If not, you are leaking the image  
and the image view here. In that case, you may want to re-read Apple's  
memory-management documentation, which describes which things need to  
be released and which ones don't.


Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-30 Thread M Pulis

No, the conclusion is : That _is_ the easy and straight way to do it.

Subclassing is your power and friend, my friend. Once you understand  
what those lines actually do, you should have a different point-of-view.


"Embrace the subclass, for they know what they are doing."  :-)

gary

On May 30, 2009, at 9:03 PM, cocoa learner wrote:

Ok. Let me try this.So conclusion is there is no easy and straight  
way to do

it. Have to subclass NSView.

Thanx Michael.
Cocoa.learner

On Sun, May 31, 2009 at 1:12 AM, Michael Vannorsdel  
wrote:


You'd really be better off making an NSView subclass and having it  
draw the

image you want in drawRect:.

- (void)awakeFromNib
{
   myImage = [[NSImage alloc] init

   [self setNeedsDisplay:YES];
}

- (void)drawRect:(NSRect)rect
{
   NSSize isize = [myImage size];
   [myImage drawInRect:[self bounds] fromRect:NSMakeRect(0.0,  
0.0,

isize.width, isize.height) operation: NSCompositeCopy fraction:1.0];
}

*this was written in mail, may gave errors.

On May 30, 2009, at 11:45 AM, cocoa learner wrote:

 Yah Andy and Michael you all were right. But still I have some  
problem.

1>. While resizing the window Image is not getting resized.
2>. My controls (NSButton and NSTextField) are not visible after the
awakeFromNib call.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/cocoa.learner% 
40gmail.com


This email sent to cocoa.lear...@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/toothpic%40fastq.com

This email sent to tooth...@fastq.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-30 Thread cocoa learner
Ok. Let me try this.So conclusion is there is no easy and straight way to do
it. Have to subclass NSView.

Thanx Michael.
Cocoa.learner

On Sun, May 31, 2009 at 1:12 AM, Michael Vannorsdel wrote:

> You'd really be better off making an NSView subclass and having it draw the
> image you want in drawRect:.
>
> - (void)awakeFromNib
> {
>myImage = [[NSImage alloc] init
>
>[self setNeedsDisplay:YES];
> }
>
> - (void)drawRect:(NSRect)rect
> {
>NSSize isize = [myImage size];
>[myImage drawInRect:[self bounds] fromRect:NSMakeRect(0.0, 0.0,
> isize.width, isize.height) operation: NSCompositeCopy fraction:1.0];
> }
>
> *this was written in mail, may gave errors.
>
> On May 30, 2009, at 11:45 AM, cocoa learner wrote:
>
>  Yah Andy and Michael you all were right. But still I have some problem.
>> 1>. While resizing the window Image is not getting resized.
>> 2>. My controls (NSButton and NSTextField) are not visible after the
>> awakeFromNib call.
>>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoa.learner%40gmail.com
>
> This email sent to cocoa.lear...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-30 Thread Michael Vannorsdel
You'd really be better off making an NSView subclass and having it  
draw the image you want in drawRect:.


- (void)awakeFromNib
{
myImage = [[NSImage alloc] init

[self setNeedsDisplay:YES];
}

- (void)drawRect:(NSRect)rect
{
NSSize isize = [myImage size];
	[myImage drawInRect:[self bounds] fromRect:NSMakeRect(0.0, 0.0,  
isize.width, isize.height) operation: NSCompositeCopy fraction:1.0];

}

*this was written in mail, may gave errors.

On May 30, 2009, at 11:45 AM, cocoa learner wrote:

Yah Andy and Michael you all were right. But still I have some  
problem.

1>. While resizing the window Image is not getting resized.
2>. My controls (NSButton and NSTextField) are not visible after the  
awakeFromNib call.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-30 Thread cocoa learner
Yah Andy and Michael you all were right. But still I have some problem.1>.
While resizing the window Image is not getting resized.
2>. My controls (NSButton and NSTextField) are not visible after the
awakeFromNib call.

Here is modified code -

- (void) awakeFromNib

{

if (appWindow == NULL)

{

NSLog(@"AppController::awakeFromNib : appWindow is NULL");

}

else

{

NSLog(@"AppController::awakeFromNib : appWindow is not NULL");

if (winImageView == NULL)

{

NSLog(@"AppController::awakeFromNib : appWindow is NULL");

}

else

{

NSLog(@"AppController::awakeFromNib : appWindow is not NULL");

}

[ appWindow setContentView: winImageView];

}

}


- (id) init

{

[super init];

 NSBundle *myBundle = [NSBundle mainBundle];

if (myBundle == NULL)

{

NSLog(@"AppController::init : myBundle is NULL");

}

else

{

NSLog(@"AppController::init : myBundle is not NULL");

}

 NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];

 NSLog(@"AppController::init : Image file path : %@", path);

 // winImageView is a data member of this class

winImageView = [[NSImageView alloc] init];

[winImageView setImage: [[NSImage alloc] initWithContentsOfFile: path]];

 return self;

}

Regards
Cocoa.learner

On Sat, May 30, 2009 at 9:28 PM, Michael Vannorsdel wrote:

> You're creating an NSImage and pretending it's an NSImageView which it's
> not.  You'll need to create a new NSImageView and then the NSImage and set
> the image as the imageview's image.
>
>
>
> On May 30, 2009, at 8:27 AM, cocoa learner wrote:
>
>  Thanx Nick for your reply.But in my window I am not getting the image I
>> want
>> to display. Here is my code -
>>
>> - (id) init
>>
>> {
>>
>> [super init];
>>
>> NSLog(@"AppController::init : Setting the windows content");
>>
>> NSBundle *myBundle = [NSBundle mainBundle];
>>
>> if (myBundle == NULL)
>>
>> {
>>
>> NSLog(@"AppController::init : myBundle is NULL");
>>
>> }
>>
>> else
>>
>> {
>>
>> NSLog(@"AppController::init : myBundle is not NULL");
>>
>> }
>>
>> NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];
>>
>> NSLog(@"AppController::init : Image file path : %@", path);
>>
>> NSImageView *winContent = [[NSImage alloc] initWithContentsOfFile:path];
>>
>> [ appWindow setContentView: winContent];
>>
>> NSLog(@"AppController::init : The windows content has been set");
>>
>> return self;
>>
>> }
>>
>> I can see all the logs. But not the image in back ground of my app window.
>> Am I doing any thing wrong in this code?
>>
>> Regards
>> Cocoa.learner.
>>
>>
>> On Tue, May 26, 2009 at 11:12 PM, Nick Zitzmann 
>> wrote:
>>
>>
>>> On May 26, 2009, at 11:04 AM, cocoa learner wrote:
>>>
>>> How to draw background image in my app window?
>>>
>>>>
>>>>
>>> You could change the window's content view using -setContentView: to a
>>> view
>>> that will draw a background image, such as NSImageView... Of course, if
>>> you
>>> have any other controls in the content view that is being replaced, then
>>> they'll be lost.
>>>
>>> Nick Zitzmann
>>> <http://www.chronosnet.com/>
>>>
>>>
>>>
>>>
>>>
>>>
>>>  ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/mikevann%40gmail.com
>>
>> This email sent to mikev...@gmail.com
>>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoa.learner%40gmail.com
>
> This email sent to cocoa.lear...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-30 Thread Michael Vannorsdel
You're creating an NSImage and pretending it's an NSImageView which  
it's not.  You'll need to create a new NSImageView and then the  
NSImage and set the image as the imageview's image.



On May 30, 2009, at 8:27 AM, cocoa learner wrote:

Thanx Nick for your reply.But in my window I am not getting the  
image I want

to display. Here is my code -

- (id) init

{

[super init];

NSLog(@"AppController::init : Setting the windows content");

NSBundle *myBundle = [NSBundle mainBundle];

if (myBundle == NULL)

{

NSLog(@"AppController::init : myBundle is NULL");

}

else

{

NSLog(@"AppController::init : myBundle is not NULL");

}

NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];

NSLog(@"AppController::init : Image file path : %@", path);

NSImageView *winContent = [[NSImage alloc]  
initWithContentsOfFile:path];


[ appWindow setContentView: winContent];

NSLog(@"AppController::init : The windows content has been set");

return self;

}

I can see all the logs. But not the image in back ground of my app  
window.

Am I doing any thing wrong in this code?

Regards
Cocoa.learner.


On Tue, May 26, 2009 at 11:12 PM, Nick Zitzmann  
 wrote:




On May 26, 2009, at 11:04 AM, cocoa learner wrote:

How to draw background image in my app window?




You could change the window's content view using -setContentView:  
to a view
that will draw a background image, such as NSImageView... Of  
course, if you
have any other controls in the content view that is being replaced,  
then

they'll be lost.

Nick Zitzmann
<http://www.chronosnet.com/>







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/mikevann%40gmail.com

This email sent to mikev...@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-30 Thread Andy Lee

I suspect appWindow is nil, which you can check with one more NSLog:

NSLog(@"appWindow is %@", appWindow);

Your init method is being called before the nib file has completely  
loaded, so not all the connections have been made yet.  Try adding an  
awakeFromNib method and moving your code there.  Also, double-check  
that you've connected the AppController's appWindow outlet in IB.


<http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSNibAwaking_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/awakeFromNib 
>


--Andy


On May 30, 2009, at 10:27 AM, cocoa learner wrote:

Thanx Nick for your reply.But in my window I am not getting the  
image I want

to display. Here is my code -

- (id) init

{

[super init];

NSLog(@"AppController::init : Setting the windows content");

NSBundle *myBundle = [NSBundle mainBundle];

if (myBundle == NULL)

{

NSLog(@"AppController::init : myBundle is NULL");

}

else

{

NSLog(@"AppController::init : myBundle is not NULL");

}

NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];

NSLog(@"AppController::init : Image file path : %@", path);

NSImageView *winContent = [[NSImage alloc]  
initWithContentsOfFile:path];


[ appWindow setContentView: winContent];

NSLog(@"AppController::init : The windows content has been set");

return self;

}

I can see all the logs. But not the image in back ground of my app  
window.

Am I doing any thing wrong in this code?

Regards
Cocoa.learner.


On Tue, May 26, 2009 at 11:12 PM, Nick Zitzmann  
 wrote:




On May 26, 2009, at 11:04 AM, cocoa learner wrote:

How to draw background image in my app window?




You could change the window's content view using -setContentView:  
to a view
that will draw a background image, such as NSImageView... Of  
course, if you
have any other controls in the content view that is being replaced,  
then

they'll be lost.

Nick Zitzmann
<http://www.chronosnet.com/>







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com

This email sent to ag...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-30 Thread cocoa learner
Thanx Nick for your reply.But in my window I am not getting the image I want
to display. Here is my code -

- (id) init

{

[super init];

NSLog(@"AppController::init : Setting the windows content");

NSBundle *myBundle = [NSBundle mainBundle];

if (myBundle == NULL)

{

NSLog(@"AppController::init : myBundle is NULL");

}

else

{

NSLog(@"AppController::init : myBundle is not NULL");

}

 NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];

 NSLog(@"AppController::init : Image file path : %@", path);

NSImageView *winContent = [[NSImage alloc] initWithContentsOfFile:path];

 [ appWindow setContentView: winContent];

 NSLog(@"AppController::init : The windows content has been set");

return self;

}

I can see all the logs. But not the image in back ground of my app window.
Am I doing any thing wrong in this code?

Regards
Cocoa.learner.


On Tue, May 26, 2009 at 11:12 PM, Nick Zitzmann  wrote:

>
> On May 26, 2009, at 11:04 AM, cocoa learner wrote:
>
>  How to draw background image in my app window?
>>
>
> You could change the window's content view using -setContentView: to a view
> that will draw a background image, such as NSImageView... Of course, if you
> have any other controls in the content view that is being replaced, then
> they'll be lost.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>
>
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to draw background image in my app window

2009-05-26 Thread Nick Zitzmann


On May 26, 2009, at 11:04 AM, cocoa learner wrote:


How to draw background image in my app window?


You could change the window's content view using -setContentView: to a  
view that will draw a background image, such as NSImageView... Of  
course, if you have any other controls in the content view that is  
being replaced, then they'll be lost.


Nick Zitzmann
<http://www.chronosnet.com/>





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to draw background image in my app window

2009-05-26 Thread cocoa learner
Hi all,
How to draw background image in my app window?

I have found a way but not sure whether that's correct. So here is my way of
doing -

1>. Get a window from IB Library.
2>. Drag NSImage item from IB Library on window.
3>. Make it the size of window.
4>. Now drag and drop the NSTextField to the window.

And I am done with the desired job.

Is it a correct way of doing things???

If wrong then please guide me to achieve the goal.

Regards
Cocoa.learner.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Setting A Background Image On A Window

2008-12-10 Thread Michael Ash
On Wed, Dec 10, 2008 at 4:47 PM, Neil <[EMAIL PROTECTED]> wrote:
> I've googled around and poked at the documentation in Xcode, but I can't
> seem to find any references to this.  I'm trying to do something like
> setBackgroundColor, but instead of picking a color, I want to pick an image.
>
> The end goal is to program an emulator for a small medical device like an
> insulin pump; so the background of the window would be an image of the
> device, and then I'd put some buttons and fields and such on top.

Create a borderless NSImageView or a basic NSView subclass with
appropriate code in drawRect: and make it fill the window. Then either
send it to the back of all your other views (if you're requiring
10.5+) or make all of your other views subviews of this view (if you
need 10.4 compatibility or otherwise run into trouble with the other
approach) and there you go.

Brandon's idea of using +colorWithPatternImage: is a good one too. The
two approaches have different upsides and downsides, this is just an
alternative.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Setting A Background Image On A Window

2008-12-10 Thread Brandon Walkin
Try making an NSColor from your image using +colorWithPatternImage:,  
and set that color object on the window using -setBackgroundColor:.


On 10-Dec-08, at 4:47 PM, Neil wrote:

I've googled around and poked at the documentation in Xcode, but I  
can't seem to find any references to this.  I'm trying to do  
something like setBackgroundColor, but instead of picking a color, I  
want to pick an image.


The end goal is to program an emulator for a small medical device  
like an insulin pump; so the background of the window would be an  
image of the device, and then I'd put some buttons and fields and  
such on top.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/bwalkin%40gmail.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Setting A Background Image On A Window

2008-12-10 Thread Neil
I've googled around and poked at the documentation in Xcode, but I  
can't seem to find any references to this.  I'm trying to do something  
like setBackgroundColor, but instead of picking a color, I want to  
pick an image.


The end goal is to program an emulator for a small medical device like  
an insulin pump; so the background of the window would be an image of  
the device, and then I'd put some buttons and fields and such on top.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Animating frame width on UIButton with background image

2008-11-13 Thread Bryan Hansen
Is it possible to animate the width of a UIButton of  
UIButtonStyleCustom type? I have an animation on frame size which  
works fine when the UIButton is a UIButtonTypeRoundedRect. But has no  
visible affect when I am using a UIButtonStyleCustom with background  
image. I am trying to use a background image that has  
stretchableImageWithLeftCapWidth, but I have also noticed that a  
normal UIImage as the background fails to animate as well. My  
animation code is here:


[UIView beginAnimations:nil context:@"MyAnimation"];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.25];
CGRect tempFrame = myButton.frame;
tempFrame.size.width = tempFrame.size.width + 100.0f;
myButton.frame = tempFrame;
[UIView commitAnimations];

Thanks for the help!
Bryan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-07 Thread Mike R. Manzano
Do you know if SVG in a webkit view performs faster than a PDF in an  
NSImageView?


Mike
On Apr 6, 2008, at 3:38 PM, glenn andreas wrote:

If only there were some sort of Scalable Vector Graphics format that  
were available, oh, yeah, there is - SVG is available via WebKit on  
Leopard, not to mention a number of editors that include SVG support  
(including the open source InkScape)...


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-06 Thread Ricky Sharp


On Apr 6, 2008, at 3:30 PM, Mike R. Manzano wrote:

It's a shame there isn't a more lightweight technology than  
Illustrator/PDF that lets you easily draw vector UI elements in a  
graphical editor with your application's performance in mind.



I create all my artwork with Illustrator and save to PDF.  One of the  
main things I do while authoring is to simply all paths to contain the  
minimal amount of control points.  After saving to PDF, I then run it  
through an optimization process to remove any PDF meta-data:


PDFDocument* thePDFDocument = [[[PDFDocument alloc]  
initWithData:theFileData] autorelease];


NSData* theData = [thePDFDocument dataRepresentation];

I then use NSFileManager's createFileAtPath:contents:attributes: to  
just write out the PDF data to the same file.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-06 Thread glenn andreas


On Apr 6, 2008, at 3:30 PM, Mike R. Manzano wrote:

The bottom gradient is curved so it'd be a bit more difficult to do  
it with CTGradient, which does linear and radial gradients only.  
Regardless, I've abandoned this PDF and opted for a much simpler  
design that uses CTGradient and beziers like you've suggested. A  
side-effect is that I get better control of scaling. For example,  
the "reflection" at the top of the gradient now only scales on the x- 
axis instead of both axes.


It's a shame there isn't a more lightweight technology than  
Illustrator/PDF that lets you easily draw vector UI elements in a  
graphical editor with your application's performance in mind.


Hey, sounds like an opportunity for someone to make some money :)



If only there were some sort of Scalable Vector Graphics format that  
were available, oh, yeah, there is - SVG is available via WebKit on  
Leopard, not to mention a number of editors that include SVG support  
(including the open source InkScape)...


And SVG includes support for things like gradients and some pretty  
cool effects, and being XML based, you can even do special  
"transforms" to handle special cases...





Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
quadrium2 | build, mutate, evolve, animate  | images, textures,  
fractals, art



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-06 Thread Mike R. Manzano
The bottom gradient is curved so it'd be a bit more difficult to do it  
with CTGradient, which does linear and radial gradients only.  
Regardless, I've abandoned this PDF and opted for a much simpler  
design that uses CTGradient and beziers like you've suggested. A side- 
effect is that I get better control of scaling. For example, the  
"reflection" at the top of the gradient now only scales on the x-axis  
instead of both axes.


It's a shame there isn't a more lightweight technology than  
Illustrator/PDF that lets you easily draw vector UI elements in a  
graphical editor with your application's performance in mind.


Hey, sounds like an opportunity for someone to make some money :)

Mike


On Apr 6, 2008, at 11:41 AM, Kyle Sluder wrote:


On Sun, Apr 6, 2008 at 6:41 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:
This works well with lightweight PDF, but apparently not for  
complex one.


I'm concerned as to why this PDF is so complicated in the first place.
What's being drawn is actually really simple.  Four bezier paths to
draw the frame of the sticky note (filled with an NSGradient), and
then an NSGradient with a separate composite operation to draw the
highlighted portion.  If not live resizing, do this in -drawRect and
then save the bitmap representation in an ivar.  If live resizing,
scale the cached version and draw that until the live resize is
completed.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/alephx01%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-06 Thread Kyle Sluder
On Sun, Apr 6, 2008 at 6:41 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:
>  This works well with lightweight PDF, but apparently not for complex one.

I'm concerned as to why this PDF is so complicated in the first place.
 What's being drawn is actually really simple.  Four bezier paths to
draw the frame of the sticky note (filled with an NSGradient), and
then an NSGradient with a separate composite operation to draw the
highlighted portion.  If not live resizing, do this in -drawRect and
then save the bitmap representation in an ivar.  If live resizing,
scale the cached version and draw that until the live resize is
completed.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-06 Thread Jean-Daniel Dupas


Le 6 avr. 08 à 10:50, Heinrich Giesen a écrit :


Hi,
your PDF image is a beast, its size is 624 kB and contains a lot of  
complicated structures.
I converted the PDF into an equivalent (same size and with alpha)  
PNG-file with only 28 kB.
But that is only important for the first drawing where an NSImage  
with only one representation
(NSPDFImageRep) is created and rendered. For the following drawings  
there is not a big difference.


In  your code you use:

[gStickyImage setCacheMode:NSImageCacheNever] ;


This is deadly and makes it slow, because rendering starts from  
scratch, the PDF-file, not from the NSImage object.


For a sharp (not pixelated) image you need to setDataRetained:YES.  
This is explained in the docs

(NSImage -> -setDataRetained: ) and was discussed alot in this list.

Using Jean-Daniel's code snippet as a starting point I tried this  
with success (sharp and fast):


- (void)drawRect:(NSRect)aRect {
  if (!gSticky) {
gSticky = [NSImage imageNamed:@"sticky"];
[gSticky setDataRetained:YES];
  }

  [gSticky drawInRect:[self bounds] fromRect:NSZeroRect
  operation:NSCompositeSourceOver fraction:1];
}

You may also set the imageInterpolation to NSImageInterpolationHigh,  
but only if

you are not in the state of "inLiveResize"

   Heinrich


The main advantage of PDF (and vector graphic in general) is that  
there should not be any interpolation. By using PNG, you lose all  
benefits of resolution independant graphics.
This works well with lightweight PDF, but apparently not for complex  
one.


As suggested, the way to go is probably to ignore pixelisation during  
resizing, and when the resizing is over, recreate a cache image from  
the PDF rep. I don't know the best way to do it, but this should  
probably works:


[NSImage setScalesWhenResized:YES];
[NSImage setSize:finalSizeAfterResizing];


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-06 Thread Heinrich Giesen


Hi,
your PDF image is a beast, its size is 624 kB and contains a lot of  
complicated structures.
I converted the PDF into an equivalent (same size and with alpha) PNG- 
file with only 28 kB.
But that is only important for the first drawing where an NSImage  
with only one representation
(NSPDFImageRep) is created and rendered. For the following drawings  
there is not a big difference.


In  your code you use:

[gStickyImage setCacheMode:NSImageCacheNever] ;


This is deadly and makes it slow, because rendering starts from  
scratch, the PDF-file, not from the NSImage object.


For a sharp (not pixelated) image you need to setDataRetained:YES.  
This is explained in the docs

(NSImage -> -setDataRetained: ) and was discussed alot in this list.

Using Jean-Daniel's code snippet as a starting point I tried this  
with success (sharp and fast):


- (void)drawRect:(NSRect)aRect {
   if (!gSticky) {
 gSticky = [NSImage imageNamed:@"sticky"];
 [gSticky setDataRetained:YES];
   }

   [gSticky drawInRect:[self bounds] fromRect:NSZeroRect
   operation:NSCompositeSourceOver fraction:1];
}

You may also set the imageInterpolation to NSImageInterpolationHigh,  
but only if

you are not in the state of "inLiveResize"

Heinrich

--
Heinrich Giesen
[EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Mike R. Manzano
Looks like the key difference was that I was using  
operation:NSCompositeSourceAtop instead of NSCompositeSourceOver. For  
whatever reason, it doesn't pixelate with NSCompositeSourceOver.


Unfortunately, it's still slow. I guess I'll have to go back to the  
drawing board on the PDF.


Thanks for all the help!

Mike

On Apr 5, 2008, at 5:18 PM, Jean-Daniel Dupas wrote:

That's strange. When I'm doing this, it scale properly (but it's  
slow).


- (void)drawRect:(NSRect)aRect {
 if (!gSticky) {
   gSticky = [[NSImage imageNamed:@"sticky"] retain];
   [gSticky setCacheMode:NSImageCacheNever];
 }

 NSRect src = NSMakeRect(0, 0, [gSticky size].width, [gSticky  
size].height);
 [gSticky drawInRect:[self bounds] fromRect:src  
operation:NSCompositeSourceOver fraction:1];

}

It look like this pdf is rather heavy to draw. Even when I open it  
in Preview (on a 2.2 Ghz Core 2 Duo) it need some times to display it.


Le 6 avr. 08 à 01:45, Mike R. Manzano a écrit :
Unfortunately, that still didn't work. The resultant images  
continue to be pixelated, as you can see here:


http://instantvoodoomagic.com/stickycapture.png

In my window's -awakeFromNib:

gStickyImage = [NSImage imageNamed:@"sticky.pdf"] ;
	[gStickyImage setDataRetained:YES] ; // Setting this to NO doesn't  
seem to make a difference

[gStickyImage setCacheMode:NSImageCacheNever] ;

In -drawRect:

NSRect stickyBounds ;
// [gStickyImage setScalesWhenResized:YES] ;
// [gStickyImage setSize:[self bounds].size] ;
stickyBounds.size = [gStickyImage size] ;
stickyBounds.origin.x = stickyBounds.origin.y = 0.0f ;
[gStickyImage   drawInRect:[self bounds]
fromRect:stickyBounds
operation:NSCompositeSourceAtop
fraction:1.0f] ;

If I uncomment the two lines in -drawRect:, the sticky is rendered  
sharply, but as I noted before, it takes a long time to scale:


http://instantvoodoomagic.com/stickycapture2.png

Here's the original PDF:

http://instantvoodoomagic.com/sticky.pdf

Thanks for the suggestions so far. If I figure it out, I'll post my  
solution.


Mike


On Apr 5, 2008, at 11:59 AM, Jean-Daniel Dupas wrote:

This is because Cocoa cache the first representation it draws and  
then redraw the cached version.


Disabling the cache for your image should do the trick:

[_img setCacheMode:NSImageCacheNever];

Le 5 avr. 08 à 20:26, Mike R. Manzano a écrit :
I did try that at first, but the image becomes pixelated when you  
make the window larger. What I'm trying now is to do an initial  
scale of the image to some large dimensions, and then doing what  
you suggested. Maybe it will look fine if the only scaling it has  
to do is in the downwards direction.


Mike



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Ben Lachman

On Apr 5, 2008, at 8:28 PM, Quincey Morris wrote:


On Apr 5, 2008, at 16:45, Mike R. Manzano wrote:

Unfortunately, that still didn't work. The resultant images  
continue to be pixelated, as you can see here:


http://instantvoodoomagic.com/stickycapture.png



IIRC this came up on the list a couple of weeks ago. You need to  
set the interpolation quality in the graphics context to  
NSImageInterpolationHigh because the default value of "low" just  
replicates pixels.





The other thing you might want to do for speed is draw differently  
based on whether or not you are in a live resize.  Use -inLiveResize  
to check in your drawRect: and possibly set the interpolation to low  
during a resize and high at other times.


->Ben

--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Quincey Morris


On Apr 5, 2008, at 16:45, Mike R. Manzano wrote:

Unfortunately, that still didn't work. The resultant images continue  
to be pixelated, as you can see here:


http://instantvoodoomagic.com/stickycapture.png



IIRC this came up on the list a couple of weeks ago. You need to set  
the interpolation quality in the graphics context to  
NSImageInterpolationHigh because the default value of "low" just  
replicates pixels.


I'm saying this from what I remember of that interchange, so there may  
be more details I've forgotten.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Jean-Daniel Dupas

That's strange. When I'm doing this, it scale properly (but it's slow).

- (void)drawRect:(NSRect)aRect {
  if (!gSticky) {
gSticky = [[NSImage imageNamed:@"sticky"] retain];
[gSticky setCacheMode:NSImageCacheNever];
  }

  NSRect src = NSMakeRect(0, 0, [gSticky size].width, [gSticky  
size].height);
  [gSticky drawInRect:[self bounds] fromRect:src  
operation:NSCompositeSourceOver fraction:1];

}

It look like this pdf is rather heavy to draw. Even when I open it in  
Preview (on a 2.2 Ghz Core 2 Duo) it need some times to display it.


Le 6 avr. 08 à 01:45, Mike R. Manzano a écrit :
Unfortunately, that still didn't work. The resultant images continue  
to be pixelated, as you can see here:


http://instantvoodoomagic.com/stickycapture.png

In my window's -awakeFromNib:

gStickyImage = [NSImage imageNamed:@"sticky.pdf"] ;
	[gStickyImage setDataRetained:YES] ; // Setting this to NO doesn't  
seem to make a difference

[gStickyImage setCacheMode:NSImageCacheNever] ;

In -drawRect:

NSRect stickyBounds ;
// [gStickyImage setScalesWhenResized:YES] ;
// [gStickyImage setSize:[self bounds].size] ;
stickyBounds.size = [gStickyImage size] ;
stickyBounds.origin.x = stickyBounds.origin.y = 0.0f ;
[gStickyImage   drawInRect:[self bounds]
fromRect:stickyBounds
operation:NSCompositeSourceAtop
fraction:1.0f] ;

If I uncomment the two lines in -drawRect:, the sticky is rendered  
sharply, but as I noted before, it takes a long time to scale:


http://instantvoodoomagic.com/stickycapture2.png

Here's the original PDF:

http://instantvoodoomagic.com/sticky.pdf

Thanks for the suggestions so far. If I figure it out, I'll post my  
solution.


Mike


On Apr 5, 2008, at 11:59 AM, Jean-Daniel Dupas wrote:

This is because Cocoa cache the first representation it draws and  
then redraw the cached version.


Disabling the cache for your image should do the trick:

[_img setCacheMode:NSImageCacheNever];

Le 5 avr. 08 à 20:26, Mike R. Manzano a écrit :
I did try that at first, but the image becomes pixelated when you  
make the window larger. What I'm trying now is to do an initial  
scale of the image to some large dimensions, and then doing what  
you suggested. Maybe it will look fine if the only scaling it has  
to do is in the downwards direction.


Mike



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Mike R. Manzano
Unfortunately, that still didn't work. The resultant images continue  
to be pixelated, as you can see here:


http://instantvoodoomagic.com/stickycapture.png

In my window's -awakeFromNib:

gStickyImage = [NSImage imageNamed:@"sticky.pdf"] ;
	[gStickyImage setDataRetained:YES] ; // Setting this to NO doesn't  
seem to make a difference

[gStickyImage setCacheMode:NSImageCacheNever] ;

In -drawRect:

NSRect stickyBounds ;
// [gStickyImage setScalesWhenResized:YES] ;
// [gStickyImage setSize:[self bounds].size] ;
stickyBounds.size = [gStickyImage size] ;
stickyBounds.origin.x = stickyBounds.origin.y = 0.0f ;
[gStickyImage   drawInRect:[self bounds]
fromRect:stickyBounds
operation:NSCompositeSourceAtop
fraction:1.0f] ;

If I uncomment the two lines in -drawRect:, the sticky is rendered  
sharply, but as I noted before, it takes a long time to scale:


http://instantvoodoomagic.com/stickycapture2.png

Here's the original PDF:

http://instantvoodoomagic.com/sticky.pdf

Thanks for the suggestions so far. If I figure it out, I'll post my  
solution.


Mike


On Apr 5, 2008, at 11:59 AM, Jean-Daniel Dupas wrote:

This is because Cocoa cache the first representation it draws and  
then redraw the cached version.


Disabling the cache for your image should do the trick:

[_img setCacheMode:NSImageCacheNever];

Le 5 avr. 08 à 20:26, Mike R. Manzano a écrit :
I did try that at first, but the image becomes pixelated when you  
make the window larger. What I'm trying now is to do an initial  
scale of the image to some large dimensions, and then doing what  
you suggested. Maybe it will look fine if the only scaling it has  
to do is in the downwards direction.


Mike



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Jean-Daniel Dupas
This is because Cocoa cache the first representation it draws and then  
redraw the cached version.


Disabling the cache for your image should do the trick:

[_img setCacheMode:NSImageCacheNever];

Le 5 avr. 08 à 20:26, Mike R. Manzano a écrit :

I did try that at first, but the image becomes pixelated when you  
make the window larger. What I'm trying now is to do an initial  
scale of the image to some large dimensions, and then doing what you  
suggested. Maybe it will look fine if the only scaling it has to do  
is in the downwards direction.


Mike


On Apr 5, 2008, at 11:17 AM, Jean-Daniel Dupas wrote:



Le 5 avr. 08 à 19:53, Mike R. Manzano a écrit :

Hi everyone,

I have a window with a custom content view. The content view loads  
in a PDF image to be used as the window's background. I'd like the  
image to scale smoothly when the window is resized, so I set the  
source image to scale when resized (scalesWhenResized returns  
YES), and in my -drawRect: method, I'm setting the size of the  
image to the bounds of the view. This works exactly as I intended,  
except that it's really slow.


Is there a better way to do this that's much, much faster?

Thanks,

Mike



Do not manually resize your image and use -[NSImage  
drawInRect:fromRect:operation:fraction:] passing [self bounds] as  
first argument, and let the system resize the image as needed


You can also replace your custom view by a NSImageView.







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Mike R. Manzano
I did try that at first, but the image becomes pixelated when you make  
the window larger. What I'm trying now is to do an initial scale of  
the image to some large dimensions, and then doing what you suggested.  
Maybe it will look fine if the only scaling it has to do is in the  
downwards direction.


Mike


On Apr 5, 2008, at 11:17 AM, Jean-Daniel Dupas wrote:



Le 5 avr. 08 à 19:53, Mike R. Manzano a écrit :

Hi everyone,

I have a window with a custom content view. The content view loads  
in a PDF image to be used as the window's background. I'd like the  
image to scale smoothly when the window is resized, so I set the  
source image to scale when resized (scalesWhenResized returns YES),  
and in my -drawRect: method, I'm setting the size of the image to  
the bounds of the view. This works exactly as I intended, except  
that it's really slow.


Is there a better way to do this that's much, much faster?

Thanks,

Mike



Do not manually resize your image and use -[NSImage  
drawInRect:fromRect:operation:fraction:] passing [self bounds] as  
first argument, and let the system resize the image as needed


You can also replace your custom view by a NSImageView.







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-05 Thread Jean-Daniel Dupas


Le 5 avr. 08 à 19:53, Mike R. Manzano a écrit :

Hi everyone,

I have a window with a custom content view. The content view loads  
in a PDF image to be used as the window's background. I'd like the  
image to scale smoothly when the window is resized, so I set the  
source image to scale when resized (scalesWhenResized returns YES),  
and in my -drawRect: method, I'm setting the size of the image to  
the bounds of the view. This works exactly as I intended, except  
that it's really slow.


Is there a better way to do this that's much, much faster?

Thanks,

Mike



Do not manually resize your image and use -[NSImage  
drawInRect:fromRect:operation:fraction:] passing [self bounds] as  
first argument, and let the system resize the image as needed


You can also replace your custom view by a NSImageView.





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Scaling a window background image quickly

2008-04-05 Thread Mike R. Manzano

Hi everyone,

I have a window with a custom content view. The content view loads in  
a PDF image to be used as the window's background. I'd like the image  
to scale smoothly when the window is resized, so I set the source  
image to scale when resized (scalesWhenResized returns YES), and in my  
-drawRect: method, I'm setting the size of the image to the bounds of  
the view. This works exactly as I intended, except that it's really  
slow.


Is there a better way to do this that's much, much faster?

Thanks,

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]