Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:13:39+00:00 2026-06-06T12:13:39+00:00

I want replicate the effect obtained by the following CSS code: background: white url(./img/background.png)

  • 0

I want replicate the effect obtained by the following CSS code:

background: white url(./img/background.png) no-repeat;

I’ve written a subclass of NSView and override drawRect in this way:

- (void)drawRect:(NSRect)dirtyRect
{
    dirtyRect = [self bounds];

    [[NSColor whiteColor] setFill];
    NSRectFill(dirtyRect);

    [[NSColor colorWithPatternImage:[NSImage imageNamed:@"background.png"]] setFill];
    NSRectFill(dirtyRect);
}

(I apologize for my bad english)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:13:41+00:00Added an answer on June 6, 2026 at 12:13 pm

    Take a look at NSImage class reference. Image can be drawn with drawInRect:fromRect:operation:fraction: and also with drawAtPoint:fromRect:operation:fraction:.

    So You can Use this:

    [[NSImage imageNamed:@"background.png"] drawInRect:dirtyRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1]; // Passing NSZeroRect causes the entire image to draw. 
    

    Instead this:

    [[NSColor colorWithPatternImage:[NSImage imageNamed:@"background.png"]] setFill];
        NSRectFill(dirtyRect);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to replicate the following c code in python ctypes: main() { long
this is the sas code which i want to replicate in R, proc fastclus
Basically I want to replicate the page changing effect found here, at http://timvandamme.com/ But
I don't want to replicate code across overloaded constructors as below. How do I
Assuming I have the following html div which I want to replicate its children,
So, I want to be able to replicate the effect seen on bing.com. When
I wonder if someone can help me. I want to replicate the following SQL
I use the following code to summarize my data, grouped by Compound, Replicate and
I want to replicate the following html using razor syntax: <a href=index.html data-description=I Want
I want to replicate the the whole div multiple no of times(i.e; on A4

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.