コード例 #1
0
ファイル: BrushSection.cs プロジェクト: daddycoding/Eto
 void SetItem(BrushItem item)
 {
     brush = item.Brush;
     if (matrixRow != null)
     {
         matrixRow.Table.Visible = item.SupportsMatrix;
     }
     gradientRow.Table.Visible = item.SupportsGradient;
 }
コード例 #2
0
        public CreateAnimationDrawer(Context c, BrushItem brush, Canvas canvas, Bitmap myBmp, bool tooAdd = false, int cell = 1, string DrawerState = "brush_selection", Path pathToUse = null)
            : base(c)
        {
            myBitmap = myBmp;
            myCanvas = canvas;
            DrawerStateInternal = DrawerState;
            addOnly = tooAdd;
            status = 0;
            myPath = new Path();
            myPaint = new Paint(PaintFlags.Dither);
            myPaint.AntiAlias = true;
            myPaint.Dither = true;
            myPaint.SetStyle(Paint.Style.Stroke);
            myPaint.StrokeJoin = Paint.Join.Round;
            myPaint.StrokeWidth = brush.Thickness;
            myPaint.StrokeCap = Paint.Cap.Round;
            myPaint.SetARGB(colorUtil.a, colorUtil.r, colorUtil.g, colorUtil.b);

            if (brush.BrushType == AnimationTypesBrushType.Spray)
                myPaint.SetShadowLayer(brush.Thickness, 0, 0, ImageHelper.convWZColorToColor(brush.BrushColor));

            if (DrawerState == "brush_selection")
            {
                if (pathToUse != null)
                {
                    myBoundsPaint = new Paint();
                    myBoundsPaint = new Paint(PaintFlags.Dither);
                    myBoundsPaint.AntiAlias = true;
                    myBoundsPaint.Dither = true;
                    myBoundsPaint.SetStyle(Paint.Style.Stroke);
                    myBoundsPaint.StrokeJoin = Paint.Join.Round;
                    myBoundsPaint.StrokeWidth = 10f;
                    myBoundsPaint.StrokeCap = Paint.Cap.Round;
                    myBoundsPaint.SetARGB(255, 0, 0, 0);
                    myBoundsPaint.SetPathEffect(new DashPathEffect(new float[]
                    {
                        10f,
                        20f
                    }, 0));

                    myPath = pathToUse;
                    AnimationUtil.theCanvas.DrawPath(myPath, myPaint);
                    AnimationUtil.theCanvas.DrawPath(myPath, myPaint);

                    myBoundsRect = new RectF();
                    myPath.ComputeBounds(myBoundsRect, true);
                    AnimationUtil.theCanvas.DrawRect(myBoundsRect, myBoundsPaint);
                }
            }
        }
コード例 #3
0
ファイル: BrushSection.cs プロジェクト: yaram/Eto
        void SetItem(BrushItem item)
        {
            selectedItem = item;
            if (item == null)
            {
                item = new BrushItem();
            }

            SuspendLayout();             // for winforms
            if (matrixRow != null)
            {
                matrixRow.Table.Visible = item.SupportsMatrix;
            }
            gradientRow.Table.Visible = item.SupportsGradient;
            radialRow.Table.Visible   = radiusRow.Table.Visible = item.SupportsRadial;
            linearRow.Table.Visible   = item.SupportsLinear;
            Refresh();
            ResumeLayout();
        }
コード例 #4
0
ファイル: BrushSection.cs プロジェクト: picoe/Eto
		void SetItem(BrushItem item)
		{
			selectedItem = item;
			if (item == null)
				item = new BrushItem();

			SuspendLayout(); // for winforms
			if (matrixRow != null)
				matrixRow.Table.Visible = item.SupportsMatrix;
			gradientRow.Table.Visible = item.SupportsGradient;
			radialRow.Table.Visible = radiusRow.Table.Visible = item.SupportsRadial;
			linearRow.Table.Visible = item.SupportsLinear;
			Refresh();
			ResumeLayout();
		}
