• 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
Re: Filling View With Pattern Image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filling View With Pattern Image


  • Subject: Re: Filling View With Pattern Image
  • From: Chunk 1978 <email@hidden>
  • Date: Fri, 19 Jun 2009 04:32:33 -0400

thanks Florian.  i'll be sure to use your helpful code for my mac
programming. :)

On Fri, Jun 19, 2009 at 4:27 AM, Florian Soenens<email@hidden> wrote:
> You will have to do it programmatically but it's pretty easy stuff.
> This should do the trick nicely:
>
> -(void)drawBackgroundPattern
> {
>        // Suppose backgroundPatternImage is a valid reference to your
> pattern image
>
>        NSRect rect = [self frame];
>
>        float width = rect.size.width;
>        float height = rect.size.height;
>
>        float bgWidth = [backgroundPatternImage size].width;
>        float bgHeight = [backgroundPatternImage size].height;
>        float xPos = 0;
>        float yPos = height - bgHeight;
>
>        while(yPos >= 0 - bgHeight)
>        {
>                while (xPos < width)
>                {
>                        NSRect drawRect = NSMakeRect(xPos, yPos, bgWidth,
> bgHeight);
>                        [backgroundPatternImage drawInRect:drawRect
> fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
>                        xPos += bgWidth;
>                }
>                xPos = 0;
>                yPos -= bgHeight;
>        }
> }
>
> -(void)drawRect:(NSRect)aRect
> {
>        [self drawBackgroundPattern];
> }
>
> hth,
> Florian.
>
> On 19 Jun 2009, at 10:14, Chunk 1978 wrote:
>
>> i have this image ("image.png") that i would like to tile throughout
>> the view...
>>
>> i've read the Quartz 2D programming guide... ok, ok, i breezed thru
>> it, i admit... but i couldn't seem to find an easy way of repeating an
>> image through out a view without actually drawing the image
>> programatically...
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>
>
>
> Looking for Web-to-Print Solutions?
> Visit our website :   http://www.vit2print.com
>
>
> This e-mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information and/or information protected by intellectual
> property rights.
> If you are not the intended recipient, please note that any review,
> dissemination, disclosure, alteration, printing, copying or transmission of
> this e-mail and/or any file transmitted with it, is strictly prohibited and
> may be unlawful.
> If you have received this e-mail by mistake, please immediately notify the
> sender and permanently delete the original as well as any copy of any e-mail
> and any printout thereof.
> We may monitor e-mail to and from our network.
>
> NSS nv Tieltstraat 167 8740 Pittem
> Belgium_______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Filling View With Pattern Image (From: Chunk 1978 <email@hidden>)
 >Re: Filling View With Pattern Image (From: Florian Soenens <email@hidden>)

  • Prev by Date: Re: Filling View With Pattern Image
  • Next by Date: Search field in ABPeoplePickerView
  • Previous by thread: Re: Filling View With Pattern Image
  • Next by thread: Search field in ABPeoplePickerView
  • Index(es):
    • Date
    • Thread