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 6627111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:58:27+00:00 2026-05-25T21:58:27+00:00

I have a custom NSView that is used for displaying a background color. This

  • 0

I have a custom NSView that is used for displaying a background color. This works. However, I have shadows in that image that are not preserved.

All transparent or semi-transparent areas of the image are rendered as black. How do I fix this?

- (void)drawRect:(NSRect)dirtyRect {
    NSColor *pattern = [NSColor colorWithPatternImage:[NSImage imageNamed:@"bg"]];
    [pattern setFill];
    NSRectFill(dirtyRect);
}

Thanks.

  • 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-05-25T21:58:27+00:00Added an answer on May 25, 2026 at 9:58 pm

    NSRectFill() is a shortcut for NSRectFillUsingOperation(rect, NSCompositeCopy). This means that it won’t composite the color’s alpha channel with the background, it simply draws the source color in the rectangle you pass in. Instead, you should use:

    NSRectFillUsingOperation(rect, NSCompositeSourceOver);
    

    The NSCompositeSourceOver compositing operation will display the source image wherever the source image is opaque and the destination image elsewhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSStatusItem that has an NSMenuItem which contains a custom NSView. this
I have a custom NSView which contains a subview—for the purposes of solving this
I have custom SiteMapProvider and RoleProvider that works together properly: IsAccessibleToUser returns false if
I have a custom NSView subclass that I want to animate with Core Animation.
I have a custom NSView that lives inside of a NSScrollView that is in
I have a custom NSView which used to get created in a NIB and
I am writing a custom NSView subclass. I have several instances of this class
I have a layer-hosting view set up like this in a custom NSView subclass:
I want to change the background color of a custom view. I have a
I have a window which has a custom NSView and has a bottom bar

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.