コード例 #5
0
        private void Initialize()
        {
            this.Background = Color.White;

            this.Brush = new BrushItem (4f, BrushType.Normal, UIColor.Black.CGColor);

            /*this.imgDrawDisplay = new ImageView(this);
            imgDrawDisplay,
            this.imgDrawDisplay.ContentMode = UIViewContentMode.ScaleAspectFit;
            this.imgDrawDisplay.BackgroundColor = UIColor.Clear;

            this.AddSubview(this.imgDrawDisplay);

            this.currentPath = new UIBezierPath();
            this.currentPath.LineCapStyle = CGLineCap.Round;
            this.currentPath.LineJoinStyle = CGLineJoin.Round;*/

            currentPath = new Path ();

            this.ClearsContextBeforeDrawing = false;
            this.userDraw = true;

            this.inactiveColor = new Color ((byte)InactiveColorValues [0],
                                           (byte)InactiveColorValues [1],
                                           (byte)InactiveColorValues [2],
                                           (byte)InactiveColorValues [3]);

            this.inactiveImageColor = new Color ((byte)InactiveImageColorValues [0],
                                                (byte)InactiveImageColorValues [1],
                                                (byte)InactiveImageColorValues [2],
                                                (byte)InactiveImageColorValues [3]);

            this.inactiveTextColor = Color.LightGray;
        }
コード例 #6
0
 public void SetBrush(BrushItem brushItem)
 {
     this.Brush = brushItem;
 }
コード例 #7
0
ファイル: BrushSection.cs プロジェクト: pcdummy/Eto
 void SetItem(BrushItem item)
 {
     this.brush = item.Brush;
     matrixRow.Table.Visible   = item.SupportsMatrix;
     gradientRow.Table.Visible = item.SupportsGradient;
 }
コード例 #8
0
ファイル: BrushSection.cs プロジェクト: gene-l-thomas/Eto
		void SetItem(BrushItem item)
		{
			brush = item.Brush;
			if (matrixRow != null)
				matrixRow.Table.Visible = item.SupportsMatrix;
			gradientRow.Table.Visible = item.SupportsGradient;
		}
コード例 #9
0
ファイル: BrushSection.cs プロジェクト: JohnACarruthers/Eto
		void SetItem(BrushItem item)
		{
			this.brush = item.Brush;
			matrixRow.Table.Visible = item.SupportsMatrix;
			gradientRow.Table.Visible = item.SupportsGradient;
		}
コード例 #10
0
 private void brush_Clicked(object s, EventArgs e)
 {
     ImageView image = (ImageView)s;
     int tag = (int)image.Tag;
     Bitmap brush = null;
     byte[] myArray = null;
     switch (tag)
     {
         case 1:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush1))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(4f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, myArray);
             break;
         case 2:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush2))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(6f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, myArray);
             break;
         case 3:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush3))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(8f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, myArray);
             break;
         case 4:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush4))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(10f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, myArray);
             break;
         case 5:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush5))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(12f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, myArray);
             break;
         case 6:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush6))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(14f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, myArray);
             break;
         case 10:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.SoftBrush1))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(4f, AnimationTypesBrushType.Spray, currentColor, inactiveColor, myArray);
             break;
         case 11:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.SoftBrush2))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(6f, AnimationTypesBrushType.Spray, currentColor, inactiveColor, myArray);
             break;
         case 12:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.SoftBrush3))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(8f, AnimationTypesBrushType.Spray, currentColor, inactiveColor, myArray);
             break;
         case 13:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.SoftBrush4))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(10f, AnimationTypesBrushType.Spray, currentColor, inactiveColor, myArray);
             break;
         case 14:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.SoftBrush5))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(12f, AnimationTypesBrushType.Spray, currentColor, inactiveColor, myArray);
             break;
         case 15:
             using (brush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.SoftBrush6))
             {
                 MemoryStream stream = new MemoryStream();
                 brush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                 myArray = stream.ToArray();
             }
             currentBrush = new BrushItem(14f, AnimationTypesBrushType.Spray, currentColor, inactiveColor, myArray);
             break;
     }
     brushImage = myArray;
     drawer.Close();
 }
コード例 #11
0
        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];
        }
コード例 #12
0
 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;
     }
 }