MCPcopy Index your code
hub / github.com/alibaba/GCanvas

github.com/alibaba/GCanvas @1.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.2.0 ↗ · + Follow
6,347 symbols 15,826 edges 1,068 files 1,158 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GCanvas

GCanvas is a cross-platform rendering engine for mobile devices developed by Alibaba. 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 convenient and flexiable for use, especially for web developers.

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

Distribution

GCanvas

  • iOS GCanvas CocoaPods Version

  • Android com.taobao.gcanvas:core:1.1.0(publishing)

GCanvas Weex Component

  • iOS WeexGcanvas CocoaPods Version

  • Android com.taobao.gcanvas.bridges:weex-brigde 1.1.0 (publishing)

GCanvas NPM Package

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

We will continue to maintain the C++ core engine. And will no further update and support WeexReactNative and JS bridge.

Node

Follow Node Guide, use GCanvas in Node.js.

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 "@gcanvas/core";

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

Changelog

New Changelog record in CHANGELOG for details.

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

Extension points exported contracts — how you extend this code

IGImageLoader (Interface)
An Image loader that loads url into bitmap. Will replace it with C++ image library. @author ertong [6 implementers]
android/adapters/bridge_adapter/src/main/java/com/taobao/gcanvas/adapters/img/IGImageLoader.java
Reader (Interface)
Implementations of this interface can decode an image of a barcode in some format into the String it encodes. For exampl [16 …
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/Reader.java
IJSCallbackDataFactory (Interface)
Factory for creating Callback data structures. @author ertong [4 implementers]
android/bridge_spec/src/main/java/com/taobao/gcanvas/bridges/spec/bridge/IJSCallbackDataFactory.java
Listener (Interface)
(no doc) [1 implementers]
android/gcanvas_library/src/main/java/com/taobao/gcanvas/GCanvasResult.java
Writer (Interface)
The base class for all objects which encode/generate a barcode image. @author dswitkin@google.com (Daniel Switkin) [34 …
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/Writer.java
IJSCallbackArray (Interface)
Communications between Javascript runtime and native are container dependent. Different environment has different standa [4 …
android/bridge_spec/src/main/java/com/taobao/gcanvas/bridges/spec/bridge/IJSCallbackArray.java
MultipleBarcodeReader (Interface)
Implementation of this interface attempt to read several barcodes from one image. @see com.google.zxing.Reader @author [6 …
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/multi/MultipleBarcodeReader.java
IJSCallbackMap (Interface)
Communications between Javascript runtime and native are container dependent. Different environment has different sta [4 …
android/bridge_spec/src/main/java/com/taobao/gcanvas/bridges/spec/bridge/IJSCallbackMap.java

Core symbols most depended-on inside this repo

append
called by 546
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/client/android/encode/ContactEncoder.java
parseInt
called by 332
node/binding/CanvasRenderingContextWebGL.cc
get
called by 263
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/common/BitArray.java
format
called by 255
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/client/android/encode/Formatter.java
push
called by 244
bridges/weex-gcanvas/android/weex_playground/src/main/java/com/alibaba/weex/WXPageActivity.java
size
called by 243
android/bridge_spec/src/main/java/com/taobao/gcanvas/bridges/spec/bridge/IJSCallbackArray.java
isEmpty
called by 140
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/qrcode/encoder/MatrixUtil.java
add
called by 138
bridges/weex-gcanvas/android/weex_playground/src/main/java_zxing/com/google/zxing/oned/EANManufacturerOrgSupport.java

Shape

Method 4,092
Function 1,244
Class 900
Enum 92
Interface 19

Languages

Java47%
C++42%
TypeScript11%

Modules by API surface

core/test/linux/util/lodepng.cc250 symbols
core/src/gcanvas/GWebglContext.cpp157 symbols
core/src/gcanvas/GCanvas2dContext.cpp150 symbols
core/src/webgl/GCommandDecoderWebGL.cpp100 symbols
node/examples/webgl/glcubeTexture.js96 symbols
node/binding/cairo/CairoCanvasRenderingContext2d.cc96 symbols
core/src/2d/GCommandDecoder2D.cpp60 symbols
core/src/GCanvasWeex.cpp59 symbols
core/src/gcanvas/GL/GShader.h53 symbols
packages/gcanvas/src/context/2d/RenderingContext.js49 symbols
core/src/platform/Linux/FontTool.hpp48 symbols
bridges/weex-gcanvas/android/weex_playground/src/main/java/com/alibaba/weex/WXPageActivity.java45 symbols

For agents

$ claude mcp add GCanvas \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact