0

I have some difficulties in Swift, Xcode I have drawn UIView which has transparent background and I need to calculate the percentage of drawn area in UIView, any ideas? I only know the way by reviewing each cgpoint and getting the value of alpha

1 Answers1

0

Here are the steps to do this :

  1. Go through the each pixel of the UIView
  2. calculate colour of that pixel
  3. Then compare that colour to Black colour Here is the example for retrieving the colour from the pixel : How to get the color of a pixel in an UIView?
Community
  • 1
  • 1
V-Xtreme
  • 7,230
  • 9
  • 39
  • 79