├── .gitignore
├── LICENSE
├── README.md
├── TouchVGView.js
├── android
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ ├── com
│ │ └── cloudwebrtc
│ │ │ └── TouchVG
│ │ │ ├── RCTTouchVGPackage.java
│ │ │ ├── RCTTouchVGView.java
│ │ │ ├── TouchVGModule.java
│ │ │ └── TouchVGView.java
│ └── rhcad
│ │ └── touchvg
│ │ ├── Const.java
│ │ ├── IGraphView.java
│ │ ├── IViewHelper.java
│ │ ├── ViewFactory.java
│ │ ├── core
│ │ ├── Box2d.java
│ │ ├── Chars.java
│ │ ├── CmdObserver.java
│ │ ├── CmdObserverDefault.java
│ │ ├── CmdSubject.java
│ │ ├── ConstShapes.java
│ │ ├── Floats.java
│ │ ├── GiCanvas.java
│ │ ├── GiColor.java
│ │ ├── GiContext.java
│ │ ├── GiCoreView.java
│ │ ├── GiCoreViewData.java
│ │ ├── GiGestureState.java
│ │ ├── GiGestureType.java
│ │ ├── GiGraphics.java
│ │ ├── GiHandleTypes.java
│ │ ├── GiPlayShapes.java
│ │ ├── GiPlaying.java
│ │ ├── GiSaveClipBox.java
│ │ ├── GiSaveModelTransform.java
│ │ ├── GiTransform.java
│ │ ├── GiView.java
│ │ ├── Ints.java
│ │ ├── Longs.java
│ │ ├── Matrix2d.java
│ │ ├── MgActionDispatcher.java
│ │ ├── MgArc.java
│ │ ├── MgBaseLines.java
│ │ ├── MgBaseRect.java
│ │ ├── MgBaseShape.java
│ │ ├── MgCmdArc3P.java
│ │ ├── MgCmdArcCSE.java
│ │ ├── MgCmdArcTan.java
│ │ ├── MgCmdCompass.java
│ │ ├── MgCmdDrawRect.java
│ │ ├── MgCmdManager.java
│ │ ├── MgCmdManagerFactory.java
│ │ ├── MgCmdSector.java
│ │ ├── MgCommand.java
│ │ ├── MgCommandDraw.java
│ │ ├── MgComposite.java
│ │ ├── MgContextAction.java
│ │ ├── MgCoreShapeFactory.java
│ │ ├── MgCoreView.java
│ │ ├── MgDiamond.java
│ │ ├── MgDot.java
│ │ ├── MgEllipse.java
│ │ ├── MgFindImageCallback.java
│ │ ├── MgGestureState.java
│ │ ├── MgGrid.java
│ │ ├── MgGroup.java
│ │ ├── MgHandleType.java
│ │ ├── MgHitResult.java
│ │ ├── MgImageShape.java
│ │ ├── MgJsonFile.java
│ │ ├── MgJsonStorage.java
│ │ ├── MgLayer.java
│ │ ├── MgLine.java
│ │ ├── MgLines.java
│ │ ├── MgMotion.java
│ │ ├── MgObject.java
│ │ ├── MgOptionCallback.java
│ │ ├── MgParallel.java
│ │ ├── MgPath.java
│ │ ├── MgPathNode.java
│ │ ├── MgPathShape.java
│ │ ├── MgRecordShapes.java
│ │ ├── MgRect.java
│ │ ├── MgRegenLocker.java
│ │ ├── MgRoundRect.java
│ │ ├── MgSelDrawFlags.java
│ │ ├── MgSelState.java
│ │ ├── MgSelection.java
│ │ ├── MgShape.java
│ │ ├── MgShapeBit.java
│ │ ├── MgShapeDoc.java
│ │ ├── MgShapeFactory.java
│ │ ├── MgShapeIterator.java
│ │ ├── MgShapeType.java
│ │ ├── MgShapes.java
│ │ ├── MgSnap.java
│ │ ├── MgSnapOptions.java
│ │ ├── MgSnapType.java
│ │ ├── MgSplines.java
│ │ ├── MgStorage.java
│ │ ├── MgStringCallback.java
│ │ ├── MgView.java
│ │ ├── Point2d.java
│ │ ├── RECT_2D.java
│ │ ├── Shapes.java
│ │ ├── TestCanvas.java
│ │ ├── Tol.java
│ │ ├── Vector2d.java
│ │ ├── mgbase.java
│ │ ├── mgcurv.java
│ │ ├── mglnrel.java
│ │ ├── mgnear.java
│ │ ├── touchvg.java
│ │ └── touchvgJNI.java
│ │ ├── package-info.java
│ │ └── view
│ │ ├── BaseGraphView.java
│ │ ├── CanvasAdapter.java
│ │ ├── SFGraphView.java
│ │ ├── StdGraphView.java
│ │ ├── ViewHelperImpl.java
│ │ ├── impl
│ │ ├── ContextHelper.java
│ │ ├── FileUtil.java
│ │ ├── Snapshot.java
│ │ └── ViewCreator.java
│ │ ├── internal
│ │ ├── BaseViewAdapter.java
│ │ ├── ContextAction.java
│ │ ├── GestureListener.java
│ │ ├── ImageCache.java
│ │ ├── LogHelper.java
│ │ ├── RecordRunnable.java
│ │ ├── ResourceUtil.java
│ │ ├── ShapeRunnable.java
│ │ ├── UndoRunnable.java
│ │ └── ViewUtil.java
│ │ └── package-info.java
│ ├── jniLibs
│ ├── android-support-v4.jar
│ ├── androidsvg-1.2.2-beta-1-2.jar
│ ├── armeabi-v7a
│ │ └── libtouchvg.so
│ └── x86
│ │ └── libtouchvg.so
│ └── res
│ ├── drawable-hdpi
│ ├── brush.png
│ ├── colorwheel.png
│ ├── ellipse.png
│ ├── eraser.png
│ ├── ic_launcher.png
│ ├── line.png
│ ├── rect.png
│ ├── select.png
│ ├── snapshot.png
│ ├── triangle.png
│ ├── vg_back.png
│ ├── vg_clone.png
│ ├── vg_delete.png
│ ├── vg_edit.png
│ ├── vg_endedit.png
│ ├── vg_fixlen.png
│ ├── vg_freelen.png
│ ├── vg_group.png
│ ├── vg_lock.png
│ ├── vg_overturn.png
│ ├── vg_selall.png
│ ├── vg_ungroup.png
│ ├── vg_unlock.png
│ ├── vgcen.png
│ ├── vgcross.png
│ ├── vgdot1.png
│ ├── vgdot2.png
│ ├── vgdot3.png
│ ├── vgmid.png
│ ├── vgnear.png
│ ├── vgnode.png
│ ├── vgparallel.png
│ ├── vgpivot.png
│ ├── vgquad.png
│ ├── vgredo.png
│ ├── vgtangent.png
│ └── vgundo.png
│ ├── drawable-mdpi
│ ├── brush.png
│ ├── colorwheel.png
│ ├── ellipse.png
│ ├── eraser.png
│ ├── ic_launcher.png
│ ├── line.png
│ ├── rect.png
│ ├── select.png
│ ├── snapshot.png
│ ├── triangle.png
│ ├── vg_back.png
│ ├── vg_clone.png
│ ├── vg_delete.png
│ ├── vg_edit.png
│ ├── vg_endedit.png
│ ├── vg_fixlen.png
│ ├── vg_freelen.png
│ ├── vg_group.png
│ ├── vg_lock.png
│ ├── vg_overturn.png
│ ├── vg_selall.png
│ ├── vg_ungroup.png
│ ├── vg_unlock.png
│ ├── vgcen.png
│ ├── vgcross.png
│ ├── vgdot1.png
│ ├── vgdot2.png
│ ├── vgdot3.png
│ ├── vgmid.png
│ ├── vgnear.png
│ ├── vgnode.png
│ ├── vgparallel.png
│ ├── vgpivot.png
│ ├── vgquad.png
│ ├── vgredo.png
│ ├── vgtangent.png
│ └── vgundo.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── drawable
│ ├── background.jpg
│ ├── background_repeat.xml
│ ├── brush.png
│ ├── demo_switch.png
│ ├── vg_translucent.png
│ └── vg_translucent_bg.xml
│ ├── layout
│ └── activity_main.xml
│ └── values
│ ├── dimens.xml
│ ├── strings.xml
│ ├── styles.xml
│ └── vg_action_captions.xml
├── index.js
├── ios
├── RCTTouchVG.xcodeproj
│ └── project.pbxproj
└── RCTTouchVG
│ ├── RCTTouchVGView.h
│ ├── RCTTouchVGView.m
│ ├── TouchVG
│ ├── LICENSE
│ ├── README.md
│ ├── TouchVG.bundle
│ │ ├── Info.plist
│ │ ├── en.lproj
│ │ │ └── Localizable.strings
│ │ ├── magnifier-mask@2x.png
│ │ ├── magnifier@2x.png
│ │ ├── translucent@2x.png
│ │ ├── vg_addvertex@2x.png
│ │ ├── vg_back@2x.png
│ │ ├── vg_clone@2x.png
│ │ ├── vg_delete@2x.png
│ │ ├── vg_delvertex@2x.png
│ │ ├── vg_edit@2x.png
│ │ ├── vg_endedit@2x.png
│ │ ├── vg_fixlen@2x.png
│ │ ├── vg_freelen@2x.png
│ │ ├── vg_group@2x.png
│ │ ├── vg_lock@2x.png
│ │ ├── vg_overturn@2x.png
│ │ ├── vg_selall@2x.png
│ │ ├── vg_ungroup@2x.png
│ │ ├── vg_unlock@2x.png
│ │ ├── vgcen@2x.png
│ │ ├── vgcross@2x.png
│ │ ├── vgdot1@2x.png
│ │ ├── vgdot2@2x.png
│ │ ├── vgdot3@2x.png
│ │ ├── vgmid@2x.png
│ │ ├── vgnear@2x.png
│ │ ├── vgnode@2x.png
│ │ ├── vgparallel@2x.png
│ │ ├── vgpivot@2x.png
│ │ ├── vgquad@2x.png
│ │ ├── vgtangent@2x.png
│ │ └── zh-Hans.lproj
│ │ │ └── Localizable.strings
│ ├── include
│ │ ├── ARCMacro.h
│ │ ├── GiCanvasAdapter.h
│ │ ├── GiPaintView.h
│ │ ├── GiPaintViewDelegate.h
│ │ ├── GiPaintViewXIB.h
│ │ ├── GiShapeAdapter.h
│ │ ├── GiViewEnums.h
│ │ ├── GiViewHelper+Layer.h
│ │ ├── GiViewHelper.h
│ │ └── NSString+Drawing.h
│ └── src
│ │ ├── GiCanvasAdapter.mm
│ │ ├── GiDpiUtil.mm
│ │ ├── GiImageCache.h
│ │ ├── GiImageCache.mm
│ │ ├── GiMagnifierView.h
│ │ ├── GiMagnifierView.m
│ │ ├── GiPaintView.mm
│ │ ├── GiPaintViewXIB.mm
│ │ ├── GiShapeAdapter.mm
│ │ ├── GiViewAdapter.mm
│ │ ├── GiViewHelper+Layer.mm
│ │ ├── GiViewHelper.mm
│ │ ├── GiViewImpl.h
│ │ └── NSString+Drawing.m
│ └── TouchVGCore
│ ├── LICENSE
│ ├── README.md
│ └── core
│ ├── include
│ ├── canvas
│ │ └── gicanvas.h
│ ├── cmd
│ │ ├── mgaction.h
│ │ ├── mgcmd.h
│ │ ├── mgcoreview.h
│ │ ├── mglocal.h
│ │ ├── mgselect.h
│ │ ├── mgsnap.h
│ │ └── mgview.h
│ ├── cmdbase
│ │ ├── mgcmddraw.h
│ │ ├── mgdrawarc.h
│ │ ├── mgdrawline.h
│ │ └── mgdrawrect.h
│ ├── cmdbasic
│ │ ├── cmdbasic.h
│ │ ├── mgdrawcircle.h
│ │ ├── mgdrawdiamond.h
│ │ ├── mgdrawellipse.h
│ │ ├── mgdrawfreelines.h
│ │ ├── mgdrawgrid.h
│ │ ├── mgdrawlines.h
│ │ ├── mgdrawparallel.h
│ │ ├── mgdrawpolygon.h
│ │ ├── mgdrawquadrangle.h
│ │ ├── mgdrawsplines.h
│ │ ├── mgdrawsquare.h
│ │ └── mgdrawtriang.h
│ ├── cmdmgr
│ │ ├── mgcmdmgr.h
│ │ └── mgcmdmgrfactory.h
│ ├── cmdobserver
│ │ ├── cmdobserver.h
│ │ └── cmdsubject.h
│ ├── export
│ │ ├── girecordcanvas.h
│ │ ├── girecordshape.h
│ │ └── svgcanvas.h
│ ├── geom
│ │ ├── mgbase.h
│ │ ├── mgbox.h
│ │ ├── mgcurv.h
│ │ ├── mgdef.h
│ │ ├── mglnrel.h
│ │ ├── mgmat.h
│ │ ├── mgnear.h
│ │ ├── mgpath.h
│ │ ├── mgpnt.h
│ │ ├── mgtol.h
│ │ └── mgvec.h
│ ├── graph
│ │ ├── gicolor.h
│ │ ├── gicontxt.h
│ │ ├── gigraph.h
│ │ ├── gilock.h
│ │ └── gixform.h
│ ├── gshape
│ │ ├── mgarc.h
│ │ ├── mgbasesp.h
│ │ ├── mgcshapes.h
│ │ ├── mgdiamond.h
│ │ ├── mgdot.h
│ │ ├── mgellipse.h
│ │ ├── mggrid.h
│ │ ├── mgline.h
│ │ ├── mglines.h
│ │ ├── mgobject.h
│ │ ├── mgparallel.h
│ │ ├── mgpathsp.h
│ │ ├── mgrdrect.h
│ │ ├── mgrect.h
│ │ ├── mgshape_.h
│ │ ├── mgshapetype.h
│ │ └── mgsplines.h
│ ├── jsonstorage
│ │ └── mgjsonstorage.h
│ ├── mglog.h
│ ├── mgstrcallback.h
│ ├── mgvector.h
│ ├── record
│ │ └── recordshapes.h
│ ├── shape
│ │ ├── mgbasicspreg.h
│ │ ├── mgbasicsps.h
│ │ ├── mgcomposite.h
│ │ ├── mgimagesp.h
│ │ ├── mgshape.h
│ │ ├── mgshapes.h
│ │ ├── mgshapet.h
│ │ └── mgspfactory.h
│ ├── shapedoc
│ │ ├── mglayer.h
│ │ ├── mgshapedoc.h
│ │ └── spfactoryimpl.h
│ ├── storage
│ │ └── mgstorage.h
│ ├── test
│ │ ├── RandomShape.h
│ │ └── testcanvas.h
│ └── view
│ │ ├── gicoreview.h
│ │ ├── gigesture.h
│ │ ├── gimousehelper.h
│ │ ├── giplaying.h
│ │ └── giview.h
│ └── src
│ ├── cmdbase
│ ├── mgcmddraw.cpp
│ ├── mgdrawarc.cpp
│ ├── mgdrawline.cpp
│ └── mgdrawrect.cpp
│ ├── cmdbasic
│ ├── cmdbasic.cpp
│ ├── mgcmderase.cpp
│ ├── mgcmderase.h
│ ├── mgdrawcircle.cpp
│ ├── mgdrawdiamond.cpp
│ ├── mgdrawellipse.cpp
│ ├── mgdrawfreelines.cpp
│ ├── mgdrawgrid.cpp
│ ├── mgdrawlines.cpp
│ ├── mgdrawparallel.cpp
│ ├── mgdrawpolygon.cpp
│ ├── mgdrawsplines.cpp
│ ├── mgdrawsquare.cpp
│ └── mgdrawtriang.cpp
│ ├── cmdmgr
│ ├── cmdsubject.cpp
│ ├── mgactions.cpp
│ ├── mgcmdmgr2.cpp
│ ├── mgcmdmgr_.cpp
│ ├── mgcmdmgr_.h
│ ├── mgcmdselect.cpp
│ ├── mgcmdselect.h
│ └── mgsnapimpl.cpp
│ ├── corever.h
│ ├── export
│ ├── girecordcanvas.cpp
│ ├── simple_svg.hpp
│ └── svgcanvas.cpp
│ ├── geom
│ ├── fitcurves.cpp
│ ├── mgbase.cpp
│ ├── mgbox.cpp
│ ├── mgcurv.cpp
│ ├── mgdblpt.h
│ ├── mglnrel.cpp
│ ├── mgmat.cpp
│ ├── mgnear.cpp
│ ├── mgnearbz.cpp
│ ├── mgpath.cpp
│ ├── mgpnt.cpp
│ ├── mgvec.cpp
│ └── nanosvg.cpp
│ ├── graph
│ ├── gigraph.cpp
│ ├── gigraph_.h
│ ├── giplclip.h
│ └── gixform.cpp
│ ├── gshape
│ ├── mgarc.cpp
│ ├── mgarccross.cpp
│ ├── mgbasesp.cpp
│ ├── mgcshapes.cpp
│ ├── mgdiamond.cpp
│ ├── mgdot.cpp
│ ├── mgellipse.cpp
│ ├── mggrid.cpp
│ ├── mgline.cpp
│ ├── mglines.cpp
│ ├── mgparallel.cpp
│ ├── mgpathsp.cpp
│ ├── mgrdrect.cpp
│ ├── mgrect.cpp
│ └── mgsplines.cpp
│ ├── jsonstorage
│ ├── mgjsonstorage.cpp
│ ├── rapidjson
│ │ ├── document.h
│ │ ├── filestream.h
│ │ ├── internal
│ │ │ ├── pow10.h
│ │ │ ├── stack.h
│ │ │ └── strfunc.h
│ │ ├── prettywriter.h
│ │ ├── rapidjson.h
│ │ ├── reader.h
│ │ ├── stringbuffer.h
│ │ └── writer.h
│ ├── utf8_core.h
│ └── utf8_unchecked.h
│ ├── record
│ └── recordshapes.cpp
│ ├── shape
│ ├── mgbasicspreg.cpp
│ ├── mgcomposite.cpp
│ ├── mgimagesp.cpp
│ ├── mgshape.cpp
│ └── mgshapes.cpp
│ ├── shapedoc
│ ├── mglayer.cpp
│ ├── mgshapedoc.cpp
│ └── spfactoryimpl.cpp
│ ├── test
│ ├── RandomShape.cpp
│ └── testcanvas.cpp
│ └── view
│ ├── GcBaseView.h
│ ├── GcGraphView.cpp
│ ├── GcGraphView.h
│ ├── GcMagnifierView.cpp
│ ├── GcMagnifierView.h
│ ├── GcShapeDoc.cpp
│ ├── GcShapeDoc.h
│ ├── gicorerecord.cpp
│ ├── gicoreview.cpp
│ ├── gicoreviewdata.h
│ ├── gicoreviewimpl.h
│ └── gimousehelper.cpp
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 湖北捷智云技术有限公司
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-touchvg
2 | TouchVG for React Native
3 |
4 | # Usage
5 |
6 | ```javascript
7 | import React, { Component } from 'react';
8 | import {View,} from 'react-native';
9 | import { TouchVGView } from 'react-native-touchvg';
10 |
11 | class App extends Component {
12 |
13 | constructor(props) {
14 | super(props);
15 | this.state = {
16 | command: 'splines', /*Other commands: select | erase | rect | ellipse | triangle | line */
17 | }
18 | }
19 |
20 | render() {
21 | return (
22 |
23 |
26 |
27 | );
28 | }
29 | }
30 | ```
31 |
32 | # NOTE
33 | Based on https://github.com/rhcad/TouchVG projects.
34 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion '26.0.3'
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 22
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17 | }
18 | sourceSets {
19 | main {
20 | jni.srcDirs = []
21 | }
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile 'com.facebook.react:react-native:+'
28 | }
29 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/java/com/cloudwebrtc/TouchVG/RCTTouchVGPackage.java:
--------------------------------------------------------------------------------
1 | package com.cloudwebrtc.TouchVG;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 |
9 | import java.util.ArrayList;
10 | import java.util.Arrays;
11 | import java.util.Collections;
12 | import java.util.List;
13 |
14 | import rhcad.touchvg.IViewHelper;
15 | import rhcad.touchvg.ViewFactory;
16 |
17 | /**
18 | * Created by weiweiduan on 2018/4/4.
19 | */
20 |
21 | public class RCTTouchVGPackage implements ReactPackage {
22 | IViewHelper helper;
23 | TouchVGModule nativeModule;
24 | RCTTouchVGView nativeViewManager;
25 |
26 |
27 | public RCTTouchVGPackage(){
28 | helper = ViewFactory.createHelper();
29 | }
30 |
31 | @Override
32 | public List createNativeModules(ReactApplicationContext reactContext) {
33 | List modules = new ArrayList<>();
34 | nativeModule = new TouchVGModule(reactContext, helper);
35 | modules.add(nativeModule);
36 | return modules;
37 | }
38 |
39 | // Deprecated RN 0.47
40 | public List> createJSModules() {
41 | return Collections.emptyList();
42 | }
43 |
44 | @Override
45 | public List createViewManagers(ReactApplicationContext reactContext) {
46 | nativeViewManager = new RCTTouchVGView(helper);
47 | return Arrays.asList(nativeViewManager);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/android/src/main/java/com/cloudwebrtc/TouchVG/RCTTouchVGView.java:
--------------------------------------------------------------------------------
1 | package com.cloudwebrtc.TouchVG;
2 |
3 | /**
4 | * Created by weiweiduan on 2018/4/4.
5 | */
6 |
7 | import com.facebook.react.uimanager.annotations.ReactProp;
8 | import com.facebook.react.uimanager.SimpleViewManager;
9 | import com.facebook.react.uimanager.ThemedReactContext;
10 |
11 | import rhcad.touchvg.IViewHelper;
12 |
13 | public class RCTTouchVGView extends SimpleViewManager {
14 | private static final String REACT_CLASS = "RCTTouchVGView";
15 | TouchVGView vgview;
16 | IViewHelper helper;
17 |
18 | RCTTouchVGView(IViewHelper helper){
19 | this.helper = helper;
20 | }
21 |
22 |
23 | @Override
24 | public String getName() {
25 | return REACT_CLASS;
26 | }
27 |
28 | @Override
29 | public TouchVGView createViewInstance(ThemedReactContext context) {
30 | vgview = new TouchVGView(context, helper);
31 | return vgview;
32 | }
33 |
34 | @ReactProp(name = "command")
35 | public void setCommand(TouchVGView view, String cmd) {
36 | view.helper().setCommand(cmd);
37 | }
38 |
39 | @ReactProp(name = "lineWidth")
40 | public void setLineWidth(TouchVGView view, int w) {
41 | view.helper().setLineWidth(w);
42 | }
43 |
44 | @ReactProp(name = "strokeWidth")
45 | public void setStrokeWidth(TouchVGView view, int w) {
46 | view.helper().setStrokeWidth(w);
47 | }
48 |
49 | @ReactProp(name = "lineColor")
50 | public void setLineColor(TouchVGView view, int c) {
51 | view.helper().setLineColor(c);
52 | }
53 | }
--------------------------------------------------------------------------------
/android/src/main/java/com/cloudwebrtc/TouchVG/TouchVGModule.java:
--------------------------------------------------------------------------------
1 | package com.cloudwebrtc.TouchVG;
2 |
3 | import android.graphics.Bitmap;
4 | import android.util.Base64;
5 | import java.io.ByteArrayOutputStream;
6 |
7 | import com.facebook.react.bridge.Promise;
8 | import com.facebook.react.bridge.ReactApplicationContext;
9 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
10 | import com.facebook.react.bridge.ReactMethod;
11 | import com.facebook.react.bridge.Arguments;
12 | import com.facebook.react.bridge.WritableMap;
13 |
14 | import rhcad.touchvg.IViewHelper;
15 | import rhcad.touchvg.view.internal.ResourceUtil;
16 |
17 | /**
18 | * Created by weiweiduan on 2018/4/4.
19 | */
20 |
21 | public class TouchVGModule extends ReactContextBaseJavaModule {
22 | static final String TAG = TouchVGModule.class.getCanonicalName();
23 | IViewHelper helper;
24 |
25 | public TouchVGModule(ReactApplicationContext reactContext, IViewHelper helper) {
26 | super(reactContext);
27 | this.helper = helper;
28 | }
29 |
30 | @Override
31 | public String getName() {
32 | return "TouchVGView";
33 | }
34 |
35 |
36 | @ReactMethod
37 | public boolean canUndo() {
38 | return this.helper.canUndo();
39 | }
40 |
41 | @ReactMethod
42 | public boolean canRedo() {
43 | return this.helper.canRedo();
44 | }
45 |
46 | @ReactMethod
47 | public void undo() {
48 | this.helper.undo();
49 | }
50 |
51 | @ReactMethod
52 | public void snapshot(Promise promise) {
53 | Bitmap image = this.helper.snapshot(false);
54 | ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
55 | image.compress(Bitmap.CompressFormat.JPEG, 100, imageStream);
56 | WritableMap response = Arguments.createMap();
57 | response.putString("base64", Base64.encodeToString(imageStream.toByteArray(), Base64.DEFAULT));
58 | promise.resolve(response);
59 | }
60 |
61 | @ReactMethod
62 | public void redo() {
63 | this.helper.redo();
64 | }
65 |
66 | @ReactMethod
67 | public void eraseView() {
68 | this.helper.eraseView();
69 | }
70 |
71 | @ReactMethod
72 | public void setLineColor(int r, int g, int b, int a) {
73 | this.helper.setLineColor(r,g,b,a);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/android/src/main/java/com/cloudwebrtc/TouchVG/TouchVGView.java:
--------------------------------------------------------------------------------
1 | package com.cloudwebrtc.TouchVG;
2 |
3 | import rhcad.touchvg.IGraphView;
4 | import rhcad.touchvg.IGraphView.OnSelectionChangedListener;
5 | import rhcad.touchvg.IViewHelper;
6 | import android.content.Context;
7 | import android.view.ViewGroup;
8 | import android.widget.FrameLayout;
9 |
10 | public class TouchVGView extends ViewGroup implements OnSelectionChangedListener {
11 | private IViewHelper mHelper = null;
12 | private static final String PATH = "mnt/sdcard/WhiteBoard/";
13 |
14 | FrameLayout layout;
15 |
16 | public TouchVGView(Context context, IViewHelper helper) {
17 | super(context);
18 | mHelper = helper;
19 | mHelper.createGraphView(context, this);
20 | mHelper.getGraphView().setOnSelectionChangedListener(this);
21 | mHelper.startUndoRecord(PATH + "undo");
22 | //mHelper.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.background_repeat));
23 | }
24 |
25 | public IViewHelper helper(){
26 | return this.mHelper;
27 | }
28 |
29 | /**
30 | * {@inheritDoc}
31 | */
32 | @Override
33 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
34 | int height = b - t;
35 | int width = r - l;
36 | mHelper.getView().layout(l,t - 100, r, b - 100);
37 | }
38 |
39 | @Override
40 | public void onSelectionChanged(IGraphView view) {
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/Const.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid, BSD license
2 |
3 | package rhcad.touchvg;
4 |
5 | public class Const {
6 | public static final int GESTURE_TAP = 2;
7 | public static final int GESTURE_DBLTAP = 3;
8 | public static final int GESTURE_PRESS = 4;
9 |
10 | public static final int SOLID_LINE = 0;
11 | public static final int DASH_LINE = 1;
12 | public static final int DOT_LINE = 2;
13 | public static final int DASH_DOT = 3;
14 | public static final int DASH_DOT_DOT = 4;
15 | public static final int NULL_LINE = 5;
16 | public static final int MAX_LINESTYLE = 5;
17 |
18 | public static final int ARROWHEAD_NONE = 0;
19 | public static final int ARROWHEAD_SHARPCLOSED = 1;
20 | public static final int ARROWHEAD_SHARPLINE = 2;
21 | public static final int ARROWHEAD_TLINE = 3;
22 | public static final int ARROWHEAD_SLASHLINE = 4;
23 | public static final int ARROWHEAD_CLOSEDCIRCLE = 5;
24 | public static final int ARROWHEAD_OPENEDCIRCLE = 6;
25 | public static final int MAX_ARROWHEAD = 6;
26 |
27 | private Const() {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/ViewFactory.java:
--------------------------------------------------------------------------------
1 | //! \file ViewFactory.java
2 | //! \brief Android绘图视图工厂类
3 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid, BSD license
4 |
5 | package rhcad.touchvg;
6 |
7 | import android.util.Log;
8 | import android.view.ViewGroup;
9 | import rhcad.touchvg.core.CmdObserver;
10 | import rhcad.touchvg.view.ViewHelperImpl;
11 |
12 | /**
13 | * \ingroup GROUP_ANDROID
14 | * 绘图视图工厂类
15 | */
16 | public class ViewFactory {
17 | private static final String TAG = "touchvg";
18 |
19 | static {
20 | System.loadLibrary(TAG);
21 | }
22 |
23 | private ViewFactory() {
24 | }
25 |
26 | //! 获取当前活动视图,构造辅助对象
27 | public static IViewHelper createHelper() {
28 | return new ViewHelperImpl();
29 | }
30 |
31 | //! 指定视图构造辅助对象
32 | public static IViewHelper createHelper(IGraphView view) {
33 | return new ViewHelperImpl(view);
34 | }
35 |
36 | //! 从布局中查找绘图视图构造辅助对象,查不到则返回null
37 | public static IViewHelper createHelper(ViewGroup layout) {
38 | try {
39 | if (layout != null && layout.getChildCount() > 0
40 | && ViewGroup.class.isInstance(layout.getChildAt(0))) {
41 | return createHelper((ViewGroup) layout.getChildAt(0));
42 | }
43 | return createHelper((IGraphView) layout.getChildAt(0));
44 | } catch (ClassCastException e) {
45 | Log.w(TAG, "The layout is not kind of IGraphView", e);
46 | return null;
47 | }
48 | }
49 |
50 | //! 注册命令观察者
51 | public static void registerCmdObserver(IViewHelper hlp, CmdObserver observer) {
52 | ((ViewHelperImpl)hlp).registerCmdObserver(observer);
53 | }
54 |
55 | //! 注销命令观察者
56 | public static void unregisterCmdObserver(IViewHelper hlp, CmdObserver observer) {
57 | ((ViewHelperImpl)hlp).unregisterCmdObserver(observer);
58 | }
59 |
60 | //! 注册命令观察者
61 | public static void registerCmdObserver(IGraphView view, CmdObserver observer) {
62 | new ViewHelperImpl(view).registerCmdObserver(observer);
63 | }
64 |
65 | //! 注销命令观察者
66 | public static void unregisterCmdObserver(IGraphView view, CmdObserver observer) {
67 | new ViewHelperImpl(view).unregisterCmdObserver(observer);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/Chars.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class Chars {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected Chars(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(Chars obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_Chars(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public Chars(int n) {
39 | this(touchvgJNI.new_Chars__SWIG_0(n), true);
40 | }
41 |
42 | public Chars() {
43 | this(touchvgJNI.new_Chars__SWIG_1(), true);
44 | }
45 |
46 | public void setSize(int n) {
47 | touchvgJNI.Chars_setSize(swigCPtr, this, n);
48 | }
49 |
50 | public Chars(char v1, char v2) {
51 | this(touchvgJNI.new_Chars__SWIG_2(v1, v2), true);
52 | }
53 |
54 | public Chars(char v1, char v2, char v3, char v4) {
55 | this(touchvgJNI.new_Chars__SWIG_3(v1, v2, v3, v4), true);
56 | }
57 |
58 | public int count() {
59 | return touchvgJNI.Chars_count(swigCPtr, this);
60 | }
61 |
62 | public char get(int index) {
63 | return touchvgJNI.Chars_get(swigCPtr, this, index);
64 | }
65 |
66 | public void set(int index, char value) {
67 | touchvgJNI.Chars_set__SWIG_0(swigCPtr, this, index, value);
68 | }
69 |
70 | public void set(int index, char v1, char v2) {
71 | touchvgJNI.Chars_set__SWIG_1(swigCPtr, this, index, v1, v2);
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/CmdSubject.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class CmdSubject extends CmdObserver {
12 | private transient long swigCPtr;
13 |
14 | protected CmdSubject(long cPtr, boolean cMemoryOwn) {
15 | super(touchvgJNI.CmdSubject_SWIGUpcast(cPtr), cMemoryOwn);
16 | swigCPtr = cPtr;
17 | }
18 |
19 | protected static long getCPtr(CmdSubject obj) {
20 | return (obj == null) ? 0 : obj.swigCPtr;
21 | }
22 |
23 | protected void finalize() {
24 | delete();
25 | }
26 |
27 | public synchronized void delete() {
28 | if (swigCPtr != 0) {
29 | if (swigCMemOwn) {
30 | swigCMemOwn = false;
31 | touchvgJNI.delete_CmdSubject(swigCPtr);
32 | }
33 | swigCPtr = 0;
34 | }
35 | super.delete();
36 | }
37 |
38 | public void registerObserver(CmdObserver observer) {
39 | touchvgJNI.CmdSubject_registerObserver(swigCPtr, this, CmdObserver.getCPtr(observer), observer);
40 | }
41 |
42 | public void unregisterObserver(CmdObserver observer) {
43 | touchvgJNI.CmdSubject_unregisterObserver(swigCPtr, this, CmdObserver.getCPtr(observer), observer);
44 | }
45 |
46 | public boolean registerNamedObserver(String name, CmdObserver observer) {
47 | return touchvgJNI.CmdSubject_registerNamedObserver(swigCPtr, this, name, CmdObserver.getCPtr(observer), observer);
48 | }
49 |
50 | public CmdObserver findNamedObserver(String name) {
51 | long cPtr = touchvgJNI.CmdSubject_findNamedObserver(swigCPtr, this, name);
52 | return (cPtr == 0) ? null : new CmdObserver(cPtr, false);
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/Floats.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class Floats {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected Floats(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(Floats obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_Floats(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public Floats(int n) {
39 | this(touchvgJNI.new_Floats__SWIG_0(n), true);
40 | }
41 |
42 | public Floats() {
43 | this(touchvgJNI.new_Floats__SWIG_1(), true);
44 | }
45 |
46 | public void setSize(int n) {
47 | touchvgJNI.Floats_setSize(swigCPtr, this, n);
48 | }
49 |
50 | public Floats(float v1, float v2) {
51 | this(touchvgJNI.new_Floats__SWIG_2(v1, v2), true);
52 | }
53 |
54 | public Floats(float v1, float v2, float v3, float v4) {
55 | this(touchvgJNI.new_Floats__SWIG_3(v1, v2, v3, v4), true);
56 | }
57 |
58 | public int count() {
59 | return touchvgJNI.Floats_count(swigCPtr, this);
60 | }
61 |
62 | public float get(int index) {
63 | return touchvgJNI.Floats_get(swigCPtr, this, index);
64 | }
65 |
66 | public void set(int index, float value) {
67 | touchvgJNI.Floats_set__SWIG_0(swigCPtr, this, index, value);
68 | }
69 |
70 | public void set(int index, float v1, float v2) {
71 | touchvgJNI.Floats_set__SWIG_1(swigCPtr, this, index, v1, v2);
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/GiPlayShapes.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class GiPlayShapes {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected GiPlayShapes(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(GiPlayShapes obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_GiPlayShapes(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public void setPlaying(GiPlaying value) {
39 | touchvgJNI.GiPlayShapes_playing_set(swigCPtr, this, GiPlaying.getCPtr(value), value);
40 | }
41 |
42 | public GiPlaying getPlaying() {
43 | long cPtr = touchvgJNI.GiPlayShapes_playing_get(swigCPtr, this);
44 | return (cPtr == 0) ? null : new GiPlaying(cPtr, false);
45 | }
46 |
47 | public void setPlayer(MgRecordShapes value) {
48 | touchvgJNI.GiPlayShapes_player_set(swigCPtr, this, MgRecordShapes.getCPtr(value), value);
49 | }
50 |
51 | public MgRecordShapes getPlayer() {
52 | long cPtr = touchvgJNI.GiPlayShapes_player_get(swigCPtr, this);
53 | return (cPtr == 0) ? null : new MgRecordShapes(cPtr, false);
54 | }
55 |
56 | public GiPlayShapes() {
57 | this(touchvgJNI.new_GiPlayShapes(), true);
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/GiSaveClipBox.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class GiSaveClipBox {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected GiSaveClipBox(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(GiSaveClipBox obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_GiSaveClipBox(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public GiSaveClipBox(GiGraphics gs, Box2d rectWorld) {
39 | this(touchvgJNI.new_GiSaveClipBox(GiGraphics.getCPtr(gs), gs, Box2d.getCPtr(rectWorld), rectWorld), true);
40 | }
41 |
42 | public boolean succeed() {
43 | return touchvgJNI.GiSaveClipBox_succeed(swigCPtr, this);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/GiSaveModelTransform.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class GiSaveModelTransform {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected GiSaveModelTransform(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(GiSaveModelTransform obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_GiSaveModelTransform(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public GiSaveModelTransform(GiTransform xform, Matrix2d mat) {
39 | this(touchvgJNI.new_GiSaveModelTransform(GiTransform.getCPtr(xform), xform, Matrix2d.getCPtr(mat), mat), true);
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/Ints.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class Ints {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected Ints(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(Ints obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_Ints(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public Ints(int n) {
39 | this(touchvgJNI.new_Ints__SWIG_0(n), true);
40 | }
41 |
42 | public Ints() {
43 | this(touchvgJNI.new_Ints__SWIG_1(), true);
44 | }
45 |
46 | public void setSize(int n) {
47 | touchvgJNI.Ints_setSize(swigCPtr, this, n);
48 | }
49 |
50 | public Ints(int v1, int v2) {
51 | this(touchvgJNI.new_Ints__SWIG_2(v1, v2), true);
52 | }
53 |
54 | public Ints(int v1, int v2, int v3, int v4) {
55 | this(touchvgJNI.new_Ints__SWIG_3(v1, v2, v3, v4), true);
56 | }
57 |
58 | public int count() {
59 | return touchvgJNI.Ints_count(swigCPtr, this);
60 | }
61 |
62 | public int get(int index) {
63 | return touchvgJNI.Ints_get(swigCPtr, this, index);
64 | }
65 |
66 | public void set(int index, int value) {
67 | touchvgJNI.Ints_set__SWIG_0(swigCPtr, this, index, value);
68 | }
69 |
70 | public void set(int index, int v1, int v2) {
71 | touchvgJNI.Ints_set__SWIG_1(swigCPtr, this, index, v1, v2);
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/Longs.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class Longs {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected Longs(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(Longs obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_Longs(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public Longs(int n) {
39 | this(touchvgJNI.new_Longs__SWIG_0(n), true);
40 | }
41 |
42 | public Longs() {
43 | this(touchvgJNI.new_Longs__SWIG_1(), true);
44 | }
45 |
46 | public void setSize(int n) {
47 | touchvgJNI.Longs_setSize(swigCPtr, this, n);
48 | }
49 |
50 | public Longs(int v1, int v2) {
51 | this(touchvgJNI.new_Longs__SWIG_2(v1, v2), true);
52 | }
53 |
54 | public Longs(int v1, int v2, int v3, int v4) {
55 | this(touchvgJNI.new_Longs__SWIG_3(v1, v2, v3, v4), true);
56 | }
57 |
58 | public int count() {
59 | return touchvgJNI.Longs_count(swigCPtr, this);
60 | }
61 |
62 | public int get(int index) {
63 | return touchvgJNI.Longs_get(swigCPtr, this, index);
64 | }
65 |
66 | public void set(int index, int value) {
67 | touchvgJNI.Longs_set__SWIG_0(swigCPtr, this, index, value);
68 | }
69 |
70 | public void set(int index, int v1, int v2) {
71 | touchvgJNI.Longs_set__SWIG_1(swigCPtr, this, index, v1, v2);
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgActionDispatcher.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgActionDispatcher {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgActionDispatcher(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgActionDispatcher obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgActionDispatcher(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public boolean showInSelect(MgMotion sender, int selState, MgShape shape, Box2d selbox) {
39 | return touchvgJNI.MgActionDispatcher_showInSelect(swigCPtr, this, MgMotion.getCPtr(sender), sender, selState, MgShape.getCPtr(shape), shape, Box2d.getCPtr(selbox), selbox);
40 | }
41 |
42 | public boolean showInDrawing(MgMotion sender, MgShape shape) {
43 | return touchvgJNI.MgActionDispatcher_showInDrawing(swigCPtr, this, MgMotion.getCPtr(sender), sender, MgShape.getCPtr(shape), shape);
44 | }
45 |
46 | public boolean doAction(MgMotion sender, int action) {
47 | return touchvgJNI.MgActionDispatcher_doAction(swigCPtr, this, MgMotion.getCPtr(sender), sender, action);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgCmdArcCSE.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgCmdArcCSE extends MgCmdArc3P {
12 | private transient long swigCPtr;
13 |
14 | protected MgCmdArcCSE(long cPtr, boolean cMemoryOwn) {
15 | super(touchvgJNI.MgCmdArcCSE_SWIGUpcast(cPtr), cMemoryOwn);
16 | swigCPtr = cPtr;
17 | }
18 |
19 | protected static long getCPtr(MgCmdArcCSE obj) {
20 | return (obj == null) ? 0 : obj.swigCPtr;
21 | }
22 |
23 | protected void finalize() {
24 | delete();
25 | }
26 |
27 | public synchronized void delete() {
28 | if (swigCPtr != 0) {
29 | if (swigCMemOwn) {
30 | swigCMemOwn = false;
31 | touchvgJNI.delete_MgCmdArcCSE(swigCPtr);
32 | }
33 | swigCPtr = 0;
34 | }
35 | super.delete();
36 | }
37 |
38 | public MgCmdArcCSE(String name) {
39 | this(touchvgJNI.new_MgCmdArcCSE__SWIG_0(name), true);
40 | }
41 |
42 | public MgCmdArcCSE() {
43 | this(touchvgJNI.new_MgCmdArcCSE__SWIG_1(), true);
44 | }
45 |
46 | public void release() {
47 | touchvgJNI.MgCmdArcCSE_release(swigCPtr, this);
48 | }
49 |
50 | public boolean draw(MgMotion sender, GiGraphics gs) {
51 | return touchvgJNI.MgCmdArcCSE_draw(swigCPtr, this, MgMotion.getCPtr(sender), sender, GiGraphics.getCPtr(gs), gs);
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgCmdArcTan.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgCmdArcTan extends MgCmdArc3P {
12 | private transient long swigCPtr;
13 |
14 | protected MgCmdArcTan(long cPtr, boolean cMemoryOwn) {
15 | super(touchvgJNI.MgCmdArcTan_SWIGUpcast(cPtr), cMemoryOwn);
16 | swigCPtr = cPtr;
17 | }
18 |
19 | protected static long getCPtr(MgCmdArcTan obj) {
20 | return (obj == null) ? 0 : obj.swigCPtr;
21 | }
22 |
23 | protected void finalize() {
24 | delete();
25 | }
26 |
27 | public synchronized void delete() {
28 | if (swigCPtr != 0) {
29 | if (swigCMemOwn) {
30 | swigCMemOwn = false;
31 | touchvgJNI.delete_MgCmdArcTan(swigCPtr);
32 | }
33 | swigCPtr = 0;
34 | }
35 | super.delete();
36 | }
37 |
38 | public MgCmdArcTan(String name) {
39 | this(touchvgJNI.new_MgCmdArcTan__SWIG_0(name), true);
40 | }
41 |
42 | public MgCmdArcTan() {
43 | this(touchvgJNI.new_MgCmdArcTan__SWIG_1(), true);
44 | }
45 |
46 | public void release() {
47 | touchvgJNI.MgCmdArcTan_release(swigCPtr, this);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgCmdCompass.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgCmdCompass extends MgCmdArc3P {
12 | private transient long swigCPtr;
13 |
14 | protected MgCmdCompass(long cPtr, boolean cMemoryOwn) {
15 | super(touchvgJNI.MgCmdCompass_SWIGUpcast(cPtr), cMemoryOwn);
16 | swigCPtr = cPtr;
17 | }
18 |
19 | protected static long getCPtr(MgCmdCompass obj) {
20 | return (obj == null) ? 0 : obj.swigCPtr;
21 | }
22 |
23 | protected void finalize() {
24 | delete();
25 | }
26 |
27 | public synchronized void delete() {
28 | if (swigCPtr != 0) {
29 | if (swigCMemOwn) {
30 | swigCMemOwn = false;
31 | touchvgJNI.delete_MgCmdCompass(swigCPtr);
32 | }
33 | swigCPtr = 0;
34 | }
35 | super.delete();
36 | }
37 |
38 | public MgCmdCompass(String name) {
39 | this(touchvgJNI.new_MgCmdCompass__SWIG_0(name), true);
40 | }
41 |
42 | public MgCmdCompass() {
43 | this(touchvgJNI.new_MgCmdCompass__SWIG_1(), true);
44 | }
45 |
46 | public void release() {
47 | touchvgJNI.MgCmdCompass_release(swigCPtr, this);
48 | }
49 |
50 | public boolean initialize(MgMotion sender, MgStorage s) {
51 | return touchvgJNI.MgCmdCompass_initialize(swigCPtr, this, MgMotion.getCPtr(sender), sender, MgStorage.getCPtr(s), s);
52 | }
53 |
54 | public boolean draw(MgMotion sender, GiGraphics gs) {
55 | return touchvgJNI.MgCmdCompass_draw(swigCPtr, this, MgMotion.getCPtr(sender), sender, GiGraphics.getCPtr(gs), gs);
56 | }
57 |
58 | public boolean click(MgMotion sender) {
59 | return touchvgJNI.MgCmdCompass_click(swigCPtr, this, MgMotion.getCPtr(sender), sender);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgCmdManagerFactory.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgCmdManagerFactory {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgCmdManagerFactory(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgCmdManagerFactory obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgCmdManagerFactory(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public static MgCmdManager create() {
39 | long cPtr = touchvgJNI.MgCmdManagerFactory_create();
40 | return (cPtr == 0) ? null : new MgCmdManager(cPtr, false);
41 | }
42 |
43 | public MgCmdManagerFactory() {
44 | this(touchvgJNI.new_MgCmdManagerFactory(), true);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgCmdSector.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgCmdSector extends MgCmdArcCSE {
12 | private transient long swigCPtr;
13 |
14 | protected MgCmdSector(long cPtr, boolean cMemoryOwn) {
15 | super(touchvgJNI.MgCmdSector_SWIGUpcast(cPtr), cMemoryOwn);
16 | swigCPtr = cPtr;
17 | }
18 |
19 | protected static long getCPtr(MgCmdSector obj) {
20 | return (obj == null) ? 0 : obj.swigCPtr;
21 | }
22 |
23 | protected void finalize() {
24 | delete();
25 | }
26 |
27 | public synchronized void delete() {
28 | if (swigCPtr != 0) {
29 | if (swigCMemOwn) {
30 | swigCMemOwn = false;
31 | touchvgJNI.delete_MgCmdSector(swigCPtr);
32 | }
33 | swigCPtr = 0;
34 | }
35 | super.delete();
36 | }
37 |
38 | public MgCmdSector(String name) {
39 | this(touchvgJNI.new_MgCmdSector__SWIG_0(name), true);
40 | }
41 |
42 | public MgCmdSector() {
43 | this(touchvgJNI.new_MgCmdSector__SWIG_1(), true);
44 | }
45 |
46 | public boolean initialize(MgMotion sender, MgStorage s) {
47 | return touchvgJNI.MgCmdSector_initialize(swigCPtr, this, MgMotion.getCPtr(sender), sender, MgStorage.getCPtr(s), s);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgCoreShapeFactory.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgCoreShapeFactory {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgCoreShapeFactory(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgCoreShapeFactory obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgCoreShapeFactory(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public MgCoreShapeFactory() {
39 | this(touchvgJNI.new_MgCoreShapeFactory(), true);
40 | }
41 |
42 | public MgBaseShape createShape(int type) {
43 | long cPtr = touchvgJNI.MgCoreShapeFactory_createShape(swigCPtr, this, type);
44 | return (cPtr == 0) ? null : new MgBaseShape(cPtr, false);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgFindImageCallback.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgFindImageCallback {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgFindImageCallback(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgFindImageCallback obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgFindImageCallback(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | protected void swigDirectorDisconnect() {
39 | swigCMemOwn = false;
40 | delete();
41 | }
42 |
43 | public void swigReleaseOwnership() {
44 | swigCMemOwn = false;
45 | touchvgJNI.MgFindImageCallback_change_ownership(this, swigCPtr, false);
46 | }
47 |
48 | public void swigTakeOwnership() {
49 | swigCMemOwn = true;
50 | touchvgJNI.MgFindImageCallback_change_ownership(this, swigCPtr, true);
51 | }
52 |
53 | public void onFindImage(int sid, String name) {
54 | touchvgJNI.MgFindImageCallback_onFindImage(swigCPtr, this, sid, name);
55 | }
56 |
57 | public MgFindImageCallback() {
58 | this(touchvgJNI.new_MgFindImageCallback(), true);
59 | touchvgJNI.MgFindImageCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgJsonFile.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgJsonFile {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgJsonFile(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgJsonFile obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgJsonFile(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public MgJsonFile(String filename, boolean forRead) {
39 | this(touchvgJNI.new_MgJsonFile(filename, forRead), true);
40 | }
41 |
42 | public boolean opened() {
43 | return touchvgJNI.MgJsonFile_opened(swigCPtr, this);
44 | }
45 |
46 | public void close() {
47 | touchvgJNI.MgJsonFile_close(swigCPtr, this);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgPathNode.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public final class MgPathNode {
12 | public final static MgPathNode kMgCloseFigure = new MgPathNode("kMgCloseFigure", 1);
13 | public final static MgPathNode kMgLineTo = new MgPathNode("kMgLineTo", 2);
14 | public final static MgPathNode kMgBezierTo = new MgPathNode("kMgBezierTo", 4);
15 | public final static MgPathNode kMgQuadTo = new MgPathNode("kMgQuadTo", 8);
16 | public final static MgPathNode kMgMoveTo = new MgPathNode("kMgMoveTo", 6);
17 |
18 | public final int swigValue() {
19 | return swigValue;
20 | }
21 |
22 | public String toString() {
23 | return swigName;
24 | }
25 |
26 | public static MgPathNode swigToEnum(int swigValue) {
27 | if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
28 | return swigValues[swigValue];
29 | for (int i = 0; i < swigValues.length; i++)
30 | if (swigValues[i].swigValue == swigValue)
31 | return swigValues[i];
32 | throw new IllegalArgumentException("No enum " + MgPathNode.class + " with value " + swigValue);
33 | }
34 |
35 | private MgPathNode(String swigName) {
36 | this.swigName = swigName;
37 | this.swigValue = swigNext++;
38 | }
39 |
40 | private MgPathNode(String swigName, int swigValue) {
41 | this.swigName = swigName;
42 | this.swigValue = swigValue;
43 | swigNext = swigValue+1;
44 | }
45 |
46 | private MgPathNode(String swigName, MgPathNode swigEnum) {
47 | this.swigName = swigName;
48 | this.swigValue = swigEnum.swigValue;
49 | swigNext = this.swigValue+1;
50 | }
51 |
52 | private static MgPathNode[] swigValues = { kMgCloseFigure, kMgLineTo, kMgBezierTo, kMgQuadTo, kMgMoveTo };
53 | private static int swigNext = 0;
54 | private final int swigValue;
55 | private final String swigName;
56 | }
57 |
58 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgRegenLocker.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgRegenLocker {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgRegenLocker(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgRegenLocker obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgRegenLocker(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public MgRegenLocker(MgView view) {
39 | this(touchvgJNI.new_MgRegenLocker(MgView.getCPtr(view), view), true);
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgShapeFactory.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgShapeFactory {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgShapeFactory(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgShapeFactory obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgShapeFactory(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public MgShape createShape(int type) {
39 | long cPtr = touchvgJNI.MgShapeFactory_createShape(swigCPtr, this, type);
40 | return (cPtr == 0) ? null : new MgShape(cPtr, false);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgShapeIterator.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgShapeIterator {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgShapeIterator(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgShapeIterator obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgShapeIterator(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public MgShapeIterator(MgShapes s) {
39 | this(touchvgJNI.new_MgShapeIterator(MgShapes.getCPtr(s), s), true);
40 | }
41 |
42 | public boolean hasNext() {
43 | return touchvgJNI.MgShapeIterator_hasNext(swigCPtr, this);
44 | }
45 |
46 | public MgShape getNext() {
47 | long cPtr = touchvgJNI.MgShapeIterator_getNext(swigCPtr, this);
48 | return (cPtr == 0) ? null : new MgShape(cPtr, false);
49 | }
50 |
51 | public MgShapes shapes() {
52 | long cPtr = touchvgJNI.MgShapeIterator_shapes(swigCPtr, this);
53 | return (cPtr == 0) ? null : new MgShapes(cPtr, false);
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/MgStringCallback.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class MgStringCallback {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected MgStringCallback(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(MgStringCallback obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_MgStringCallback(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | protected void swigDirectorDisconnect() {
39 | swigCMemOwn = false;
40 | delete();
41 | }
42 |
43 | public void swigReleaseOwnership() {
44 | swigCMemOwn = false;
45 | touchvgJNI.MgStringCallback_change_ownership(this, swigCPtr, false);
46 | }
47 |
48 | public void swigTakeOwnership() {
49 | swigCMemOwn = true;
50 | touchvgJNI.MgStringCallback_change_ownership(this, swigCPtr, true);
51 | }
52 |
53 | public void onGetString(String text) {
54 | touchvgJNI.MgStringCallback_onGetString(swigCPtr, this, text);
55 | }
56 |
57 | public MgStringCallback() {
58 | this(touchvgJNI.new_MgStringCallback(), true);
59 | touchvgJNI.MgStringCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/core/Tol.java:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------------
2 | * This file was automatically generated by SWIG (http://www.swig.org).
3 | * Version 3.0.12
4 | *
5 | * Do not make changes to this file unless you know what you are doing--modify
6 | * the SWIG interface file instead.
7 | * ----------------------------------------------------------------------------- */
8 |
9 | package rhcad.touchvg.core;
10 |
11 | public class Tol {
12 | private transient long swigCPtr;
13 | protected transient boolean swigCMemOwn;
14 |
15 | protected Tol(long cPtr, boolean cMemoryOwn) {
16 | swigCMemOwn = cMemoryOwn;
17 | swigCPtr = cPtr;
18 | }
19 |
20 | protected static long getCPtr(Tol obj) {
21 | return (obj == null) ? 0 : obj.swigCPtr;
22 | }
23 |
24 | protected void finalize() {
25 | delete();
26 | }
27 |
28 | public synchronized void delete() {
29 | if (swigCPtr != 0) {
30 | if (swigCMemOwn) {
31 | swigCMemOwn = false;
32 | touchvgJNI.delete_Tol(swigCPtr);
33 | }
34 | swigCPtr = 0;
35 | }
36 | }
37 |
38 | public static Tol gTol() {
39 | return new Tol(touchvgJNI.Tol_gTol(), true);
40 | }
41 |
42 | public static Tol minTol() {
43 | return new Tol(touchvgJNI.Tol_minTol(), true);
44 | }
45 |
46 | public Tol() {
47 | this(touchvgJNI.new_Tol__SWIG_0(), true);
48 | }
49 |
50 | public Tol(float tolPoint, float tolVector) {
51 | this(touchvgJNI.new_Tol__SWIG_1(tolPoint, tolVector), true);
52 | }
53 |
54 | public Tol(float tolPoint) {
55 | this(touchvgJNI.new_Tol__SWIG_2(tolPoint), true);
56 | }
57 |
58 | public float equalPoint() {
59 | return touchvgJNI.Tol_equalPoint(swigCPtr, this);
60 | }
61 |
62 | public float equalVector() {
63 | return touchvgJNI.Tol_equalVector(swigCPtr, this);
64 | }
65 |
66 | public void setEqualPoint(float tol) {
67 | touchvgJNI.Tol_setEqualPoint(swigCPtr, this, tol);
68 | }
69 |
70 | public void setEqualVector(float tol) {
71 | touchvgJNI.Tol_setEqualVector(swigCPtr, this, tol);
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * TouchVG is a lightweight 2D vector drawing framework.
3 | * @author Zhang Yungui
4 | */
5 | package rhcad.touchvg;
6 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/view/BaseGraphView.java:
--------------------------------------------------------------------------------
1 | //! \file BaseGraphView.java
2 | //! \brief 绘图视图接口
3 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid, BSD license
4 |
5 | package rhcad.touchvg.view;
6 |
7 | import rhcad.touchvg.IGraphView;
8 | import rhcad.touchvg.core.GiView;
9 | import rhcad.touchvg.view.internal.ImageCache;
10 |
11 | //! 绘图视图接口
12 | public interface BaseGraphView extends IGraphView {
13 |
14 | //! 返回视图回调适配器对象
15 | public GiView viewAdapter();
16 |
17 | //! 返回图像对象缓存
18 | public ImageCache getImageCache();
19 |
20 | //! 销毁数据,内部调用
21 | public void tearDown();
22 | }
23 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/view/impl/FileUtil.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid, BSD license
2 |
3 | package rhcad.touchvg.view.impl;
4 |
5 | import java.io.File;
6 |
7 | import android.util.Log;
8 |
9 | public class FileUtil {
10 | public static final String TAG = "touchvg";
11 |
12 | private FileUtil() {
13 | }
14 |
15 | //! 返回指定后缀名的文件名
16 | public static String addExtension(String filename, String ext) {
17 | if (filename != null && !filename.endsWith(ext) && !filename.endsWith(".json")) {
18 | return filename.substring(0, filename.lastIndexOf('.')) + ext;
19 | }
20 | return filename;
21 | }
22 |
23 | //! 创建指定的文件的上一级文件夹,如果自身是文件夹则也创建
24 | public static boolean createDirectory(String filename, boolean isDirectory) {
25 | final File file = new File(filename);
26 | final File pf = file.getParentFile();
27 |
28 | if (!pf.exists() && !pf.mkdir()) {
29 | Log.e(TAG, "Fail to create parent folder: " + pf.getPath());
30 | return false;
31 | }
32 | if (isDirectory && !file.exists() && !file.mkdir()) {
33 | Log.e(TAG, "Fail to create folder: " + filename);
34 | return false;
35 | }
36 | return true;
37 | }
38 |
39 | //! 删除一个文件夹的所有内容
40 | public static boolean deleteDirectory(File path) {
41 | if (path.exists()) {
42 | final File[] files = path.listFiles();
43 | if (files != null && !deleteFiles(files)) {
44 | return false;
45 | }
46 | }
47 | return !path.exists() || path.delete();
48 | }
49 |
50 | private static boolean deleteFiles(File[] files) {
51 | for (File f : files) {
52 | if (f.isDirectory()) {
53 | if (!deleteDirectory(f)) {
54 | Log.e(TAG, "Fail to delete folder: " + f.getPath());
55 | return false;
56 | }
57 | } else {
58 | if (!f.delete()) {
59 | Log.e(TAG, "Fail to delete file: " + f.getPath());
60 | return false;
61 | }
62 | }
63 | }
64 | return true;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/view/internal/RecordRunnable.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid, BSD license
2 |
3 | package rhcad.touchvg.view.internal;
4 |
5 | import rhcad.touchvg.core.GiCoreView;
6 | import android.util.Log;
7 |
8 | public class RecordRunnable extends ShapeRunnable {
9 | public static final int TYPE = 2;
10 | protected BaseViewAdapter mViewAdapter;
11 |
12 | public RecordRunnable(BaseViewAdapter viewAdapter, String path) {
13 | super(path, TYPE, viewAdapter.coreView());
14 | this.mViewAdapter = viewAdapter;
15 | }
16 |
17 | @Override
18 | protected boolean beforeStopped() {
19 | synchronized (GiCoreView.class) {
20 | boolean ret = mViewAdapter.onStopped(this);
21 | if (ret) {
22 | synchronized (mCoreView) {
23 | mCoreView.stopRecord(false);
24 | }
25 | }
26 | return ret;
27 | }
28 | }
29 |
30 | @Override
31 | protected void afterStopped(boolean normal) {
32 | mViewAdapter = null;
33 | }
34 |
35 | @Override
36 | protected void process(int tick, int change, int doc, int shapes) {
37 | if (!mCoreView.recordShapes(false, tick, change, doc, shapes, null,
38 | mViewAdapter.createRecordCallback(true))) {
39 | Log.e(TAG, "Fail to record shapes for playing, tick=" + tick
40 | + ", doc=" + doc + ", shapes=" + shapes);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/view/internal/UndoRunnable.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid, BSD license
2 |
3 | package rhcad.touchvg.view.internal;
4 |
5 | import rhcad.touchvg.core.GiCoreView;
6 | import android.util.Log;
7 |
8 | public class UndoRunnable extends ShapeRunnable {
9 | public static final int TYPE = 1;
10 | public static final int UNDO = 0xFFFFFF10;
11 | public static final int REDO = 0xFFFFFF20;
12 | private BaseViewAdapter mViewAdapter;
13 |
14 | public UndoRunnable(BaseViewAdapter viewAdapter, String path) {
15 | super(path, TYPE, viewAdapter.coreView());
16 | this.mViewAdapter = viewAdapter;
17 | }
18 |
19 | @Override
20 | protected boolean beforeStopped() {
21 | synchronized (GiCoreView.class) {
22 | boolean ret = mViewAdapter.onStopped(this);
23 | if (ret) {
24 | synchronized (mCoreView) {
25 | mCoreView.stopRecord(true);
26 | }
27 | }
28 | return ret;
29 | }
30 | }
31 |
32 | @Override
33 | protected void afterStopped(boolean normal) {
34 | mViewAdapter = null;
35 | }
36 |
37 | @Override
38 | protected void process(int tick, int change, int doc, int shapes) {
39 | if (tick == UNDO) {
40 | synchronized (mCoreView) {
41 | mCoreView.undo(mViewAdapter);
42 | }
43 | } else if (tick == REDO) {
44 | synchronized (mCoreView) {
45 | mCoreView.redo(mViewAdapter);
46 | }
47 | } else if (!mCoreView.recordShapes(true, tick, change, doc, shapes)) {
48 | Log.e(TAG, "Fail to record shapes for undoing, tick=" + tick + ", doc=" + doc);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/view/internal/ViewUtil.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid, BSD license
2 |
3 | package rhcad.touchvg.view.internal;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import rhcad.touchvg.view.BaseGraphView;
9 |
10 | //! 记录当前视图和所有视图对象的辅助类
11 | public class ViewUtil {
12 | private static BaseGraphView mActiveView;
13 | private static List mViews = new ArrayList();
14 |
15 | private ViewUtil() {
16 | }
17 |
18 | public static void onAddView(BaseGraphView view) {
19 | mViews.add(view);
20 | if (mActiveView == null) {
21 | mActiveView = view;
22 | }
23 | }
24 |
25 | public static void onRemoveView(BaseGraphView view) {
26 | mViews.remove(view);
27 | if (mActiveView == view) {
28 | mActiveView = mViews.isEmpty() ? null : mViews.get(0);
29 | }
30 | }
31 |
32 | public static List views() {
33 | return mViews;
34 | }
35 |
36 | public static BaseGraphView activeView() {
37 | return mActiveView;
38 | }
39 |
40 | public static void activateView(BaseGraphView view) {
41 | if (mActiveView != view) {
42 | mActiveView = view;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/android/src/main/java/rhcad/touchvg/view/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * TouchVG is a lightweight 2D vector drawing framework.
3 | * @author Zhang Yungui
4 | */
5 | package rhcad.touchvg.view;
6 |
--------------------------------------------------------------------------------
/android/src/main/jniLibs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/jniLibs/android-support-v4.jar
--------------------------------------------------------------------------------
/android/src/main/jniLibs/androidsvg-1.2.2-beta-1-2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/jniLibs/androidsvg-1.2.2-beta-1-2.jar
--------------------------------------------------------------------------------
/android/src/main/jniLibs/armeabi-v7a/libtouchvg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/jniLibs/armeabi-v7a/libtouchvg.so
--------------------------------------------------------------------------------
/android/src/main/jniLibs/x86/libtouchvg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/jniLibs/x86/libtouchvg.so
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/brush.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/brush.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/colorwheel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/colorwheel.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/ellipse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/ellipse.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/eraser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/eraser.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/line.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/rect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/rect.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/select.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/snapshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/snapshot.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/triangle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/triangle.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_back.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_clone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_clone.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_delete.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_edit.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_endedit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_endedit.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_fixlen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_fixlen.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_freelen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_freelen.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_group.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_lock.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_overturn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_overturn.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_selall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_selall.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_ungroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_ungroup.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vg_unlock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vg_unlock.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgcen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgcen.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgcross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgcross.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgdot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgdot1.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgdot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgdot2.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgdot3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgdot3.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgmid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgmid.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgnear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgnear.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgnode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgnode.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgparallel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgparallel.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgpivot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgpivot.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgquad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgquad.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgredo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgredo.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgtangent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgtangent.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-hdpi/vgundo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-hdpi/vgundo.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/brush.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/brush.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/colorwheel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/colorwheel.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/ellipse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/ellipse.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/eraser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/eraser.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/line.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/rect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/rect.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/select.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/snapshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/snapshot.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/triangle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/triangle.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_back.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_clone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_clone.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_delete.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_edit.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_endedit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_endedit.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_fixlen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_fixlen.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_freelen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_freelen.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_group.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_lock.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_overturn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_overturn.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_selall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_selall.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_ungroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_ungroup.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vg_unlock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vg_unlock.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgcen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgcen.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgcross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgcross.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgdot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgdot1.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgdot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgdot2.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgdot3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgdot3.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgmid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgmid.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgnear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgnear.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgnode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgnode.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgparallel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgparallel.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgpivot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgpivot.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgquad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgquad.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgredo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgredo.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgtangent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgtangent.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-mdpi/vgundo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-mdpi/vgundo.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable/background.jpg
--------------------------------------------------------------------------------
/android/src/main/res/drawable/background_repeat.xml:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/brush.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable/brush.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable/demo_switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable/demo_switch.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable/vg_translucent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/android/src/main/res/drawable/vg_translucent.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable/vg_translucent_bg.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/android/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/android/src/main/res/values/vg_action_captions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - 全选
6 | - 重选
7 | - 绘图
8 | - 取消
9 | - 删除
10 | - 克隆
11 | - 定长
12 | - 不定长
13 | - 锁定
14 | - 解锁
15 | - 编辑
16 | - 返回
17 | - 闭合
18 | - 不闭合
19 | - 加点
20 | - 删点
21 | - 成组
22 | - 解组
23 | - 翻转
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import TouchVGView from './TouchVGView';
4 |
5 | module.exports = {
6 | TouchVGView,
7 | };
8 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/RCTTouchVGView.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCTTouchVGViewManager.h
3 | // RCTTouchVG
4 | //
5 | // Created by 维伟段 on 2018/4/3.
6 | // Copyright © 2018年 维伟段. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @class TouchVGView;
13 | @interface RCTTouchVGView : RCTViewManager
14 | @property(nonatomic, strong) TouchVGView *vgview;
15 | @end
16 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/LICENSE:
--------------------------------------------------------------------------------
1 | BSD License
2 |
3 | For TouchVG framework
4 |
5 | Copyright (c) 2012-2016, Zhang Yungui . All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without modification,
8 | are permitted provided that the following conditions are met:
9 |
10 | * Redistributions of source code must retain the above copyright notice, this
11 | list of conditions and the following disclaimer.
12 |
13 | * Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/Info.plist
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/en.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | Localizable.strings for TouchVG
3 | */
4 |
5 | "shape_too_small" = "The shape is too small";
6 | "shape1_deleted" = "1 shape deleted";
7 | "shape_n_deleted" = "%d shapes deleted";
8 | "invalid_gridcell" = "The grid cell is too small or too large";
9 | "undo_ok" = "Undo successfully";
10 | "redo_ok" = "Redo successfully";
11 | "nodept" = "Vertex";
12 | "centerpt" = "Center";
13 | "midpt" = "Midpoint";
14 | "quadpt" = "Quadrantal point";
15 | "crosspt" = "Intersection";
16 | "parallelpt" = "Parallel";
17 | "nearpt" = "Point on edge";
18 | "perppt" = "Perpendicular to line";
19 | "tanpt" = "Tangent point";
20 | "degrees" = "°";
21 |
22 | "settings" = "Settings";
23 | "snap_enabled" = "Enable to snap";
24 | "snap_vertex" = "Snap to vertex";
25 | "snap_center" = "Snap to center";
26 | "snap_midpoint" = "Snap to midpoint";
27 | "snap_quadrant" = "Snap to quadrantal";
28 | "snap_perp" = "Snap to perpendicular";
29 | "snap_parallel" = "Snap to parallel";
30 | "snap_cross" = "Snap to intersection";
31 | "snap_tangent" = "Snap to tangent";
32 | "snap_edge" = "Snap to edge";
33 | "snap_extend" = "Snap to direction";
34 | "snap_pt_tol" = "Snap tolerance to points";
35 | "snap_edge_tol" = "Snap tolerance to edges";
36 | "snap_toltip" = "1~100 mm";
37 | "context_actions" = "Show context buttons";
38 | "zoom_enabled" = "Zoom with two fingers";
39 | "zoom_shape_enabled" = "Transform shapes with fingers";
40 | "show_magnifier" = "Show magnifier";
41 | "start_must_vertex" = "Draw from a vertex";
42 | "rotate_handle_enabled" = "Allow rotate around the vertex";
43 | "move_handle_enabled" = "Allow move vertexes";
44 | "move_shape_enabled" = "Allow move shapes";
45 | "boxsel_enabled" = "Allow the frame selection";
46 | "degree_decimal" = "Decimal digits of degree";
47 | "dist_decimal" = "Decimal digits of length";
48 | "snap_round_cell" = "Decimal digits of coordinate";
49 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/magnifier-mask@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/magnifier-mask@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/magnifier@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/magnifier@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/translucent@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/translucent@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_addvertex@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_addvertex@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_back@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_back@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_clone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_clone@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_delete@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_delete@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_delvertex@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_delvertex@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_edit@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_edit@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_endedit@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_endedit@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_fixlen@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_fixlen@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_freelen@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_freelen@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_group@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_group@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_lock@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_lock@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_overturn@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_overturn@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_selall@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_selall@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_ungroup@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_ungroup@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_unlock@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vg_unlock@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgcen@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgcen@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgcross@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgcross@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgdot1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgdot1@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgdot2@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgdot2@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgdot3@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgdot3@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgmid@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgmid@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgnear@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgnear@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgnode@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgnode@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgparallel@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgparallel@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgpivot@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgpivot@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgquad@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgquad@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgtangent@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloudwebrtc/react-native-touchvg/95753371713ee4b08b739b884d8eb932cd794b67/ios/RCTTouchVG/TouchVG/TouchVG.bundle/vgtangent@2x.png
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/TouchVG.bundle/zh-Hans.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | Localizable.strings for TouchVG
3 | */
4 |
5 | "shape_too_small" = "图形太小,请重新绘制";
6 | "shape1_deleted" = "已删除一个图形";
7 | "shape_n_deleted" = "已删除 %d 个图形";
8 | "invalid_gridcell" = "单元格太小或太大";
9 | "undo_ok" = "已撤销";
10 | "redo_ok" = "已恢复";
11 | "nodept" = "顶点";
12 | "centerpt" = "圆心";
13 | "midpt" = "中点";
14 | "quadpt" = "象限点";
15 | "crosspt" = "交点";
16 | "parallelpt" = "平行";
17 | "nearpt" = "线上点";
18 | "perppt" = "垂足";
19 | "tanpt" = "切点";
20 | "degrees" = "°";
21 |
22 | "settings" = "设置";
23 | "snap_enabled" = "允许吸附";
24 | "snap_vertex" = "吸附到顶点";
25 | "snap_center" = "吸附到圆心";
26 | "snap_midpoint" = "吸附到中点";
27 | "snap_quadrant" = "吸附到象限点";
28 | "snap_perp" = "吸附到垂线";
29 | "snap_parallel" = "吸附到平行线";
30 | "snap_cross" = "吸附到交点";
31 | "snap_tangent" = "吸附到切点";
32 | "snap_edge" = "吸附到边";
33 | "snap_extend" = "吸附到延长线上";
34 | "snap_pt_tol" = "点吸附距离";
35 | "snap_edge_tol" = "边吸附距离";
36 | "snap_toltip" = "1~100 mm";
37 | "context_actions" = "上下文按钮";
38 | "zoom_enabled" = "允许放缩";
39 | "zoom_shape_enabled" = "允许双指缩放图形";
40 | "show_magnifier" = "显示放大镜";
41 | "start_must_vertex" = "起点必须吸到顶点";
42 | "rotate_handle_enabled" = "允许绕顶点旋转";
43 | "move_handle_enabled" = "允许移动顶点";
44 | "move_shape_enabled" = "允许移动图形";
45 | "boxsel_enabled" = "允许框选";
46 | "degree_decimal" = "度数小数位";
47 | "dist_decimal" = "长度小数位";
48 | "snap_round_cell" = "坐标小数位";
49 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/include/ARCMacro.h:
--------------------------------------------------------------------------------
1 | /*
2 | * ARCMacro.h 1.1 2012/05/29 https://gist.github.com/2823399
3 | *
4 | * ARCMacro.h realizes coexistence of both the ARC (Automatic
5 | * Reference Counting) mode and the Non-ARC mode of Objective-C
6 | * in the same source code. This macro works for iOS and Mac OS X.
7 | *
8 | * This is a by-product of joint research by AIST and The University of Ryukyu.
9 | * HIRANO Satoshi (AIST), NAKAMURA Morikazu (U. Ryukyu) and GUAN Senlin (U. Ryukyu)
10 | *
11 | * Author: HIRANO Satoshi (AIST, Japan) on 2011/11/14
12 | * Copyright 2011-2012 National Institute of Advanced Industrial Science
13 | * and Technology (AIST), Japan. Apache License 2.0.
14 | *
15 | * Usage:
16 | * #import "ARCMacro.h"
17 | * [o1 RETAIN];
18 | * o2 = [[o3 RETAIN] AUTORELEASE];
19 | * [super DEALLOC];
20 | */
21 |
22 | #ifndef RELEASEOBJ
23 | #if __has_feature(objc_arc)
24 | #define RETAIN self
25 | #define AUTORELEASE self
26 | #define RELEASEOBJ self
27 | #define DEALLOC self
28 | #define WEAK weak
29 | #define STRONG strong
30 | #else
31 | #define RETAIN retain
32 | #define AUTORELEASE autorelease
33 | #define RELEASEOBJ release
34 | #define DEALLOC dealloc
35 | #define WEAK assign
36 | #define STRONG retain
37 | #endif
38 | #endif
39 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/include/GiPaintViewDelegate.h:
--------------------------------------------------------------------------------
1 | //! \file GiPaintViewDelegate.h
2 | //! \brief 定义绘图消息的观察者协议 GiPaintViewDelegate
3 | // Copyright (c) 2014, https://github.com/rhcad/touchvg
4 |
5 | #import
6 |
7 | //! 绘图消息的观察者协议
8 | /*! 也可以在 GiPaintView 派生类直接实现这些通知函数。
9 | \ingroup GROUP_IOS
10 | \see GiPaintView, GiViewHelper
11 | */
12 | @protocol GiPaintViewDelegate
13 | @optional
14 |
15 | - (void)onCommandChanged:(id)view; //!< 当前命令改变的通知
16 | - (void)onSelectionChanged:(id)view; //!< 图形选择集改变的通知
17 | - (void)onContentChanged:(id)view; //!< 图形数据改变的通知
18 | - (void)onDynamicChanged:(id)view; //!< 图形动态改变的通知
19 | - (void)onResizeFrame:(id)view; //!< 视图大小改变(setFrame:)的通知
20 | - (void)onZoomChanged:(id)view; //!< 视图放缩的通知
21 | - (void)onFirstRegen:(id)view; //!< 第一次后台渲染结束的通知
22 | - (void)onDynDrawEnded:(id)view; //!< 动态绘图完成的通知
23 | - (void)onShapesRecorded:(NSDictionary *)info; //!< 录制的通知
24 | - (void)onShapeWillDelete:(id)num; //!< 图形将删除的通知, [NSNumber intValue]
25 | - (void)onShapeDeleted:(id)num; //!< 图形已删除的通知, [NSNumber intValue]
26 | - (BOOL)onShapeDblClick:(NSDictionary *)info; //!< 图形双击编辑的通知
27 | - (BOOL)onShapeClicked:(NSDictionary *)info; //!< 图形点击的通知
28 |
29 | - (BOOL)onGestureShouldBegin:(UIGestureRecognizer *)g; //!< 手势生效前的判断
30 | - (void)onGestureBegan:(UIGestureRecognizer *)g; //!< 手势开始的通知
31 | - (void)onGestureEnded:(UIGestureRecognizer *)g; //!< 手势结束的通知
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/include/GiViewEnums.h:
--------------------------------------------------------------------------------
1 | //! \file GiViewEnums.h
2 | //! \brief 定义iOS绘图视图的枚举值
3 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgios, BSD License
4 |
5 | #ifndef __TOUCHVG_VIEWENUMS_H
6 | #define __TOUCHVG_VIEWENUMS_H
7 |
8 | typedef NS_ENUM(int, GILineStyle) { //!< 线型
9 | GILineStyleSolid, //!< ----------
10 | GILineStyleDash, //!< - - - -
11 | GILineStyleDot, //!< ..........
12 | GILineStyleDashDot, //!< _._._._._
13 | GILineStyleDashDotdot, //!< _.._.._.._
14 | GILineStyleNull //!< Not draw.
15 | };
16 |
17 | typedef NS_ENUM(int, GIArrowHead) { //!< 线端箭头
18 | GIArrowHeadNone = 0, //!< 无箭头
19 | GIArrowHeadSharpClosed, //!< 实心尖头
20 | GIArrowHeadSharpLine, //!< 简单线条尖头
21 | GIArrowHeadTLine, //!< T型箭头
22 | GIArrowHeadSlashLine, //!< 斜线箭头
23 | GIArrowHeadClosedCircle, //!< 实心圆头
24 | GIArrowHeadOpenedCircle //!< 空心圆头
25 | };
26 |
27 | typedef NS_ENUM(int, GIViewFlags) { //!< 视图创建标志
28 | GIViewFlagsNoBackLayer = 1, //!< 不使用分层异步渲染
29 | GIViewFlagsNoDynDrawView = 2, //!< 不使用双视图显示
30 | GIViewFlagsNotDynDraw = 4, //!< 屏蔽动态显示
31 | GIViewFlagsZoomExtent = 8, //!< 自动放缩到图形范围
32 | GIViewFlagsNoCmd = 16, //!< 不使用交互命令
33 | GIViewFlagsMagnifier = 32, //!< 显示跟随放大镜
34 | GIViewFlagsDummyView = (GIViewFlagsNoBackLayer|GIViewFlagsNoDynDrawView
35 | |GIViewFlagsZoomExtent|GIViewFlagsNoCmd)
36 | };
37 |
38 | #endif // __TOUCHVG_VIEWENUMS_H
39 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/include/GiViewHelper+Layer.h:
--------------------------------------------------------------------------------
1 | //! \file GiViewHelper+Layer.h
2 | //! \brief 定义iOS绘图视图辅助类 GiViewHelper 的图层转换器部分
3 | // Copyright (c) 2013-2015, https://github.com/rhcad/vgios, BSD License
4 |
5 | #import "GiViewHelper.h"
6 |
7 | /*! \category GiViewHelper(Layer)
8 | \brief GiViewHelper 的图层转换器部分
9 | */
10 | @interface GiViewHelper(Layer)
11 |
12 | //! 将静态图形转换到三级层,第二级为每个图形的层,其下有CAShapeLayer,返回顶级层
13 | - (CALayer *)exportLayerTree:(BOOL)hidden;
14 |
15 | //! 将静态图形转换到二级层,第二级为每个路径的CAShapeLayer,不按图形分组
16 | - (CALayer *)exportLayers;
17 |
18 | //! 将指定句柄(MgShape)的图形转换到二级层,第二级为多个CAShapeLayer
19 | - (CALayer *)exportLayersForShape:(long)handle;
20 |
21 | //! 得到指定句柄(MgShape)的图形的所有路径对象(UIBezierPath)
22 | - (NSArray *)exportPathsForShape:(long)handle;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/include/NSString+Drawing.h:
--------------------------------------------------------------------------------
1 | // NSString+Drawing.h
2 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgios, BSD License
3 |
4 | #import
5 | #include
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | CGSize sizeWithAttributes6(NSString *str, NSDictionary *attrs);
12 | void drawAtPoint6(NSString *str, CGPoint point, NSDictionary *attrs);
13 | void drawInRect6(NSString *str, CGRect rect, NSDictionary *attrs);
14 | CGRect boundingRectWithSize6(NSString *str, CGSize size, NSStringDrawingOptions options,
15 | NSDictionary *attrs, NSStringDrawingContext *context);
16 |
17 | NSString *giRoundString(CGFloat num);
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/src/GiDpiUtil.mm:
--------------------------------------------------------------------------------
1 | // GiDpiUtil.cpp
2 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgios, BSD License
3 |
4 | #import
5 | #include
6 |
7 | int giGetScreenDpi()
8 | {
9 | static int dpi = 0;
10 |
11 | if (dpi == 0) {
12 | size_t size = 15;
13 | char machine[15 + 1] = "";
14 |
15 | sysctlbyname("hw.machine", machine, &size, NULL, 0);
16 |
17 | if (strcmp(machine, "i386") == 0) { // Simulator
18 | dpi = 72;
19 | } else { // Identifier: http://theiphonewiki.com/wiki/Models
20 | bool iPadMini = (strcmp(machine, "iPad2,5") == 0 ||
21 | strcmp(machine, "iPad2,6") == 0 ||
22 | strcmp(machine, "iPad2,7") == 0 ||
23 | strcmp(machine, "iPad4,4") == 0 ||
24 | strcmp(machine, "iPad4,5") == 0);
25 | BOOL iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
26 |
27 | dpi = (iPad && !iPadMini) ? 132 : 163;
28 | }
29 | }
30 |
31 | return dpi;
32 | }
33 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/src/GiImageCache.h:
--------------------------------------------------------------------------------
1 | //! \file GiImageCache.h
2 | //! \brief 定义图像对象缓存类 GiImageCache
3 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgios, BSD License
4 |
5 | #import
6 | #include "ARCMacro.h"
7 |
8 | //! 图像对象缓存类
9 | @interface GiImageCache : NSObject {
10 | NSMutableDictionary *_images;
11 | NSMutableDictionary *_spirits;
12 | }
13 |
14 | @property (nonatomic, STRONG) NSString *imagePath; //!< 图像文件的默认路径(可以没有末尾的分隔符)
15 | @property (nonatomic, STRONG) NSString *playPath; //!< 播放路径
16 |
17 | - (void)clearCachedData; //!< 释放临时数据内存
18 | + (UIImage *)getImageFromSVGFile:(NSString *)filename maxSize:(CGSize)size; //!< 得到SVG文件的图像
19 |
20 | - (UIImage *)loadImage:(NSString *)name; //!< 根据名称查找或加载图像对象
21 | - (CGSize)getImageSize:(NSString *)name; //!< 根据名称查找图像大小
22 | - (CGSize)addPNGFromResource:(NSString *)name :(NSString **)key; //!< 插入一个程序资源中的图片(name.png)
23 | - (CGSize)addSVGFromResource:(NSString *)name :(NSString **)key; //!< 插入一个程序资源中的图片(name.svg)
24 |
25 | - (CGSize)addImageFromPath:(NSString *)path :(NSString**)name; //!< 在默认位置插入一个图像文件
26 | - (CGSize)addImageFromFile:(NSString *)filename :(NSString **)name; //!< 在默认位置插入一个图像文件
27 |
28 | //! Convert tag$png:prefix%d.png to png:prefixnum.png
29 | - (void)setCurrentImage:(NSString *)spiritName newName:(NSString *)name;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVG/src/GiMagnifierView.h:
--------------------------------------------------------------------------------
1 | // GiMagnifierView.h
2 | // Copyright (c) 2012-2015, https://github.com/rhcad/vgios, BSD License
3 |
4 |
5 | #import
6 | #include "ARCMacro.h"
7 |
8 | //! 放大镜图形视图类
9 | @interface GiMagnifierView : UIView {
10 | CGFloat _topMargin;
11 | }
12 |
13 | @property (nonatomic, WEAK) UIView *viewToMagnify;
14 | @property (nonatomic) CGPoint touchPoint;
15 | @property (nonatomic) BOOL followFinger;
16 | @property (nonatomic) CGFloat scale;
17 |
18 | - (void)show;
19 | - (void)hide;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/LICENSE:
--------------------------------------------------------------------------------
1 | BSD License
2 |
3 | For TouchVGCore framework
4 |
5 | Copyright (c) 2004-2016, Zhang Yungui . All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without modification,
8 | are permitted provided that the following conditions are met:
9 |
10 | * Redistributions of source code must retain the above copyright notice, this
11 | list of conditions and the following disclaimer.
12 |
13 | * Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmd/mgaction.h:
--------------------------------------------------------------------------------
1 | //! \file mgaction.h
2 | //! \brief 定义上下文动作接口 MgActionDispatcher
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_MGACTION_H_
6 | #define TOUCHVG_MGACTION_H_
7 |
8 | //! 默认上下文动作
9 | /*! \ingroup CORE_COMMAND
10 | */
11 | typedef enum {
12 | kMgActionInvalid = 0,
13 | kMgActionSelAll = 1, //!< 全选
14 | kMgActionSelReset = 2, //!< 重选
15 | kMgActionDraw = 3, //!< 绘图
16 | kMgActionCancel = 4, //!< 取消
17 | kMgActionDelete = 5, //!< 删除
18 | kMgActionClone = 6, //!< 克隆
19 | kMgActionFixedLength = 7, //!< 定长
20 | kMgActionFreeLength = 8, //!< 不定长
21 | kMgActionLocked = 9, //!< 锁定
22 | kMgActionUnlocked = 10, //!< 解锁
23 | kMgActionEditVertex = 11, //!< 编辑顶点
24 | kMgActionHideVertex = 12, //!< 隐藏顶点
25 | kMgActionClosed = 13, //!< 闭合
26 | kMgActionOpened = 14, //!< 不闭合
27 | kMgActionAddVertex = 15, //!< 加点
28 | kMgActionDelVertex = 16, //!< 删点
29 | kMgActionGroup = 17, //!< 成组
30 | kMgActionUngroup = 18, //!< 解组
31 | kMgActionOverturn = 19, //!< 翻转
32 | kMgActionCustomized = 100 //!< 定制的起始值
33 | } MgContextAction;
34 |
35 | class MgMotion;
36 | class MgShape;
37 | class Box2d;
38 |
39 | //! 上下文动作分发接口
40 | /*! \ingroup CORE_COMMAND
41 | \interface MgActionDispatcher
42 | \see MgCmdManager, MgContextAction
43 | */
44 | struct MgActionDispatcher {
45 | virtual ~MgActionDispatcher() {}
46 | virtual bool showInSelect(const MgMotion* sender, int selState, const MgShape* shape, const Box2d& selbox) = 0;
47 | virtual bool showInDrawing(const MgMotion* sender, const MgShape* shape) = 0;
48 | virtual bool doAction(const MgMotion* sender, int action) = 0;
49 | };
50 |
51 | #endif // TOUCHVG_MGACTION_H_
52 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmd/mglocal.h:
--------------------------------------------------------------------------------
1 | //! \file mglocal.h
2 | //! \brief 定义本地化文字的辅助类 MgLocalized
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CORE_LOCALSTR_H
6 | #define TOUCHVG_CORE_LOCALSTR_H
7 |
8 | #include
9 |
10 | struct MgView;
11 |
12 | //! 本地化文字的辅助类
13 | struct MgLocalized {
14 | static std::string getString(MgView* view, const char* name);
15 | static int formatString(char *buffer, int size, MgView* view, const char *format, ...);
16 | };
17 |
18 | #endif // TOUCHVG_CORE_LOCALSTR_H
19 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbase/mgdrawrect.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawrect.h
2 | //! \brief 定义矩形绘图命令类 MgCmdDrawRect
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_RECT_H_
6 | #define TOUCHVG_CMD_DRAW_RECT_H_
7 |
8 | #include "mgcmddraw.h"
9 |
10 | //! 矩形绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgRect
13 | */
14 | class MgCmdDrawRect : public MgCommandDraw
15 | {
16 | public:
17 | MgCmdDrawRect(const char* name = Name()) : MgCommandDraw(name) {}
18 | #ifndef SWIG
19 | static const char* Name() { return "rect"; }
20 | static MgCommand* Create() { return new MgCmdDrawRect; }
21 | #endif
22 | virtual void release() { delete this; }
23 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
24 | virtual bool backStep(const MgMotion* sender);
25 | virtual bool touchBegan(const MgMotion* sender);
26 | virtual bool touchMoved(const MgMotion* sender);
27 | virtual bool touchEnded(const MgMotion* sender);
28 |
29 | protected:
30 | virtual void addRectShape(const MgMotion* sender);
31 |
32 | protected:
33 | Point2d m_startPt;
34 | };
35 |
36 | #endif // TOUCHVG_CMD_DRAW_RECT_H_
37 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/cmdbasic.h:
--------------------------------------------------------------------------------
1 | //! \file cmdbasic.h
2 | //! \brief 定义基本绘图命令工厂类 MgBasicCommands
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_BASIC_CMDS_H_
6 | #define TOUCHVG_BASIC_CMDS_H_
7 |
8 | struct MgView;
9 |
10 | //! 基本绘图命令工厂类
11 | /*! \ingroup CORE_COMMAND
12 | */
13 | class MgBasicCommands
14 | {
15 | public:
16 | //! 登记绘图命令
17 | static void registerCmds(MgView* view);
18 | };
19 |
20 | #endif // TOUCHVG_BASIC_CMDS_H_
21 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawcircle.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawcircle.h
2 | //! \brief 定义圆绘图命令类 MgCmdDrawCircle
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_CIRCLE_H_
6 | #define TOUCHVG_CMD_DRAW_CIRCLE_H_
7 |
8 | #include "mgdrawellipse.h"
9 |
10 | //! 圆绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgEllipse
13 | */
14 | class MgCmdDrawCircle : public MgCmdDrawEllipse
15 | {
16 | public:
17 | MgCmdDrawCircle(const char* name = Name()) : MgCmdDrawEllipse(name) {}
18 | #ifndef SWIG
19 | static const char* Name() { return "circle2p"; }
20 | static MgCommand* Create() { return new MgCmdDrawCircle(); }
21 | #endif
22 | virtual void release() { delete this; }
23 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
24 | };
25 |
26 | //! 三点画圆命令类
27 | /*! \ingroup CORE_COMMAND
28 | \see MgEllipse
29 | */
30 | class MgCmdDrawCircle3P : public MgCommandDraw
31 | {
32 | public:
33 | MgCmdDrawCircle3P(const char* name = Name()) : MgCommandDraw(name) {}
34 | #ifndef SWIG
35 | static const char* Name() { return "circle3p"; }
36 | static MgCommand* Create() { return new MgCmdDrawCircle3P; }
37 | #endif
38 | virtual void release() { delete this; }
39 | virtual bool touchBegan(const MgMotion* sender) { return touchBeganStep(sender); }
40 | virtual bool touchMoved(const MgMotion* sender) { return touchMovedStep(sender); }
41 | virtual bool touchEnded(const MgMotion* sender) { return touchEndedStep(sender); }
42 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
43 | virtual bool draw(const MgMotion* sender, GiGraphics* gs);
44 |
45 | protected:
46 | virtual void setStepPoint(const MgMotion* sender, int step, const Point2d& pt);
47 | virtual void drawHandles(const MgMotion* sender, GiGraphics* gs);
48 |
49 | protected:
50 | Point2d _points[3];
51 | };
52 |
53 | #endif // TOUCHVG_CMD_DRAW_CIRCLE_H_
54 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawdiamond.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawdiamond.h
2 | //! \brief 定义菱形绘图命令类 MgCmdDrawDiamond
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_DIAMOND_H_
6 | #define TOUCHVG_CMD_DRAW_DIAMOND_H_
7 |
8 | #include "mgdrawellipse.h"
9 |
10 | //! 菱形绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgDiamond
13 | */
14 | class MgCmdDrawDiamond : public MgCmdDrawEllipse
15 | {
16 | public:
17 | static const char* Name() { return "diamond"; }
18 | static MgCommand* Create() { return new MgCmdDrawDiamond; }
19 |
20 | private:
21 | MgCmdDrawDiamond() : MgCmdDrawEllipse(Name()) {}
22 | virtual void release() { delete this; }
23 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
24 | };
25 |
26 | #endif // TOUCHVG_CMD_DRAW_DIAMOND_H_
27 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawellipse.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawellipse.h
2 | //! \brief 定义椭圆绘图命令类 MgCmdDrawEllipse
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_ELLIPSE_H_
6 | #define TOUCHVG_CMD_DRAW_ELLIPSE_H_
7 |
8 | #include "mgdrawrect.h"
9 |
10 | //! 椭圆绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgEllipse
13 | */
14 | class MgCmdDrawEllipse : public MgCmdDrawRect
15 | {
16 | public:
17 | MgCmdDrawEllipse(const char* name = Name()) : MgCmdDrawRect(name) {}
18 | #ifndef SWIG
19 | static const char* Name() { return "ellipse"; }
20 | static MgCommand* Create() { return new MgCmdDrawEllipse; }
21 | #endif
22 | virtual void release() { delete this; }
23 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
24 | virtual bool draw(const MgMotion* sender, GiGraphics* gs);
25 | };
26 |
27 | #endif // TOUCHVG_CMD_DRAW_ELLIPSE_H_
28 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawfreelines.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawfreelines.h
2 | //! \brief 定义自由折线绘图命令类 MgCmdDrawFreeLines
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_FREELINES_H_
6 | #define TOUCHVG_CMD_DRAW_FREELINES_H_
7 |
8 | #include "mgcmddraw.h"
9 |
10 | //! 自由折线绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgLines
13 | */
14 | class MgCmdDrawFreeLines : public MgCommandDraw
15 | {
16 | public:
17 | static const char* Name() { return "freelines"; }
18 | static MgCommand* Create() { return new MgCmdDrawFreeLines; }
19 |
20 | private:
21 | MgCmdDrawFreeLines() : MgCommandDraw(Name()) {}
22 | virtual void release() { delete this; }
23 |
24 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
25 | virtual bool backStep(const MgMotion* sender);
26 | virtual bool draw(const MgMotion* sender, GiGraphics* gs);
27 | virtual bool touchBegan(const MgMotion* sender);
28 | virtual bool touchMoved(const MgMotion* sender);
29 | virtual bool touchEnded(const MgMotion* sender);
30 |
31 | private:
32 | bool canAddPoint(const MgMotion* sender, bool ended);
33 | };
34 |
35 | #endif // TOUCHVG_CMD_DRAW_FREELINES_H_
36 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawgrid.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawgrid.h
2 | //! \brief 定义网格绘图命令类 MgCmdDrawGrid
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_GRID_H_
6 | #define TOUCHVG_CMD_DRAW_GRID_H_
7 |
8 | #include "mgdrawrect.h"
9 |
10 | //! 网格绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgGrid
13 | */
14 | class MgCmdDrawGrid : public MgCmdDrawRect
15 | {
16 | public:
17 | static const char* Name() { return "grid"; }
18 | static MgCommand* Create() { return new MgCmdDrawGrid; }
19 |
20 | private:
21 | MgCmdDrawGrid() : MgCmdDrawRect(Name()) {}
22 | virtual void release() { delete this; }
23 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
24 | virtual bool draw(const MgMotion* sender, GiGraphics* gs);
25 | virtual bool touchBegan(const MgMotion* sender);
26 | virtual bool touchMoved(const MgMotion* sender);
27 | virtual bool touchEnded(const MgMotion* sender);
28 |
29 | virtual void addRectShape(const MgMotion* sender);
30 | };
31 |
32 | #endif // TOUCHVG_CMD_DRAW_GRID_H_
33 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawlines.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawlines.h
2 | //! \brief 定义折线绘图命令类 MgCmdDrawLines
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_LINES_H_
6 | #define TOUCHVG_CMD_DRAW_LINES_H_
7 |
8 | #include "mgcmddraw.h"
9 |
10 | //! 折线绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgLines
13 | */
14 | class MgCmdDrawLines : public MgCommandDraw
15 | {
16 | protected:
17 | MgCmdDrawLines(const char* name = Name()) : MgCommandDraw(name) {}
18 | virtual ~MgCmdDrawLines() {}
19 |
20 | public:
21 | static const char* Name() { return "lines"; }
22 | static MgCommand* Create() { return new MgCmdDrawLines; }
23 |
24 | private:
25 | virtual bool needCheckClosed() { return true; }
26 | virtual bool needEnded() { return false; }
27 |
28 | virtual void release() { delete this; }
29 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
30 | virtual bool backStep(const MgMotion* sender);
31 | virtual bool draw(const MgMotion* sender, GiGraphics* gs);
32 | virtual bool touchBegan(const MgMotion* sender);
33 | virtual bool touchMoved(const MgMotion* sender);
34 | virtual bool touchEnded(const MgMotion* sender);
35 | virtual bool click(const MgMotion* sender);
36 | virtual bool doubleClick(const MgMotion* sender);
37 | virtual bool cancel(const MgMotion* sender);
38 |
39 | private:
40 | bool checkClosed(const MgMotion* sender, const Point2d& pnt);
41 | bool canAddPoint(const MgMotion* sender, const Point2d& pnt);
42 |
43 | private:
44 | int m_index;
45 | };
46 |
47 | #endif // TOUCHVG_CMD_DRAW_LINES_H_
48 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawparallel.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawparallel.h
2 | //! \brief 定义平行四边形绘图命令类 MgCmdParallel
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_PARALLEL_H_
6 | #define TOUCHVG_CMD_DRAW_PARALLEL_H_
7 |
8 | #include "mgcmddraw.h"
9 |
10 | //! 平行四边形绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgParallel
13 | */
14 | class MgCmdParallel : public MgCommandDraw
15 | {
16 | public:
17 | static const char* Name() { return "parallel"; }
18 | static MgCommand* Create() { return new MgCmdParallel; }
19 | private:
20 | MgCmdParallel() : MgCommandDraw(Name()) {}
21 | virtual void release() { delete this; }
22 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
23 | virtual bool touchBegan(const MgMotion* sender) { return touchBeganStep(sender); }
24 | virtual bool touchMoved(const MgMotion* sender) { return touchMovedStep(sender); }
25 | virtual bool touchEnded(const MgMotion* sender) { return touchEndedStep(sender); }
26 | };
27 |
28 | #endif // TOUCHVG_CMD_DRAW_PARALLEL_H_
29 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawpolygon.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawpolygon.h
2 | //! \brief 定义多边形绘图命令类 MgCmdDrawPolygon
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_POLYGON_H_
6 | #define TOUCHVG_CMD_DRAW_POLYGON_H_
7 |
8 | #include "mgdrawlines.h"
9 |
10 | //! 多边形绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgLines
13 | */
14 | class MgCmdDrawPolygon : public MgCmdDrawLines
15 | {
16 | protected:
17 | MgCmdDrawPolygon(const char* name = Name(), int maxEdges = 20)
18 | : MgCmdDrawLines(name), _maxEdges(maxEdges) {}
19 |
20 | public:
21 | static const char* Name() { return "polygon"; }
22 | static MgCommand* Create() { return new MgCmdDrawPolygon; }
23 |
24 | private:
25 | virtual bool needCheckClosed() { return false; }
26 | virtual bool needEnded() { return (int)m_step >= _maxEdges - 1; }
27 |
28 | virtual void release() { delete this; }
29 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
30 |
31 | int _maxEdges;
32 | };
33 |
34 | #endif // TOUCHVG_CMD_DRAW_POLYGON_H_
35 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawquadrangle.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawquadrangle.h
2 | //! \brief 定义四边形绘图命令类 MgCmdDrawQuadrangle
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_QUADRANGLE_H_
6 | #define TOUCHVG_CMD_DRAW_QUADRANGLE_H_
7 |
8 | #include "mgdrawpolygon.h"
9 |
10 | //! 四边形绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgLines
13 | */
14 | class MgCmdDrawQuadrangle : public MgCmdDrawPolygon
15 | {
16 | public:
17 | static const char* Name() { return "quadrangle"; }
18 | static MgCommand* Create() { return new MgCmdDrawQuadrangle; }
19 |
20 | private:
21 | MgCmdDrawQuadrangle() : MgCmdDrawPolygon(Name(), 4) {}
22 | virtual void release() { delete this; }
23 | };
24 |
25 | #endif // TOUCHVG_CMD_DRAW_QUADRANGLE_H_
26 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawsplines.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawsplines.h
2 | //! \brief 定义样条曲线绘图命令类 MgCmdDrawSplines
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_SPLINES_H_
6 | #define TOUCHVG_CMD_DRAW_SPLINES_H_
7 |
8 | #include "mgcmddraw.h"
9 |
10 | //! 样条曲线绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgSplines
13 | */
14 | class MgCmdDrawSplines : public MgCommandDraw
15 | {
16 | protected:
17 | MgCmdDrawSplines(const char* name = Name(), bool freehand = true);
18 | virtual ~MgCmdDrawSplines() {}
19 |
20 | public:
21 | static const char* Name() { return "splines"; }
22 | static MgCommand* Create() { return new MgCmdDrawSplines; }
23 |
24 | private:
25 | virtual void release() { delete this; }
26 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
27 | virtual bool backStep(const MgMotion* sender);
28 | virtual bool draw(const MgMotion* sender, GiGraphics* gs);
29 | virtual bool touchBegan(const MgMotion* sender);
30 | virtual bool touchMoved(const MgMotion* sender);
31 | virtual bool touchEnded(const MgMotion* sender);
32 | virtual bool click(const MgMotion* sender);
33 | virtual bool cancel(const MgMotion* sender);
34 | virtual bool mouseHover(const MgMotion* sender);
35 |
36 | private:
37 | bool canAddPoint(const MgMotion* sender, bool ended);
38 |
39 | bool m_freehand;
40 | };
41 |
42 | //! 用点击绘制样条曲线的命令类
43 | /*! \ingroup CORE_COMMAND
44 | \see MgSplines
45 | */
46 | class MgCmdDrawSplineMouse : public MgCmdDrawSplines
47 | {
48 | public:
49 | static const char* Name() { return "spline_mouse"; }
50 | static MgCommand* Create() { return new MgCmdDrawSplineMouse; }
51 | private:
52 | MgCmdDrawSplineMouse() : MgCmdDrawSplines(Name(), false) {}
53 | };
54 |
55 | #endif // TOUCHVG_CMD_DRAW_SPLINES_H_
56 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawsquare.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawsquare.h
2 | //! \brief 定义正方形绘图命令类 MgCmdDrawSquare
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_SQUARE_H_
6 | #define TOUCHVG_CMD_DRAW_SQUARE_H_
7 |
8 | #include "mgdrawrect.h"
9 |
10 | //! 正方形绘图命令类
11 | /*! \ingroup CORE_COMMAND
12 | \see MgRect
13 | */
14 | class MgCmdDrawSquare : public MgCmdDrawRect
15 | {
16 | public:
17 | static const char* Name() { return "square"; }
18 | static MgCommand* Create() { return new MgCmdDrawSquare; }
19 |
20 | private:
21 | MgCmdDrawSquare(const char* name = Name()) : MgCmdDrawRect(name) {}
22 | virtual void release() { delete this; }
23 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
24 | };
25 |
26 | #endif // TOUCHVG_CMD_DRAW_SQUARE_H_
27 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdbasic/mgdrawtriang.h:
--------------------------------------------------------------------------------
1 | //! \file mgdrawtriang.h
2 | //! \brief 定义三角形绘图命令 MgCmdDrawTriangle
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMD_DRAW_TRIANGLE_H_
6 | #define TOUCHVG_CMD_DRAW_TRIANGLE_H_
7 |
8 | #include "mgcmddraw.h"
9 |
10 | //! 三角形绘图命令
11 | /*! \ingroup CORE_COMMAND
12 | */
13 | class MgCmdDrawTriangle : public MgCommandDraw
14 | {
15 | public:
16 | static const char* Name() { return "triangle"; }
17 | static MgCommand* Create() { return new MgCmdDrawTriangle; }
18 |
19 | private:
20 | MgCmdDrawTriangle(const char* name = Name()) : MgCommandDraw(name) {}
21 | virtual void release() { delete this; }
22 | virtual bool initialize(const MgMotion* sender, MgStorage* s);
23 | virtual bool touchBegan(const MgMotion* sender);
24 | virtual bool touchMoved(const MgMotion* sender);
25 | virtual bool touchEnded(const MgMotion* sender);
26 | };
27 |
28 | #endif // TOUCHVG_CMD_DRAW_TRIANGLE_H_
29 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdmgr/mgcmdmgrfactory.h:
--------------------------------------------------------------------------------
1 | //! \file mgcmdmgrfactory.h
2 | //! \brief 定义命令管理器的创建类 MgCmdManagerFactory
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMDMGR_FACTORY_H_
6 | #define TOUCHVG_CMDMGR_FACTORY_H_
7 |
8 | struct MgCmdManager;
9 |
10 | //! 命令管理器的创建类
11 | /*! \ingroup CORE_COMMAND
12 | */
13 | class MgCmdManagerFactory {
14 | public:
15 | //! 创建命令管理器
16 | static MgCmdManager* create();
17 | };
18 |
19 | #endif // TOUCHVG_CMDMGR_FACTORY_H_
20 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/cmdobserver/cmdsubject.h:
--------------------------------------------------------------------------------
1 | //! \file cmdsubject.h
2 | //! \brief 定义命令扩展目标接口 CmdSubject
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CMDSUBJECT_H_
6 | #define TOUCHVG_CMDSUBJECT_H_
7 |
8 | #include "cmdobserver.h"
9 |
10 | //! 命令扩展目标接口
11 | /*! \ingroup CORE_COMMAND
12 | */
13 | struct CmdSubject : public CmdObserver {
14 | //! 注册观察者
15 | virtual void registerObserver(CmdObserver* observer) = 0;
16 | //! 注销观察者
17 | virtual void unregisterObserver(CmdObserver* observer) = 0;
18 |
19 | //! 注册命名观察者
20 | virtual bool registerNamedObserver(const char* name, CmdObserver* observer) = 0;
21 | //! 查找命名观察者
22 | virtual CmdObserver* findNamedObserver(const char* name) = 0;
23 | };
24 |
25 | #endif // TOUCHVG_CMDSUBJECT_H_
26 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/export/svgcanvas.h:
--------------------------------------------------------------------------------
1 | //! \file svgcanvas.h
2 | //! \brief 定义输出SVG文件的画布适配器类 GiSvgCanvas
3 | // Copyright (c) 2013-2014, Zhang Yungui
4 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
5 |
6 | #ifndef TOUCHVG_CORE_SVGCANVAS_H_
7 | #define TOUCHVG_CORE_SVGCANVAS_H_
8 |
9 | #include "gicanvas.h"
10 |
11 | //! 输出SVG文件的画布适配器类
12 | /*! \ingroup CORE_STORAGE
13 | */
14 | class GiSvgCanvas : public GiCanvas
15 | {
16 | public:
17 | GiSvgCanvas();
18 | virtual ~GiSvgCanvas();
19 |
20 | bool open(const char* filename, int width, int height);
21 | bool close();
22 |
23 | private:
24 | virtual void setPen(int argb, float width, int style, float phase, float orgw);
25 | virtual void setBrush(int argb, int style);
26 | virtual void clearRect(float x, float y, float w, float h);
27 | virtual void drawRect(float x, float y, float w, float h, bool stroke, bool fill);
28 | virtual void drawLine(float x1, float y1, float x2, float y2);
29 | virtual void drawEllipse(float x, float y, float w, float h, bool stroke, bool fill);
30 | virtual void beginPath();
31 | virtual void moveTo(float x, float y);
32 | virtual void lineTo(float x, float y);
33 | virtual void bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y);
34 | virtual void quadTo(float cpx, float cpy, float x, float y);
35 | virtual void closePath();
36 | virtual void drawPath(bool stroke, bool fill);
37 | virtual void saveClip();
38 | virtual void restoreClip();
39 | virtual bool clipRect(float x, float y, float w, float h);
40 | virtual bool clipPath();
41 | virtual bool drawHandle(float x, float y, int type, float angle);
42 | virtual bool drawBitmap(const char* name, float xc, float yc,
43 | float w, float h, float angle);
44 | virtual float drawTextAt(const char* text, float x, float y, float h, int align, float angle);
45 | virtual bool beginShape(int type, int sid, int version, float x, float y, float w, float h);
46 | virtual void endShape(int type, int sid, float x, float y);
47 |
48 | private:
49 | struct Impl;
50 | Impl* im;
51 | };
52 |
53 | #endif // TOUCHVG_CORE_SVGCANVAS_H_
54 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/geom/mgtol.h:
--------------------------------------------------------------------------------
1 | //! \file mgtol.h
2 | //! \brief 定义容差类 Tol
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_MGTOL_H_
6 | #define TOUCHVG_MGTOL_H_
7 |
8 | #include "mgdef.h"
9 |
10 | //! 容差类
11 | /*!
12 | \ingroup GEOM_CLASS
13 | 容差类含有长度容差和矢量容差。\n
14 | 长度容差表示长度小于该值就认为是零长度,或两点距离小于该值就认为重合。\n
15 | 矢量容差表示两个弧度角度小于该值就认为是相等,由于矢量容差一般很小,
16 | 故对于矢量容差a,有a≈sin(a)≈tan(a),cos(a)≈1。
17 | */
18 | class Tol
19 | {
20 | public:
21 | //! 全局缺省容差
22 | /*! 该容差是数学几何库中很多函数的默认容差,可以修改该对象的容差值
23 | */
24 | static Tol gTol() {
25 | static Tol tol;
26 | return tol;
27 | }
28 |
29 | //! 最小容差
30 | /*! 该容差的长度容差值和矢量容差值都为 _MGZERO
31 | */
32 | static Tol minTol() {
33 | static const Tol tol(0, 0);
34 | return tol;
35 | }
36 |
37 | //! 构造默认容差
38 | /*! 默认构造函数构造出的长度容差值为_MGZERO*2,矢量容差值为1e-4f
39 | */
40 | Tol() : mTolPoint(_MGZERO*2), mTolVector(1e-4f) {}
41 |
42 | //! 给定容差构造
43 | /*! 如果给定容差值小于 _MGZERO,将取最小容差值
44 | \param tolPoint 长度容差值,正数
45 | \param tolVector 矢量容差值,正数,一般取小于0.1的数
46 | */
47 | Tol(float tolPoint, float tolVector = 1e-4f) : mTolPoint(_MGZERO*2) {
48 | setEqualPoint(tolPoint);
49 | setEqualVector(tolVector);
50 | }
51 |
52 | //! 返回长度容差
53 | float equalPoint() const { return mTolPoint; }
54 |
55 | //! 返回矢量容差
56 | float equalVector() const { return mTolVector; }
57 |
58 | //! 设置长度容差
59 | /*! 如果给定容差值小于 _MGZERO,将取最小容差值
60 | \param tol 长度容差值,正数
61 | */
62 | void setEqualPoint(float tol) {
63 | if (tol < _MGZERO)
64 | tol = _MGZERO;
65 | if (!mgEquals(mTolPoint, tol))
66 | mTolPoint = tol;
67 | }
68 |
69 | //! 设置矢量容差
70 | /*! 如果给定容差值小于 _MGZERO,将取最小容差值
71 | \param tol 矢量容差值,正数,一般取小于0.1的数
72 | */
73 | void setEqualVector(float tol) {
74 | if (tol < _MGZERO)
75 | tol = _MGZERO;
76 | mTolVector = tol;
77 | }
78 |
79 | private:
80 | float mTolPoint; //!< 长度容差
81 | float mTolVector; //!< 矢量容差
82 | };
83 |
84 | #endif // TOUCHVG_MGTOL_H_
85 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgcshapes.h:
--------------------------------------------------------------------------------
1 | //! \file mgcshapes.h
2 | //! \brief 定义基本图形的工厂类 MgCoreShapeFactory
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
5 |
6 | #ifndef TOUCHVG_CORESHAPE_FACTORY_H_
7 | #define TOUCHVG_CORESHAPE_FACTORY_H_
8 |
9 | class MgBaseShape;
10 |
11 | //! 基本图形的工厂类
12 | /*! \ingroup CORE_SHAPE
13 | */
14 | class MgCoreShapeFactory
15 | {
16 | public:
17 | MgCoreShapeFactory();
18 | ~MgCoreShapeFactory();
19 |
20 | //! 根据指定的图形类型创建图形对象
21 | MgBaseShape* createShape(int type);
22 |
23 | #ifndef SWIG
24 | //! 登记类型号对应的图形创建函数,creator为NULL则取消登记
25 | void registerShape(int type, MgBaseShape* (*creator)());
26 | #endif
27 |
28 | private:
29 | struct Impl;
30 | Impl* impl;
31 | };
32 |
33 | #endif // TOUCHVG_CORESHAPE_FACTORY_H_
34 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgdiamond.h:
--------------------------------------------------------------------------------
1 | //! \file mgdiamond.h
2 | //! \brief 定义菱形图形类 MgDiamond
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // License: LGPL, https://github.com/rhcad/vgcore
5 |
6 | #ifndef TOUCHVG_DIAMOND_SHAPE_H_
7 | #define TOUCHVG_DIAMOND_SHAPE_H_
8 |
9 | #include "mgrect.h"
10 |
11 | //! 菱形图形类
12 | /*! \ingroup CORE_SHAPE
13 | */
14 | class MgDiamond : public MgBaseRect
15 | {
16 | MG_INHERIT_CREATE(MgDiamond, MgBaseRect, 14)
17 | protected:
18 | int _getHandleCount() const;
19 | Point2d _getHandlePoint(int index) const;
20 | bool _setHandlePoint(int index, const Point2d& pt, float tol);
21 | int _getHandleType(int index) const;
22 | bool _isHandleFixed(int index) const;
23 | void _update();
24 | float _hitTest(const Point2d& pt, float tol, MgHitResult& res) const;
25 | bool _hitTestBox(const Box2d& rect) const;
26 | bool _rotateHandlePoint(int index, const Point2d& pt);
27 | void _output(MgPath& path) const;
28 | };
29 |
30 | #endif // TOUCHVG_DIAMOND_SHAPE_H_
31 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgdot.h:
--------------------------------------------------------------------------------
1 | //! \file mgdot.h
2 | //! \brief 定义点图形类 MgDot
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // License: LGPL, https://github.com/rhcad/vgcore
5 |
6 | #ifndef TOUCHVG_DOT_SHAPE_H_
7 | #define TOUCHVG_DOT_SHAPE_H_
8 |
9 | #include "mgbasesp.h"
10 |
11 | //! 点图形类
12 | /*! \ingroup CORE_SHAPE
13 | */
14 | class MgDot : public MgBaseShape
15 | {
16 | MG_DECLARE_CREATE(MgDot, MgBaseShape, 31)
17 | public:
18 | //! 返回点图案类型
19 | int getPointType() const { return _type; }
20 |
21 | //! 设置点图案类型. 0:默认, 1-19: GiHandleTypes+1, kGiHandleCustom~99:应用自定义图片
22 | void setPointType(int type) { _type = type; }
23 |
24 | protected:
25 | bool _isClosed() const { return false; }
26 | void _output(MgPath& path) const;
27 | bool _save(MgStorage* s) const;
28 | bool _load(MgShapeFactory* factory, MgStorage* s);
29 |
30 | private:
31 | Point2d _point;
32 | int _type;
33 | };
34 |
35 | #endif // TOUCHVG_DOT_SHAPE_H_
36 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mggrid.h:
--------------------------------------------------------------------------------
1 | //! \file mggrid.h
2 | //! \brief 定义网格图形类
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_GRIDSHAPE_H_
6 | #define TOUCHVG_GRIDSHAPE_H_
7 |
8 | #include "mgrect.h"
9 |
10 | //! 网格图形类
11 | /*! \ingroup CORE_SHAPE
12 | */
13 | class MgGrid : public MgBaseRect
14 | {
15 | MG_INHERIT_CREATE(MgGrid, MgBaseRect, 20)
16 | public:
17 | virtual int snap(Point2d& pnt, Point2d& dist) const;
18 | const Vector2d& getCellSize() const { return m_cell; }
19 | bool isValid(float tol) const;
20 |
21 | protected:
22 | virtual void setFlag(MgShapeBit bit, bool on);
23 | void _copy(const MgGrid& src);
24 | bool _equals(const MgGrid& src) const;
25 | void _clear();
26 | bool _save(MgStorage* s) const;
27 | bool _load(MgShapeFactory* factory, MgStorage* s);
28 | int _getHandleCount() const;
29 | Point2d _getHandlePoint(int index) const;
30 | bool _setHandlePoint(int index, const Point2d& pt, float tol);
31 | bool isFloatingCommand() { return true; }
32 |
33 | protected:
34 | Vector2d m_cell;
35 | };
36 |
37 | #endif // TOUCHVG_GRIDSHAPE_H_
38 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgobject.h:
--------------------------------------------------------------------------------
1 | //! \file mgobject.h
2 | //! \brief 定义图形对象基类 MgObject
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_MGOBJECT_H_
6 | #define TOUCHVG_MGOBJECT_H_
7 |
8 | //! 图形对象基类
9 | /*! \ingroup CORE_SHAPE
10 | */
11 | class MgObject
12 | {
13 | public:
14 | //! 复制出一个新对象
15 | virtual MgObject* clone() const = 0;
16 |
17 | //! 复制对象数据
18 | virtual void copy(const MgObject& src) = 0;
19 |
20 | //! 释放引用计数,为0时销毁对象
21 | virtual void release() = 0;
22 |
23 | //! 添加引用计数
24 | virtual void addRef() = 0;
25 |
26 | //! 比较与另一同类对象是否相同
27 | virtual bool equals(const MgObject& src) const = 0;
28 |
29 | //! 返回对象类型
30 | virtual int getType() const = 0;
31 |
32 | //! 返回是否能转化为指定类型的对象,即本类为指定类或其派生类
33 | virtual bool isKindOf(int type) const = 0;
34 |
35 | #ifndef SWIG
36 | MgObject& operator=(const MgObject& src) { copy(src); return *this; }
37 | bool operator==(const MgObject& src) const { return equals(src); }
38 | bool operator!=(const MgObject& src) const { return !equals(src); }
39 |
40 | template static void release_pointer(T*& p) { if (p) { p->release(); p = (T*)0; } }
41 | #endif // SWIG
42 |
43 | protected:
44 | virtual ~MgObject() {}
45 | };
46 |
47 | #endif // TOUCHVG_MGOBJECT_H_
48 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgparallel.h:
--------------------------------------------------------------------------------
1 | //! \file mgparallel.h
2 | //! \brief 定义平行四边形图形类 MgParallel
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // License: LGPL, https://github.com/rhcad/vgcore
5 |
6 | #ifndef TOUCHVG_PARALLEL_SHAPE_H_
7 | #define TOUCHVG_PARALLEL_SHAPE_H_
8 |
9 | #include "mgbasesp.h"
10 |
11 | //! 平行四边形图形类
12 | /*! \ingroup CORE_SHAPE
13 | */
14 | class MgParallel : public MgBaseShape
15 | {
16 | MG_DECLARE_CREATE(MgParallel, MgBaseShape, 17)
17 | public:
18 | //! 返回中心点
19 | Point2d getCenter() const { return (_points[0] + _points[2]) / 2; }
20 |
21 | //! 返回矩形框,是本对象未旋转时的形状
22 | Box2d getRect() const { return Box2d(getCenter(), getWidth(), getHeight()); }
23 |
24 | //! 返回宽度
25 | float getWidth() const { return _points[0].distanceTo(_points[1]); }
26 |
27 | //! 返回高度
28 | float getHeight() const { return _points[2].distanceTo(_points[1]); }
29 |
30 | //! 返回角度, [-PI, PI)
31 | float angle() const { return (_points[2] - _points[3]).angleTo2(_points[0] - _points[3]); }
32 |
33 | //! 返回是否为空矩形
34 | bool isEmpty(float minDist) const {
35 | return getWidth() <= minDist || getHeight() <= minDist; }
36 |
37 | #ifndef SWIG
38 | virtual const Point2d* getPoints() const { return _points; }
39 | #endif
40 |
41 | protected:
42 | bool _isClosed() const { return true; }
43 | int _getHandleCount() const;
44 | Point2d _getHandlePoint(int index) const;
45 | bool _setHandlePoint(int index, const Point2d& pt, float tol);
46 | int _getHandleType(int index) const;
47 | bool _isHandleFixed(int index) const;
48 | bool _offset(const Vector2d& vec, int segment);
49 | bool _rotateHandlePoint(int index, const Point2d& pt);
50 | bool _hitTestBox(const Box2d& rect) const;
51 | void _output(MgPath& path) const;
52 | bool _save(MgStorage* s) const;
53 | bool _load(MgShapeFactory* factory, MgStorage* s);
54 |
55 | protected:
56 | Point2d _points[4]; // 从左上角起顺时针的四个角点
57 | };
58 |
59 | #endif // TOUCHVG_PARALLEL_SHAPE_H_
60 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgpathsp.h:
--------------------------------------------------------------------------------
1 | //! \file mgpathsp.h
2 | //! \brief 定义路径图形 MgPathShape
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // License: LGPL, https://github.com/rhcad/vgcore
5 |
6 | #ifndef TOUCHVG_PATH_SHAPE_H_
7 | #define TOUCHVG_PATH_SHAPE_H_
8 |
9 | #include "mgbasesp.h"
10 |
11 | //! 路径图形类
12 | /*! \ingroup CORE_SHAPE
13 | */
14 | class MgPathShape : public MgBaseShape
15 | {
16 | MG_DECLARE_CREATE(MgPathShape, MgBaseShape, 32)
17 | public:
18 | //! 返回路径对象
19 | const MgPath& pathc() const { return _path; }
20 | MgPath& path() { return _path; }
21 |
22 | //! 用SVG路径的d坐标序列设置形状
23 | bool importSVGPath(const char* d);
24 |
25 | //! 输出SVG路径的d坐标序列
26 | int exportSVGPath(char* buf, int size) const;
27 | static int exportSVGPath(const MgPath& path, char* buf, int size);
28 |
29 | #ifndef SWIG
30 | virtual bool isCurve() const;
31 | #endif
32 |
33 | protected:
34 | bool _isClosed() const;
35 | bool _hitTestBox(const Box2d& rect) const;
36 | void _output(MgPath& path) const { path.append(_path); }
37 | bool _save(MgStorage* s) const;
38 | bool _load(MgShapeFactory* factory, MgStorage* s);
39 |
40 | private:
41 | MgPath _path;
42 | };
43 |
44 | #endif // TOUCHVG_PATH_SHAPE_H_
45 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgrdrect.h:
--------------------------------------------------------------------------------
1 | //! \file mgrdrect.h
2 | //! \brief 定义圆角矩形类 MgRoundRect
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // License: LGPL, https://github.com/rhcad/vgcore
5 |
6 | #ifndef TOUCHVG_ROUNDRECT_SHAPE_H_
7 | #define TOUCHVG_ROUNDRECT_SHAPE_H_
8 |
9 | #include "mgrect.h"
10 |
11 | //! 圆角矩形类
12 | /*! \ingroup CORE_SHAPE
13 | */
14 | class MgRoundRect : public MgBaseRect
15 | {
16 | MG_INHERIT_CREATE(MgRoundRect, MgBaseRect, 13)
17 | public:
18 | //! 返回X圆角半径
19 | float getRadiusX() const { return _rx; }
20 |
21 | //! 返回Y圆角半径
22 | float getRadiusY() const { return _ry; }
23 |
24 | //! 设置圆角半径
25 | void setRadius(float rx, float ry = 0.0);
26 |
27 | #ifndef SWIG
28 | virtual bool isCurve() const;
29 | #endif
30 |
31 | protected:
32 | void _copy(const MgRoundRect& src);
33 | bool _equals(const MgRoundRect& src) const;
34 | void _clear();
35 | float _hitTest(const Point2d& pt, float tol, MgHitResult& res) const;
36 | void _output(MgPath& path) const;
37 | bool _save(MgStorage* s) const;
38 | bool _load(MgShapeFactory* factory, MgStorage* s);
39 |
40 | protected:
41 | float _rx;
42 | float _ry;
43 | };
44 |
45 | #endif // TOUCHVG_ROUNDRECT_SHAPE_H_
46 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgshapetype.h:
--------------------------------------------------------------------------------
1 | //! \file mgshapetype.h
2 | //! \brief 定义图形类型号 MgShapeType
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_SHAPETYPE_H_
6 | #define TOUCHVG_SHAPETYPE_H_
7 |
8 | //! 基本图形的类型号
9 | /*! \ingroup CORE_SHAPE
10 | 1-40为内置图形类型,41以上为其他应用可用的类型号
11 | */
12 | typedef enum {
13 | kMgShapeMultiType = 9999, //!< 混合图形类型
14 | kMgShapeNone = 0, //!< 没有图形
15 | kMgShapeList = 1, //!< 图形列表, MgShapes
16 | kMgShapeWrapper = 2, //!< 封装图形, MgShape
17 | kMgShapeBase = 3, //!< 图形基类, MgBaseShape
18 | kMgShapeBaseRect = 4, //!< 矩形基类, MgBaseRect
19 | kMgShapeBaseLines = 5, //!< 折线基类, MgBaseLines
20 | kMgShapeComposite = 6, //!< 复合图形, MgComposite
21 | kMgShapeLayer = 7, //!< 图层, MgLayer
22 | kMgShapeDoc = 8, //!< 图形文档, MgShapeDoc
23 |
24 | kMgShapeGroup = 9, //!< 成组图形, MgGroup
25 | kMgShapeLine = 10, //!< 线段, MgLine
26 | kMgShapeRect = 11, //!< 矩形、正方形, MgRect
27 | kMgShapeEllipse = 12, //!< 椭圆、圆, MgEllipse
28 | kMgShapeRoundRect = 13, //!< 圆角矩形, MgRoundRect
29 | kMgShapeDiamond = 14, //!< 菱形, MgDiamond
30 | kMgShapeLines = 15, //!< 折线、多边形, MgLines
31 | kMgShapeSplines = 16, //!< 二次样条曲线类, MgSplines
32 | kMgShapeParallel = 17, //!< 平行四边形, MgParallel
33 | kMgShapeImage = 18, //!< 图像矩形, MgImageShape
34 | kMgShapeArc = 19, //!< 圆弧, MgArc
35 | kMgShapeGrid = 20, //!< 网格, MgGrid
36 |
37 | kMgShapeRecord = 30, //!< 录制, MgRecordShape
38 | kMgShapeDot = 31, //!< 点, MgDot
39 | kMgShapePath = 32, //!< 路径, MgPathShape
40 | } MgShapeType;
41 |
42 | #endif // TOUCHVG_SHAPETYPE_H_
43 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/gshape/mgsplines.h:
--------------------------------------------------------------------------------
1 | //! \file mgsplines.h
2 | //! \brief 定义二次样条曲线类 MgSplines
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // License: LGPL, https://github.com/rhcad/vgcore
5 |
6 | #ifndef TOUCHVG_SPLINES_SHAPE_H_
7 | #define TOUCHVG_SPLINES_SHAPE_H_
8 |
9 | #include "mglines.h"
10 |
11 | //! 二次样条曲线类
12 | /*! \ingroup CORE_SHAPE
13 | */
14 | class MgSplines : public MgBaseLines
15 | {
16 | MG_INHERIT_CREATE(MgSplines, MgBaseLines, 16)
17 | public:
18 |
19 | bool smooth(const Matrix2d& m2d, float tol);
20 | int smoothForPoints(int count, const Point2d* points, const Matrix2d& m2d, float tol);
21 | void clearVectors();
22 | #ifndef SWIG
23 | const Vector2d* getVectors() const { return _knotvs; }
24 | virtual bool isCurve() const { return true; }
25 | virtual bool resize(int count);
26 | virtual bool addPoint(const Point2d& pt);
27 | virtual bool insertPoint(int segment, const Point2d& pt);
28 | virtual bool removePoint(int index);
29 | #endif
30 |
31 | protected:
32 | void _copy(const MgSplines& src);
33 | bool _equals(const MgSplines& src) const;
34 | void _transform(const Matrix2d& mat);
35 | void _clear();
36 | void _setPoint(int index, const Point2d& pt);
37 | bool _setHandlePoint(int index, const Point2d& pt, float tol);
38 | float _hitTest(const Point2d& pt, float tol, MgHitResult& res) const;
39 | bool _hitTestBox(const Box2d& rect) const;
40 | void _output(MgPath& path) const;
41 | bool _save(MgStorage* s) const;
42 | bool _load(MgShapeFactory* factory, MgStorage* s);
43 |
44 | Vector2d* _knotvs;
45 | };
46 |
47 | #endif // TOUCHVG_SPLINES_SHAPE_H_
48 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/mglog.h:
--------------------------------------------------------------------------------
1 | // mglog.h
2 |
3 | #ifndef TOUCHVG_LOG_H
4 | #define TOUCHVG_LOG_H
5 |
6 | #ifndef LOGD
7 |
8 | #ifdef __ANDROID__
9 |
10 | #include
11 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,"vgjni",__VA_ARGS__)
12 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"vgjni",__VA_ARGS__)
13 |
14 | #elif defined(__APPLE__)
15 |
16 | #include
17 |
18 | #define __CLOG_VARGS_LOG(LEVEL) \
19 | va_list ap; \
20 | va_start(ap, fmt); \
21 | __clog_log(LEVEL, fmt, ap); \
22 | va_end(ap);
23 |
24 | static inline void __clog_log(int level, const char * fmt, va_list ap) {
25 | aslmsg msg;
26 | static aslclient __clog_client = (aslclient)0;
27 |
28 | if (!__clog_client) {
29 | __clog_client = asl_open("touchvg", "com.apple.console", ASL_OPT_STDERR | ASL_OPT_NO_DELAY);
30 | }
31 | if (__clog_client) {
32 | msg = asl_new(ASL_TYPE_MSG);
33 | asl_set(msg, ASL_KEY_FACILITY, "com.apple.console");
34 | asl_vlog(__clog_client, msg, level, fmt, ap);
35 | asl_free(msg);
36 | }
37 | }
38 |
39 | inline void LOGD(const char * fmt, ...) {
40 | __CLOG_VARGS_LOG(ASL_LEVEL_DEBUG);
41 | }
42 | inline void LOGE(const char * fmt, ...) {
43 | __CLOG_VARGS_LOG(ASL_LEVEL_ERR);
44 | }
45 |
46 | #else
47 | #define NO_LOGD
48 | #define LOGD(...)
49 | #define LOGE(...)
50 | #endif
51 |
52 | #endif // LOGD
53 |
54 | #endif // TOUCHVG_LOG_H
55 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/mgstrcallback.h:
--------------------------------------------------------------------------------
1 | //! \file mgstrcallback.h
2 | //! \brief 定义获取字符串的回调接口 MgStringCallback
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_CORE_STR_CALLBACK_H
6 | #define TOUCHVG_CORE_STR_CALLBACK_H
7 |
8 | //! 获取字符串的回调接口,可避免JNI串泄露
9 | /*! \ingroup CORE_VIEW
10 | \interface MgStringCallback
11 | */
12 | struct MgStringCallback {
13 | virtual ~MgStringCallback() {}
14 | virtual void onGetString(const char* text) = 0;
15 | };
16 |
17 | #endif // TOUCHVG_CORE_STR_CALLBACK_H
18 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/mgvector.h:
--------------------------------------------------------------------------------
1 | //! \file mgvector.h
2 | //! \brief Template vector definition for SWIG.
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef SWIG_MGVECTOR_H
6 | #define SWIG_MGVECTOR_H
7 |
8 | //! Template vector definition for SWIG.
9 | template class mgvector {
10 | private:
11 | T *_v;
12 | int _n;
13 | public:
14 | ~mgvector() {
15 | delete[] _v;
16 | }
17 | mgvector(int n = 0) {
18 | _v = n > 0 ? new T[n] : (T*)0;
19 | _n = n;
20 | for (int i = 0; i < n; i++)
21 | _v[i] = (T)0;
22 | }
23 | void setSize(int n) {
24 | if (n != _n) {
25 | delete[] _v;
26 | _v = n > 0 ? new T[n] : (T*)0;
27 | _n = n;
28 | for (int i = 0; i < n; i++)
29 | _v[i] = (T)0;
30 | }
31 | }
32 | template
33 | mgvector(const T2 *v, int n) : _v((T*)0), _n(0) {
34 | if (v && n > 0) {
35 | _v = new T[n];
36 | _n = n;
37 | for (int i = 0; i < n; i++)
38 | _v[i] = (T)v[i];
39 | }
40 | }
41 | mgvector(T v1, T v2) {
42 | _v = new T[2];
43 | _n = 2;
44 | _v[0] = v1;
45 | _v[1] = v2;
46 | }
47 | mgvector(T v1, T v2, T v3, T v4) {
48 | _v = new T[4];
49 | _n = 4;
50 | _v[0] = v1;
51 | _v[1] = v2;
52 | _v[2] = v3;
53 | _v[3] = v4;
54 | }
55 | #ifndef SWIG
56 | T *address() { return _v; }
57 | const T *address() const { return _v; }
58 | #endif
59 | int count() const {
60 | return _n;
61 | }
62 | T get(int index) const {
63 | return (index >= 0 && index < _n) ? _v[index] : (T)0;
64 | }
65 | void set(int index, T value) {
66 | if (index >= 0 && index < _n) {
67 | _v[index] = value;
68 | }
69 | }
70 | void set(int index, T v1, T v2) {
71 | if (index >= 0 && index + 1 < _n) {
72 | _v[index] = v1;
73 | _v[index+1] = v2;
74 | }
75 | }
76 | };
77 |
78 | #endif // SWIG_MGVECTOR_H
79 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/shape/mgbasicspreg.h:
--------------------------------------------------------------------------------
1 | //! \file mgbasicspreg.h
2 | //! \brief 定义基本图形的工厂类 MgBasicShapes
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_BASICSHAPE_FACTORY_H_
6 | #define TOUCHVG_BASICSHAPE_FACTORY_H_
7 |
8 | #include "mgspfactory.h"
9 |
10 | //! 基本图形的工厂类
11 | /*! \ingroup CORE_SHAPE
12 | */
13 | class MgBasicShapes
14 | {
15 | public:
16 | //! 登记图形类型
17 | static void registerShapes(MgShapeFactory* factory);
18 | };
19 |
20 | #endif // TOUCHVG_BASICSHAPE_FACTORY_H_
21 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/shape/mgbasicsps.h:
--------------------------------------------------------------------------------
1 | //! \file mgbasicsps.h
2 | //! \brief Include basic shape headers.
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_BASIC_SHAPES_H_
6 | #define TOUCHVG_BASIC_SHAPES_H_
7 |
8 | #include "mgshapetype.h"
9 | #include "mgarc.h"
10 | #include "mgdiamond.h"
11 | #include "mgdot.h"
12 | #include "mgellipse.h"
13 | #include "mggrid.h"
14 | #include "mgline.h"
15 | #include "mglines.h"
16 | #include "mgparallel.h"
17 | #include "mgpathsp.h"
18 | #include "mgrdrect.h"
19 | #include "mgrect.h"
20 | #include "mgsplines.h"
21 |
22 | #endif // TOUCHVG_BASIC_SHAPES_H_
23 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/shape/mgimagesp.h:
--------------------------------------------------------------------------------
1 | //! \file mgimagesp.h
2 | //! \brief 定义图像矩形类 MgImageShape
3 | // Copyright (c) 2004-2014, Zhang Yungui
4 | // License: LGPL, https://github.com/rhcad/vgcore
5 |
6 | #ifndef TOUCHVG_IMAGE_SHAPE_H_
7 | #define TOUCHVG_IMAGE_SHAPE_H_
8 |
9 | #include "mgrect.h"
10 | #include "mgshape.h"
11 |
12 | //! 图像矩形类
13 | /*! \ingroup CORE_SHAPE
14 | */
15 | class MgImageShape : public MgBaseRect
16 | {
17 | MG_INHERIT_CREATE(MgImageShape, MgBaseRect, 18)
18 | public:
19 | #ifndef SWIG
20 | const char* getName() const { return _name; }
21 | #endif
22 | void setName(const char* name);
23 |
24 | Vector2d getImageSize() const { return _size; }
25 | void setImageSize(Vector2d size);
26 |
27 | static const MgShape* findShapeByImageID(const MgShapes* shapes, const char* name);
28 |
29 | protected:
30 | void _copy(const MgImageShape& src);
31 | bool _equals(const MgImageShape& src) const;
32 | void _clear();
33 | bool _draw(int mode, GiGraphics& gs, const GiContext& ctx, int segment) const;
34 | bool _save(MgStorage* s) const;
35 | bool _load(MgShapeFactory* factory, MgStorage* s);
36 |
37 | protected:
38 | char _name[64];
39 | Vector2d _size;
40 | };
41 |
42 | #endif // TOUCHVG_IMAGE_SHAPE_H_
43 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/shape/mgspfactory.h:
--------------------------------------------------------------------------------
1 | //! \file mgspfactory.h
2 | //! \brief 定义图形工厂接口 MgShapeFactory
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_SHAPE_FACTORY_H_
6 | #define TOUCHVG_SHAPE_FACTORY_H_
7 |
8 | class MgShape;
9 |
10 | //! 图形工厂接口
11 | /*! \ingroup CORE_SHAPE
12 | \interface MgShapeFactory
13 | */
14 | struct MgShapeFactory
15 | {
16 | virtual ~MgShapeFactory() {}
17 | #ifndef SWIG
18 | //! 登记类型号对应的图形创建函数,creator为NULL则取消登记
19 | virtual void registerShape(int type, MgShape* (*creator)()) = 0;
20 | #endif
21 | //! 根据类型号创建图形对象
22 | virtual MgShape* createShape(int type) = 0;
23 | };
24 |
25 | #endif // TOUCHVG_SHAPE_FACTORY_H_
26 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/shapedoc/mglayer.h:
--------------------------------------------------------------------------------
1 | //! \file mglayer.h
2 | //! \brief 定义图形文档 MgShapeDoc
3 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
4 |
5 | #ifndef TOUCHVG_SHAPELAYER_H_
6 | #define TOUCHVG_SHAPELAYER_H_
7 |
8 | #include "mgshapes.h"
9 |
10 | class MgShapeDoc;
11 |
12 | //! 图层类
13 | /*! \ingroup CORE_SHAPE
14 | */
15 | class MgLayer : public MgShapes
16 | {
17 | public:
18 | //! 返回本对象的类型
19 | static int Type() { return 7; }
20 |
21 | //! 复制出一个新图层对象
22 | MgLayer* cloneLayer() const { return (MgLayer*)clone(); }
23 |
24 | //! 创建图层对象
25 | static MgLayer* create(MgShapeDoc* doc, int index);
26 |
27 | MgShapeDoc* doc() const; //!< 返回所属文档对象
28 |
29 | bool isHided() const { return !!_bits.hided; } //!< 返回图层是否隐藏
30 | void setHided(bool hided) { _bits.hided = hided; } //!< 设置图层是否隐藏
31 | bool isLocked() const { return !!_bits.locked; } //!< 返回图层是否锁定
32 | void setLocked(bool locked) { _bits.locked = locked; } //!< 设置图层是否锁定
33 |
34 | public:
35 | virtual MgObject* clone() const;
36 | virtual void copy(const MgObject& src);
37 | virtual void release();
38 | virtual bool equals(const MgObject& src) const;
39 | virtual int getType() const { return Type(); }
40 | virtual bool isKindOf(int type) const { return type == Type() || type == MgShapes::Type(); }
41 |
42 | protected:
43 | MgLayer(MgShapeDoc* doc, int index);
44 | virtual ~MgLayer();
45 | virtual bool saveExtra(MgStorage* s) const;
46 | virtual bool loadExtra(MgStorage* s);
47 |
48 | private:
49 | union {
50 | int _flags;
51 | struct {
52 | int hided:1;
53 | int locked:1;
54 | } _bits;
55 | };
56 | };
57 |
58 | #endif // TOUCHVG_SHAPELAYER_H_
59 |
--------------------------------------------------------------------------------
/ios/RCTTouchVG/TouchVGCore/core/include/shapedoc/spfactoryimpl.h:
--------------------------------------------------------------------------------
1 | //! \file spfactoryimpl.h
2 | //! \brief 定义图形工厂接口的默认实现类 MgShapeFactoryImpl
3 | // Copyright (c) 2013, Zhang Yungui
4 | // Copyright (c) 2004-2015, https://github.com/rhcad/vgcore, BSD License
5 |
6 | #ifndef TOUCHVG_SHAPEFACTORY_IMPL_H_
7 | #define TOUCHVG_SHAPEFACTORY_IMPL_H_
8 |
9 | #include "mgspfactory.h"
10 | #include