Пример #1
0
        public DrawingInfo(int drawingID, List<PointF> pathPoints, BrushItem brush, WZColor lineColor)
        {
            this.DrawingID = drawingID;
            this.Brush = brush;
            this.LineColor = lineColor;
            this.PathPoints = pathPoints ?? new List<PointF>();

            this.DrawingType = DrawingLayerType.Drawing;
        }
Пример #2
0
        //        public BrushItem (float thickness, BrushType brushType, CGColor brushColor)
        //        {
        //            this.Thickness = thickness;
        //            this.BrushType = brushType;
        //            this.BrushColor = brushColor;
        //
        //            if (this.BrushType == BrushType.Spray)
        //            {
        //
        //                this.IsSprayBrushActive = true;
        //
        //            }//end if
        //
        //            this.inactiveColor = new CGColor(DrawingCanvasViewEx.InactiveColorValues[0],
        //                                             DrawingCanvasViewEx.InactiveColorValues[1],
        //                                             DrawingCanvasViewEx.InactiveColorValues[2],
        //                                             DrawingCanvasViewEx.InactiveColorValues[3]);
        //
        //        }
        public BrushItem(float thickness, AnimationTypesBrushType brushType, WZColor brushColor, WZColor inactiveBrushColor, byte[] brushImage)
        {
            this.Thickness = thickness;
            this.BrushType = brushType;
            this.BrushColor = brushColor;
            this.BrushImageBuffer = brushImage;

            if (this.BrushType == AnimationTypesBrushType.Spray)
            {
                this.IsSprayBrushActive = true;
            }//end if

            this.InactiveBrushColor = inactiveBrushColor;
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LOLApp_iOS.DrawingInfo"/> class.
        /// </summary>
        /// <param name='drawingID'>
        /// Drawing I.
        /// </param>
        /// <param name='contentPackItemID'>
        /// Content pack item I.
        /// </param>
        /// <param name='drType'>
        /// Drawing layer type. Only for Callouts, Stamps and Comix.
        /// </param>
        public DrawingInfo(int drawingID, int contentPackItemID, DrawingLayerType drType, byte[] image, RectangleF imageFrame, WZColor textColor)
        {
            if (drType != DrawingLayerType.Callout &&
                drType != DrawingLayerType.Comix &&
                drType != DrawingLayerType.Stamp)
            {

                throw new ArgumentException("When initializing a DrawingInfo item with this constructor, drType must represent a content pack item!", "drType");

            }//end if

            this.DrawingID = drawingID;
            this.ContentPackItemID = contentPackItemID;
            this.DrawingType = drType;
            this.ImageBuffer = image;
            this.ImageFrame = imageFrame;
            this.LineColor = textColor;

            this.PathPoints = new List<PointF>();
        }
Пример #4
0
 public void ChangeBrushImageColor(WZColor toColor, byte[] imageBrush)
 {
     this.BrushColor = toColor;
     if (this.BrushType == AnimationTypesBrushType.Spray)
     {
     //				this.pBrushImage = this.GetBrushImageWithColor(this.BrushImage, toColor);
         this.BrushImageBuffer = imageBrush;
     }//end if
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CreateAnimation);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);
            Header.headertext = Application.Context.Resources.GetString(Resource.String.animationTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            ImageButton imgUndo = FindViewById<ImageButton>(Resource.Id.imgUndo);
            ImageButton imgStamp = FindViewById<ImageButton>(Resource.Id.imgStamp);
            ImageButton imgPaint = FindViewById<ImageButton>(Resource.Id.imgPaint);
            ImageButton imgColour = FindViewById<ImageButton>(Resource.Id.imgColour);
            ImageButton imgText = FindViewById<ImageButton>(Resource.Id.imgText);
            ImageButton imgComix = FindViewById<ImageButton>(Resource.Id.imgComix);
            ImageButton imgSound = FindViewById<ImageButton>(Resource.Id.imgSound);
            ImageButton imgPicture = FindViewById<ImageButton>(Resource.Id.imgPicture);
            ImageButton imgConfig = FindViewById<ImageButton>(Resource.Id.imgConfig);
            ImageButton imgPlayAnimation = FindViewById<ImageButton>(Resource.Id.imgPlayAnimation);
            ImageButton btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
            drawer = FindViewById<SlidingDrawer>(Resource.Id.slidingDrawer1);
            sliderToggle = FindViewById<Button>(Resource.Id.handle);
            context = header.Context;

            brushImage = null;

            relLay = FindViewById<RelativeLayout>(Resource.Id.relativeLayout2);
            relLay.LayoutParameters = new LinearLayout.LayoutParams((int)wowZapp.LaffOutOut.Singleton.ScreenXWidth,
                (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth);

            if (AnimationUtil.imagesForCanvas == null)
                AnimationUtil.imagesForCanvas = new List<Bitmap>();

            if (currentColor == null)
            {

                currentColor = new WZColor(ImageHelper.convColToByteArray(Color.Black));
                inactiveColor = new WZColor(ImageHelper.convColToByteArray(Color.Gray));
                colorUtil.color = ImageHelper.convWZColorToColor(currentColor);
            }

            if (currentBrush == null)
            {
                using (Bitmap myBrush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush1))
                {
                    MemoryStream stream = new MemoryStream();
                    myBrush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                    brushImage = stream.ToArray();
                    currentBrush = new BrushItem(4f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, brushImage);
                }
            }

            myBitmap = Bitmap.CreateBitmap((int)wowZapp.LaffOutOut.Singleton.ScreenXWidth,
                                            (int)wowZapp.LaffOutOut.Singleton.ScreenYHeight / 2 /*- (int)ImageHelper.convertDpToPixel (320f, context)*/, Bitmap.Config.Argb8888);
            AnimationUtil.imagesForCanvas.Add(myBitmap);
            canvas = new Canvas(myBitmap);

            if (AnimationUtil.theImage == null)
                AnimationUtil.theImage = new Dictionary<int, List<ImageAttr>>();
            if (AnimationUtil.imgAttr == null)
                AnimationUtil.imgAttr = new List<ImageAttr>();
            AnimationUtil.imgAttr.Add(new ImageAttr());
            AnimationUtil.currentImage = 0;

            relLay.AddView(new CreateAnimationDrawer(context, currentBrush, canvas, myBitmap));

            if (AudioItems == null || AudioItems.Count == 0)
                AudioItems = new Dictionary<int, AnimationAudioInfo>();

            CurrentLayer = new FrameLayerPair(1, 1);

            dbm = LaffOutOut.Singleton.dbm;

            drawerState = false;

            btnBack.Click += delegate
            {
                SaveAnimation();
                Finish();
            };

            btnHome.Click += delegate
            {
                Intent i = new Intent(this, typeof(Main.HomeActivity));
                i.SetFlags(ActivityFlags.ClearTop);
                StartActivity(i);
            };

            imgUndo.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgStamp.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgPaint.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgColour.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgText.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgComix.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgSound.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgPicture.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgConfig.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};

            imgPlayAnimation.Click += delegate
            {
                Intent m = new Intent(this, typeof(PlayAnimation));
                StartActivity(m);
            };
            modalPicture = new ImageView(context);
            percents = new TextView[4];
            colours = new ImageView[2];
        }
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     string filename = string.Empty;
     switch (requestCode)
     {
         case CAMERA:
             if (resultCode == Result.Ok)
             {
                 filename = data.GetStringExtra("filename");
                 if (!string.IsNullOrEmpty(filename))
                 {
                     displayPhoto(AnimationUtil.theCanvas, filename);
                 }
             }
             break;
         case CAMERA_RESOURCE:
             if (resultCode == Result.Ok)
             {
                 filename = getRealPathFromUri(data.Data);
                 if (!string.IsNullOrEmpty(filename))
                 {
                     displayPhoto(AnimationUtil.theCanvas, filename);
                 }
             }
             break;
         case COMIX:
         case STAMP:
         case TEXT:
             if (AnimationUtil.result)
             {
                 filename = AnimationUtil.contentFilename;
                 AnimationUtil.result = false;
                 if (!string.IsNullOrEmpty(filename))
                 {
                     Bitmap newBitmap = BitmapFactory.DecodeFile(AnimationUtil.contentFilename);
                     //canvas.DrawBitmap(newBitmap, 100, 100, null);
                     AnimationUtil.imagesForCanvas.Add(newBitmap);
                     AnimationUtil.currentImage++;
                     AnimationUtil.imgAttr [AnimationUtil.currentImage].attr = new System.Drawing.PointF(100, 100);
                     relLay.AddView(new CreateAnimationDrawer(context, currentBrush, canvas, newBitmap, true));
                 }
             }
             break;
         case COLOR:
             if (resultCode == Result.Ok)
             {
                 currentColor = new WZColor(ImageHelper.convColToByteArray(colorUtil.color));
                 currentBrush = new BrushItem(currentBrush.Thickness, currentBrush.BrushType, currentColor, inactiveColor, brushImage);
             }
             break;
     }
 }