• 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: How to determine a single pixels alpha?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to determine a single pixels alpha?


  • Subject: Re: How to determine a single pixels alpha?
  • From: Brian Hook <email@hidden>
  • Date: Sun, 30 Sep 2001 16:30:37 -0700

unsigned char *pPixel = &pixels[ aPoint.x * 4 + aPoint.y * 4 * imageWidth ];

There's one too many multiplies in the code above.

int
pixIndex = 4 * (y*(int)imageSize.width+x);

Er, it works out the same (you've factored out the multiply by 4).

x * 4 + y * 4 * width = 4 * ( x + y*width)

Now, if "Width" is in bytes instead of pixels, there would be one too many multiplies.

Brian


References: 
 >Re: How to determine a single pixels alpha? (From: Brian Hook <email@hidden>)
 >Re: How to determine a single pixels alpha? (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: How to determine a single pixels alpha?
  • Next by Date: Re: How to determine a single pixels alpha?
  • Previous by thread: Re: How to determine a single pixels alpha?
  • Next by thread: Re: How to determine a single pixels alpha?
  • Index(es):
    • Date
    • Thread