GithubHelp home page GithubHelp logo

davidmr001 / gcanvas Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alibaba/gcanvas

0.0 1.0 0.0 2.62 MB

License: Apache License 2.0

Ruby 0.05% Java 27.06% Python 0.02% Objective-C 1.82% JavaScript 41.88% Vue 0.57% C++ 8.23% C 19.53% Makefile 0.04% GLSL 0.22% Objective-C++ 0.34% CSS 0.15% HTML 0.08%

gcanvas's Introduction

GCanvas

GCanvas is a cross-platform rendering engine for mobile devices developed by Taobao. It is written with C++ based on OpenGL ES, so it can provide high performance 2D/WebGL rendering capabilities for Javascript runtime. It also has browser-like canvas APIs, so it's very convinent and flexiable for use, espcially for web developers.

Supported operating systems are Android 4.0+ (API 14) and iOS 8.0+.

Features

  • Cross-platform, support popular iOS and Android.
  • High performance, accelerate graphic draw by OpenGL ES.
  • Provide javascript runtime, such as Weex and ReactNative. convenient to use Javascript API like HTML canvas.
  • Scalable Architecture, easy to implement a GCanvas bridge by yourself following the guide Custom Native Bridge .
  • Small size.

Introduction

See the Introduction to GCanvas for a detailed introduction to GCanvas.

Getting Started

Weex

Follow Weex Setup Guide to integrate GCanvas on Weex

ReactNative

Follow ReactNative Setup Guide to integrate GCanvas on ReactNative.

Javascript

Try our Playground. GCanvas has browser-like canvas APIs, so almost all of the APIs are exactly same as HTML5 canvas. At this moment, we have already supported 90% of 2D APIs and 99% of WebGL APIs. You can find out those informations in 2D APIs and WebGL APIs.

Documentation

Check Documentation for more information.

Examples

We take Weex as example, code snippet of context 2d using GCanvas.

import { enable, WeexBridge, Image as GImage } from "../../../../js/src/index.js";

var gcanvas = enable(this.$refs.canvas_holder, {bridge: WeexBridge});
var ctx = gcanvas.getContext("2d");
//rect
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 100, 100);

//rect
ctx.fillStyle = 'black';
ctx.fillRect(100, 100, 100, 100);
ctx.fillRect(25, 210, 700, 5);

//circle
ctx.arc(450, 200, 100, 0, Math.PI * 2, true);
ctx.fill();

var image = new GImage();
image.src = 'https://gw.alicdn.com/tfs/TB1KwRTlh6I8KJjy0FgXXXXzVXa-225-75.png';
image.onload = function(){
  ctx.drawImage(image, 100, 300);
};

Built With

  • Freetype - Used for font rendering on Android

Open Issues

If you encounter a bug with GCanvas we would like to hear about it. Search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of GCanvas and OS you’re using. Please include a stack trace and reduced repro case when appropriate, too.

Contributing

Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.

Authors

GCanvas Open Source Team

License

This project is licensed under the Apache License - see the LICENSE file for details

gcanvas's People

Contributors

alibaba-oss avatar freedtice avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.