Beispiel #1
0
        public void DrawPath(Cell cell, Rectangle pathRect, Point direction, CellColor color)
        {
            mContext.DrawImage(pathRect, UIImageEx.GetImageWithOverlayColor(mPathImage, color.UIColor).CGImage);

            // The old drawing code for perfect paths
//			context.SetFillColor (color.UIColor.CGColor);

            // Draw in 2 parts:
            // First a rect
//			context.FillRect (pathRect);
//
//			// Then an arc to the end
//			if (direction.X < 0) {
//				context.MoveTo (pathRect.Right, pathRect.Top);
//				context.AddCurveToPoint (
//					pathRect.Right + pathRect.Width / 3,
//					pathRect.Top + pathRect.Height / 3,
//					pathRect.Right + pathRect.Width / 3,
//					pathRect.Top + 2 * pathRect.Height / 3,
//					pathRect.Right,
//					pathRect.Bottom
//					);
//			} else if (direction.X > 0) {
//				context.MoveTo (pathRect.Left, pathRect.Top);
//				context.AddCurveToPoint (
//					pathRect.Left - pathRect.Width / 3,
//					pathRect.Top + pathRect.Height / 3,
//					pathRect.Left - pathRect.Width / 3,
//					pathRect.Top + 2 * pathRect.Height / 3,
//					pathRect.Left,
//					pathRect.Bottom
//					);
//			}
//			if (direction.Y < 0) {
//				context.MoveTo (pathRect.Left, pathRect.Bottom);
//				context.AddCurveToPoint (
//					pathRect.Left + pathRect.Width / 3,
//					pathRect.Bottom + pathRect.Height / 3,
//					pathRect.Left + 2 * pathRect.Width / 3,
//					pathRect.Bottom + pathRect.Height / 3,
//					pathRect.Right,
//					pathRect.Bottom
//					);
//			} else if (direction.Y > 0) {
//				context.MoveTo (pathRect.Left, pathRect.Top);
//				context.AddCurveToPoint (
//					pathRect.Left + pathRect.Width / 3,
//					pathRect.Top - pathRect.Height / 3,
//					pathRect.Left + 2 * pathRect.Width / 3,
//					pathRect.Top - pathRect.Height / 3,
//					pathRect.Right,
//					pathRect.Top
//					);
//			}
//
//			context.FillPath ();
        }
Beispiel #2
0
        public void DrawCellBase(Cell cell)
        {
            bool      isValid   = cell.Path != null && cell.Path.IsValid;
            CellColor cellColor = cell.Color;

            if (cell.Path != null)
            {
                cellColor = cell.Path.Color;
            }

            CGColor color = cellColor.UIColor.CGColor;

            mContext.SetFillColor(color);

            if (mParent.ShouldDisplayFilledCells == false)
            {
                // Draw a circle of the color
                // But reduce the circle value
                int circleReductionValue = mParent.CellSize / 10;

                RectangleF cellValueRect = new RectangleF(cell.Rect.X + circleReductionValue, cell.Rect.Y + circleReductionValue, mParent.CellSize - 2 * circleReductionValue, mParent.CellSize - 2 * circleReductionValue);

                UIImage image = null;

                if (isValid == false)
                {
                    image = mSplashImage;

                    image = UIImageEx.GetImageWithOverlayColor(image, cellColor.UIColor);

                    mContext.DrawImage(cellValueRect, image.CGImage);
                }
                else
                {
                    mContext.FillRect(cell.Rect);
                }
            }
            else
            {
                // Fill the whole cell to preview puzzle
                mContext.FillRect(cell.Rect);
            }
        }