demoadda.com

300,000+ members

our android apps in store

demoAdda.com is a community of 3.00 lakh programmers and students, just like you, helping each other. Join them; it only takes a minute: Sign Up

Free Download Canvasview (Draw in canvas) Demo in Android.


15 Reviews
4.5

929

7

1


Android development tutorial with demos and sample codes. Here you can download Android demo code for your projects and tutorial helpful for learning Android development. Canvasview (Draw in canvas)demo with simple code example development in Android. Download Canvasview (Draw in canvas) source code with screen shot and video tutorials. Android Example Source Code. Android tutorial for beginners youtube video. Android sample basic example tutorial for learning beginners and experiences developer.


Demo Category


Android

Download

Asp .net

Download

C# .net

Download

IPhone

Download

Java Servlet

Download

Javascript jquery

Download

Python

Download

Vb .net

Download

implement Canvasview (Draw in canvas) in Android programmatically.

Simple Canvasview (Draw in canvas) example with screen shots. android , demo , canvas , canvasview , drawimage in canvas , draw circle in canvas , set background . Canvasview (Draw in canvas) this demo development by kishan.




My Favorites Demo

1 favorited



Canvasview (Draw in canvas) demo overviews.


Title : Canvasview (Draw in canvas)
Submit by : kishan
Programming Language : Android
Posting Date : 2015-04-09 06:12:28
Demo Type : mobile
Demo Tag : android , demo , canvas , canvasview , drawimage in canvas , draw circle in canvas , set background
Viewed : 929
No of download : 7

submit your project source code ...

Download Demo Here (2.8602MB)

share your demo click to upload your code



Canvasview (Draw in canvas) Demo Description.

Here is the demo for canvas drawing in android you can do this following things by canvas. 

API

Undo / Redo / Clear

this.canvas.undo();   // Undo
this.canvas.redo();   // Redo
this.canvas.clear();  // Clear canvas

Mode

The application that use this library has 3 states.

// Setter
this.canvas.setMode(CanvasView.Mode.DRAW);    // for drawing
this.canvas.setMode(CanvasView.Mode.TEXT);    // for drawing Text
this.canvas.setMode(CanvasView.Mode.ERASER);  // for using Eraser

// Getter
CanvasView.Mode mode = this.canvas.getMode();

Drawer

This libarary enable to draw Figures.

// Setter
this.canvas.setDrawer(CanvasView.Drawer.PEN);               // Use Pen Tool
this.canvas.setDrawer(CanvasView.Drawer.LINE);              // Draw Line
this.canvas.setDrawer(CanvasView.Drawer.RECTANGLE);         // Draw Rectangle
this.canvas.setDrawer(CanvasView.Drawer.CIRCLE);            // Draw Circle
this.canvas.setDrawer(CanvasView.Drawer.ELLIPSE);           // Draw Ellipse (Oval)
this.canvas.setDrawer(CanvasView.Drawer.QUADRATIC_BEZIER);  // Draw Quadratic Bezier

// Getter
CanvasView.Drawer drawer = this.canvas.getDrawer();

Background color

// Setter
this.canvas.setBaseColor(Color.WHITE);

// Getter
int backgroundColor = this.canvas.getBaseColor();

Stroke Style

// Setter
this.canvas.setPaintStyle(Paint.Style.STROKE);
this.canvas.setPaintStyle(Paint.Style.FILL);
this.canvas.setPaintStyle(Paint.Style.FILL_AND_STROKE);

// Getter
Paint.Style strokeStyle = this.canvas.getPaintStyle();

Stroke Color

// Setter
this.canvas.setPaintStrokeColor(Color.RED);

// Getter
int color = this.canvas.getPaintStrokeColor();

Stroke Width

// Setter
this.canvas.setPaintStrokeWidth(2F);

// Getter
float strokeWidth = this.canvas.getPaintStrokeWidth();

Alpha (Opacity)

// Setter
this.canvas.setOpacity(128);  // between 0 and 255

// Getter
int opacity = this.canvas.getOpacity();

Blur

// Setter
this.canvas.setBlur(5F);  // greater than or equal to 0

// Getter 
float blur = this.canvas.getBlur();

Line Cap

// Setter
this.canvas.setLineCap(Paint.Cap.BUTT);
this.canvas.setLineCap(Paint.Cap.ROUND);
this.canvas.setLineCap(Paint.Cap.SQUARE);

// Getter
Paint.Cap lineCap = this.canvas.getLineCap();

Draw Text

// Change Mode
this.canvas.setMode(CanvasView.Mode.TEXT);

// Setter
this.canvas.setText("Canvas View");

// Getter
String text = this.canvas.getText();

Font Family / Font Size

// Setter
this.canvas.setFontFamily(Typeface.DEFAULT);
this.canvas.setFontFamily(Typeface.DEFAULT_BOLD);
this.canvas.setFontFamily(Typeface.SANS_SERIF);
this.canvas.setFontFamily(Typeface.SERIF);
this.canvas.setFontFamily(Typeface.MONOSPACE);
this.canvas.setFontSize(24F);  // greater than or equal to 0

// Getter
Typeface fontFamily = this.canvas.getFontFamily();
float fontSize      = this.canvas.getFontSize();

Get Canvas as Bitmap

If application requires to save current canvas as Bitmap, the following methods enable to save.

Bitmap bitmap = this.canvas.getBitmap();

In the case of adjusting size,

Bitmap bitmap = this.canvas.getScaleBitmap(300, 200);  // 300 x 200

In the case of using byte array of bitmap,

// The 1st argument is format.
// The 2nd argument is quality.
byte[] bytes = this.canvas.getBitmapAsByteArray(CompressFormat.PNG, 100);

or,

// Format is PNG. Quality is 100.
byte[] bytes = this.canvas.getBitmapAsByteArray();

In the case of using the specific bitmap,

// ....

byte[] bytes = CanvasView.getBitmapAsByteArray(bitmap, CompressFormat.PNG, 100);

Draw Bitmap to Canvas

From Bitmap,

// ....

this.canvas.drawBitmap(bitmap);

, From byte array of bitmap

// ....

this.canvas.drawBitmap(bytes);


Download Latest Android Demo Source Code


YouTube Intro Video Play inside App in Android

4.5

This Demo plays YouTube video inside your app. You can show Intro video of your app directly from YouTube using this demo. Also can play any YouTube videos using this demo.... view more

YouTube Player, VideoPlayer, Video Streaming

Android demo   hardikmaru2001 2017-03-10

Show Case View in Android

4.5

         This is showcase-view demo, it can be used as a walk through for the entire screen that is currently visible, Or just for one view on the screen         add this in your /build.gradle and dependency in your /app//build.gradleal... view more

android

Android demo   dharap404 2017-02-10

Emoji Keyboard in Android

4.5

      Hello, This is Emoji-keyboard demo using this you can open emoji keyboard in your app and also use your device default emoji keyboard also add this library dependency in your gradle dependencies { compile 'hani.momanii.supernova_emoji_li... view more

android

Android demo   dharap404 2017-02-03

Crop Image in Android

4.5

       Hello, This is demo for crop image using library add dependency in your gradle dependencies { compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'} Add CropImageActivity into your AndroidManifest.xml Start CropImageAc... view more

android

Android demo   dharap404 2017-02-03

ValidationLibrary in Android

4.5

     Hello, This is Validation Demo using library and you need to add dependency  in your gradle file dependencies { compile 'com.basgeekball:awesome-validation:1.3'}// Step 1: designate a style AwesomeValidation mAwesome... view more

android

Android demo   dharap404 2017-02-03