├── .gitattributes ├── .gitignore ├── README.md ├── app ├── .gitignore ├── CMakeLists.txt ├── build.gradle.kts ├── example.png ├── example1.png ├── example2.png ├── example3.png ├── example4.png ├── example5.png ├── example6.png ├── example7.png ├── example8.png ├── example9.png ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── WorkspacePlanet.json │ ├── bird.gif │ ├── feng.lrc │ ├── feng.mp4 │ ├── feng.srt │ ├── font │ │ ├── AlimamaFangYuanTiVF-Thin.ttf │ │ ├── NotoColorEmoji.ttf │ │ └── iconfont.woff │ ├── gl_transition_window_slice.glsl │ ├── jetpack-compose.svg │ ├── materials │ │ └── baked_color.filamat │ ├── music │ │ ├── bg.png │ │ ├── ic_next.png │ │ ├── ic_pause.png │ │ ├── ic_play.png │ │ ├── ic_previous.png │ │ ├── logo.png │ │ ├── mv_definition_super.svg │ │ ├── record_player_dark_arm.png │ │ └── record_player_verydark_highlight.png │ ├── raining.glsl │ ├── raining.png │ ├── react.svg │ ├── react_bundle.js │ ├── sincos.glsl │ ├── skia_nv12_fragment_shader.glsl │ ├── skia_video_black_white.glsl │ ├── skia_video_bright_shader.glsl │ ├── skia_video_lightning_shader.glsl │ ├── skia_video_raining_shader.glsl │ ├── skia_yuv420p_camera_shader.glsl │ ├── skia_yuv420p_fragment_shader.glsl │ ├── test.js │ ├── tiger.svg │ ├── transition1.png │ ├── transition2.png │ ├── vue.svg │ ├── vue_bundle.js │ └── yiluxiangbei.mp4 │ ├── cpp │ ├── SkiaUI.cpp │ ├── anim │ │ ├── EaseType.h │ │ ├── IAnimator.cpp │ │ ├── IAnimator.h │ │ ├── LinearAnimator.cpp │ │ ├── LinearAnimator.h │ │ ├── TranslateAnimator.cpp │ │ └── TranslateAnimator.h │ ├── app │ │ ├── FrontEngineType.h │ │ ├── SkiaGLApp.cpp │ │ ├── SkiaGLApp.h │ │ ├── SkiaUIApp.cpp │ │ ├── SkiaUIApp.h │ │ └── SkiaUIContext.h │ ├── base │ │ ├── AndroidBitmap.cpp │ │ ├── AndroidBitmap.h │ │ ├── AssetManager.cpp │ │ ├── AssetManager.h │ │ ├── EGLCore.cpp │ │ ├── EGLCore.h │ │ ├── MeasureTime.h │ │ ├── bitmap_util.h │ │ ├── color_util.h │ │ ├── gl_utils.cpp │ │ ├── gl_utils.h │ │ ├── json11.cpp │ │ ├── json11.h │ │ ├── matrix_util.h │ │ ├── native_log.h │ │ ├── stb_image.h │ │ └── w3c_util.h │ ├── compose │ │ ├── ComposeAndroidImageJNI.h │ │ ├── ComposeBaseSurfaceTextureJNI.h │ │ ├── ComposeButtonJNI.h │ │ ├── ComposeCameraJNI.h │ │ ├── ComposeCanvas.cpp │ │ ├── ComposeCanvas.h │ │ ├── ComposeCanvasJNI.h │ │ ├── ComposeCanvasPaintJNI.h │ │ ├── ComposeCanvasPathJNI.h │ │ ├── ComposeContext.h │ │ ├── ComposeEditTextJNI.h │ │ ├── ComposeExoVideoJNI.h │ │ ├── ComposeFilamentJNI.h │ │ ├── ComposeFlexboxLayoutJNI.h │ │ ├── ComposeIconJNI.h │ │ ├── ComposeImageJNI.h │ │ ├── ComposeJNI.h │ │ ├── ComposeLoadingViewJNI.h │ │ ├── ComposeLottieJNI.h │ │ ├── ComposeNodeJNI.h │ │ ├── ComposePageJNI.h │ │ ├── ComposeProgressBarJNI.h │ │ ├── ComposeRecyclerView.cpp │ │ ├── ComposeRecyclerView.h │ │ ├── ComposeRecyclerViewJNI.h │ │ ├── ComposeSVGJNI.h │ │ ├── ComposeScrollViewJNI.h │ │ ├── ComposeShaderJNI.h │ │ ├── ComposeSwitchJNI.h │ │ ├── ComposeTextJNI.h │ │ ├── ComposeViewGroupJNI.h │ │ ├── ComposeViewJNI.h │ │ └── ComposeWebJNI.h │ ├── custom │ │ ├── AudioFFTView.cpp │ │ ├── AudioFFTView.h │ │ ├── LyricScrollView.cpp │ │ └── LyricScrollView.h │ ├── filter │ │ ├── GrAHardwareBufferUtils.cpp │ │ ├── GrAHardwareBufferUtils.h │ │ ├── IFilter.h │ │ ├── PersistentCache.cpp │ │ ├── PersistentCache.h │ │ ├── SkiaFilter.cpp │ │ └── SkiaFilter.h │ ├── inspect │ │ ├── Inspector.cpp │ │ ├── Inspector.h │ │ ├── V8InspctprChannelImpl.cpp │ │ ├── V8InspctprChannelImpl.h │ │ ├── V8InspectorClientImpl.cpp │ │ ├── V8InspectorClientImpl.h │ │ ├── V8InspectorListener.h │ │ ├── WebSocketServer.cpp │ │ ├── WebSocketServer.h │ │ └── inspect_utils.h │ ├── js │ │ ├── File.cpp │ │ ├── File.h │ │ ├── JSAudioPlayer.cpp │ │ ├── JSAudioPlayer.h │ │ ├── JSAudioPlayerBinding.cpp │ │ ├── JSAudioPlayerBinding.h │ │ ├── JSBinding.h │ │ ├── JSButtonBinding.cpp │ │ ├── JSButtonBinding.h │ │ ├── JSFileBinding.cpp │ │ ├── JSFileBinding.h │ │ ├── JSFlexboxLayoutBinding.cpp │ │ ├── JSFlexboxLayoutBinding.h │ │ ├── JSIconBinding.cpp │ │ ├── JSIconBinding.h │ │ ├── JSImageViewBinding.cpp │ │ ├── JSImageViewBinding.h │ │ ├── JSLinearAnimationBinding.cpp │ │ ├── JSLinearAnimationBinding.h │ │ ├── JSLottieViewBinding.cpp │ │ ├── JSLottieViewBinding.h │ │ ├── JSPageBinding.cpp │ │ ├── JSPageBinding.h │ │ ├── JSProgressBarBinding.cpp │ │ ├── JSProgressBarBinding.h │ │ ├── JSSVGViewBinding.cpp │ │ ├── JSSVGViewBinding.h │ │ ├── JSScrollViewBinding.cpp │ │ ├── JSScrollViewBinding.h │ │ ├── JSShaderViewBinding.cpp │ │ ├── JSShaderViewBinding.h │ │ ├── JSSwitchBinding.cpp │ │ ├── JSSwitchBinding.h │ │ ├── JSTextEncodingBinding.cpp │ │ ├── JSTextEncodingBinding.h │ │ ├── JSTextViewBinding.cpp │ │ ├── JSTextViewBinding.h │ │ ├── JSVideoViewBinding.cpp │ │ ├── JSVideoViewBinding.h │ │ ├── JSViewBinding.cpp │ │ ├── JSViewBinding.h │ │ ├── JSViewGroupBinding.cpp │ │ ├── JSViewGroupBinding.h │ │ ├── JSYUVVideoViewBinding.cpp │ │ ├── JSYUVVideoViewBinding.h │ │ ├── TextEncoding.cpp │ │ ├── TextEncoding.h │ │ ├── V8Instance.h │ │ ├── V8Runtime.cpp │ │ ├── V8Runtime.h │ │ ├── ViewManager.cpp │ │ ├── ViewManager.h │ │ ├── animationFrame.h │ │ ├── backPressed.h │ │ ├── console.h │ │ ├── performance.h │ │ └── timer.h │ ├── page │ │ ├── Page.cpp │ │ ├── Page.h │ │ ├── PageStackManager.cpp │ │ └── PageStackManager.h │ ├── plugin │ │ ├── PluginManager.cpp │ │ └── PluginManager.h │ ├── resources │ │ ├── ResourceLoader.cpp │ │ └── ResourceLoader.h │ ├── test │ │ ├── BlendTestPage.cpp │ │ ├── BlendTestPage.h │ │ ├── BlendTestView.cpp │ │ ├── BlendTestView.h │ │ ├── CameraPage.cpp │ │ ├── CameraPage.h │ │ ├── CanvasTest.cpp │ │ ├── CanvasTest.h │ │ ├── ClockView.cpp │ │ ├── ClockView.h │ │ ├── CppTest.cpp │ │ ├── CppTest.h │ │ ├── EasingTestPage.cpp │ │ ├── EasingTestPage.h │ │ ├── ExamplePage.cpp │ │ ├── ExamplePage.h │ │ ├── FilamentPage.cpp │ │ ├── FilamentPage.h │ │ ├── GridLayoutTest.cpp │ │ ├── GridLayoutTest.h │ │ ├── ITestDraw.h │ │ ├── JavascriptTest.cpp │ │ ├── JavascriptTest.h │ │ ├── JetpackComposeTest.cpp │ │ ├── JetpackComposeTest.h │ │ ├── MatrixTestPage.cpp │ │ ├── MatrixTestPage.h │ │ ├── QQMusicPage.cpp │ │ ├── QQMusicPage.h │ │ ├── ReactjsTest.cpp │ │ ├── ReactjsTest.h │ │ ├── RecyclerViewPage.cpp │ │ ├── RecyclerViewPage.h │ │ ├── SimpleJavascriptTest.cpp │ │ ├── SimpleJavascriptTest.h │ │ ├── TextTestPage.cpp │ │ ├── TextTestPage.h │ │ ├── VideoShaderTest.cpp │ │ ├── VideoShaderTest.h │ │ ├── VuejsTest.cpp │ │ ├── VuejsTest.h │ │ ├── WebViewPage.cpp │ │ └── WebViewPage.h │ ├── touch │ │ ├── ScrollDispatcher.cpp │ │ ├── ScrollDispatcher.h │ │ ├── TouchEvent.h │ │ ├── TouchEventDispatcher.cpp │ │ ├── TouchEventDispatcher.h │ │ └── Velocity.h │ ├── widget │ │ ├── AndroidImageView.cpp │ │ ├── AndroidImageView.h │ │ ├── BaseSurfaceTextureView.cpp │ │ ├── BaseSurfaceTextureView.h │ │ ├── BoxDecoration.cpp │ │ ├── BoxDecoration.h │ │ ├── Button.cpp │ │ ├── Button.h │ │ ├── CameraView.cpp │ │ ├── CameraView.h │ │ ├── EditText.cpp │ │ ├── EditText.h │ │ ├── ExoPlayerView.cpp │ │ ├── ExoPlayerView.h │ │ ├── FilamentView.cpp │ │ ├── FilamentView.h │ │ ├── FlexboxLayout.cpp │ │ ├── FlexboxLayout.h │ │ ├── GridLayout.cpp │ │ ├── GridLayout.h │ │ ├── Icon.cpp │ │ ├── Icon.h │ │ ├── ImageView.cpp │ │ ├── ImageView.h │ │ ├── LoadingView.cpp │ │ ├── LoadingView.h │ │ ├── LottieView.cpp │ │ ├── LottieView.h │ │ ├── MovingArea.cpp │ │ ├── MovingArea.h │ │ ├── PickerView.cpp │ │ ├── PickerView.h │ │ ├── PlatformView.cpp │ │ ├── PlatformView.h │ │ ├── ProgressBar.cpp │ │ ├── ProgressBar.h │ │ ├── Radio.cpp │ │ ├── Radio.h │ │ ├── RecyclerView.cpp │ │ ├── RecyclerView.h │ │ ├── RichText.cpp │ │ ├── RichText.h │ │ ├── SVGView.cpp │ │ ├── SVGView.h │ │ ├── ScrollView.cpp │ │ ├── ScrollView.h │ │ ├── ShaderView.cpp │ │ ├── ShaderView.h │ │ ├── SwiperView.cpp │ │ ├── SwiperView.h │ │ ├── Switch.cpp │ │ ├── Switch.h │ │ ├── TextView.cpp │ │ ├── TextView.h │ │ ├── VideoView.cpp │ │ ├── VideoView.h │ │ ├── View.cpp │ │ ├── View.h │ │ ├── ViewGroup.cpp │ │ ├── ViewGroup.h │ │ ├── WebView.cpp │ │ ├── WebView.h │ │ ├── YUVVideoView.cpp │ │ └── YUVVideoView.h │ └── yoga │ │ ├── BitUtils.h │ │ ├── CompactValue.h │ │ ├── Utils.h │ │ ├── YGConfig.cpp │ │ ├── YGConfig.h │ │ ├── YGEnums.cpp │ │ ├── YGEnums.h │ │ ├── YGFloatOptional.h │ │ ├── YGLayout.cpp │ │ ├── YGLayout.h │ │ ├── YGMacros.h │ │ ├── YGNode.cpp │ │ ├── YGNode.h │ │ ├── YGNodePrint.cpp │ │ ├── YGNodePrint.h │ │ ├── YGStyle.cpp │ │ ├── YGStyle.h │ │ ├── YGValue.cpp │ │ ├── YGValue.h │ │ ├── Yoga-internal.h │ │ ├── Yoga.cpp │ │ ├── Yoga.h │ │ ├── event │ │ ├── event.cpp │ │ └── event.h │ │ ├── inspect_utils.cpp │ │ ├── log.cpp │ │ └── log.h │ ├── java │ └── com │ │ └── temple │ │ └── skiaui │ │ ├── HYSkiaEngine.kt │ │ ├── HYSkiaExampleActivity.kt │ │ ├── HYSkiaSurfaceView.kt │ │ ├── HYSkiaTextureView.kt │ │ ├── HYSkiaUIApp.kt │ │ ├── ISkiaView.kt │ │ ├── MainActivity.kt │ │ ├── RenderCallback.kt │ │ ├── audio │ │ ├── HYSkiaAudioPlayer.kt │ │ ├── HYSkiaAudioTracker.kt │ │ ├── IAudioCallback.kt │ │ └── IAudioPlayer.kt │ │ ├── bitmap │ │ ├── AndroidBitmapLoader.kt │ │ ├── GlideImageLoader.kt │ │ └── ImageLoader.kt │ │ ├── cache │ │ └── PersistentCache.kt │ │ ├── compose │ │ ├── example │ │ │ ├── HYComposeCameraPage.kt │ │ │ ├── HYComposeCanvasPage.kt │ │ │ ├── HYComposeExampleApp.kt │ │ │ ├── HYComposeExamplePage.kt │ │ │ ├── HYComposeFilamentPage.kt │ │ │ ├── HYComposeMaterialPage.kt │ │ │ ├── HYComposeMusicPage.kt │ │ │ ├── HYComposeNativeViewsPage.kt │ │ │ ├── HYComposeRecyclerPage.kt │ │ │ ├── HYComposeVideoListPage.kt │ │ │ ├── HYComposeVideoService.kt │ │ │ ├── lyric │ │ │ │ ├── Lyric.kt │ │ │ │ └── LyricsViewModel.kt │ │ │ └── theme │ │ │ │ ├── Color.kt │ │ │ │ ├── Theme.kt │ │ │ │ └── Type.kt │ │ ├── foundation │ │ │ ├── Attributes.kt │ │ │ ├── Modifier.kt │ │ │ ├── StyleKey.kt │ │ │ └── styles.kt │ │ ├── material │ │ │ └── HYBadge.kt │ │ ├── runtime │ │ │ ├── Composables.kt │ │ │ ├── HYComposeApplication.kt │ │ │ ├── HYComposeApplier.kt │ │ │ ├── HYComposeBasePage.kt │ │ │ ├── HYComposeComposer.kt │ │ │ ├── HYComposeSDK.kt │ │ │ ├── HYComposeUIDispatcher.kt │ │ │ └── HYComposeUIFrameClock.kt │ │ └── ui │ │ │ ├── AutoReleasable.kt │ │ │ ├── Canvas.kt │ │ │ ├── HYComposeAndroidImage.kt │ │ │ ├── HYComposeBaseSurfaceTexture.kt │ │ │ ├── HYComposeButton.kt │ │ │ ├── HYComposeCamera.kt │ │ │ ├── HYComposeCanvas.kt │ │ │ ├── HYComposeEditText.kt │ │ │ ├── HYComposeExoVideo.kt │ │ │ ├── HYComposeFilament.kt │ │ │ ├── HYComposeFlexboxLayout.kt │ │ │ ├── HYComposeIcon.kt │ │ │ ├── HYComposeImage.kt │ │ │ ├── HYComposeLoadingView.kt │ │ │ ├── HYComposeLottie.kt │ │ │ ├── HYComposeNode.kt │ │ │ ├── HYComposePage.kt │ │ │ ├── HYComposePaint.kt │ │ │ ├── HYComposePath.kt │ │ │ ├── HYComposeProgressBar.kt │ │ │ ├── HYComposeRecyclerView.kt │ │ │ ├── HYComposeSVG.kt │ │ │ ├── HYComposeScrollView.kt │ │ │ ├── HYComposeShader.kt │ │ │ ├── HYComposeSwitch.kt │ │ │ ├── HYComposeText.kt │ │ │ ├── HYComposeView.kt │ │ │ ├── HYComposeViewGroup.kt │ │ │ ├── HYComposeWeb.kt │ │ │ ├── HYFlexboxEnum.kt │ │ │ └── util │ │ │ ├── Bitmap_androidKt.kt │ │ │ ├── Colors_androidKt.kt │ │ │ └── Dp_androidKt.kt │ │ ├── inspect │ │ ├── InspectPlugin.kt │ │ └── InspectServer.kt │ │ ├── platform │ │ ├── HYSurfaceCallback.kt │ │ ├── ICanvasProvider.kt │ │ ├── PlatformImageReaderBasePlugin.kt │ │ ├── PlatformTextureLayerBasePlugin.kt │ │ ├── SurfaceObj.kt │ │ ├── SurfaceTextureBasePlugin.kt │ │ ├── camera │ │ │ └── PlatformCameraViewPlugin.kt │ │ ├── data │ │ │ └── ImageReaderYUVData.kt │ │ ├── edittext │ │ │ ├── PlatformEditText.kt │ │ │ └── PlatformEditTextPlugin.kt │ │ ├── filament │ │ │ └── PlatformFilamentViewPlugin.kt │ │ ├── video │ │ │ ├── ExoPlayerImpl.kt │ │ │ ├── IVideoPlayer.kt │ │ │ └── PlatformVideoViewPlugin.kt │ │ └── webview │ │ │ ├── IWebViewCallback.kt │ │ │ ├── PlatformWebView.kt │ │ │ └── PlatformWebViewPlugin.kt │ │ ├── plugin │ │ ├── IPlugin.kt │ │ ├── InspectWSServer.kt │ │ ├── PluginManager.kt │ │ └── ToastPlugin.kt │ │ └── video │ │ ├── HYSkiaVideo.kt │ │ ├── HYSkiaYUVVideo.kt │ │ └── YUVData.kt │ ├── jniLibs │ ├── arm64-v8a.zip │ ├── skia │ │ ├── include │ │ │ ├── android │ │ │ │ ├── AHardwareBufferUtils.h │ │ │ │ ├── GrAHardwareBufferUtils.h │ │ │ │ ├── SkAndroidFrameworkUtils.h │ │ │ │ ├── SkAnimatedImage.h │ │ │ │ ├── SkCanvasAndroid.h │ │ │ │ ├── SkHeifDecoder.h │ │ │ │ ├── SkImageAndroid.h │ │ │ │ ├── SkSurfaceAndroid.h │ │ │ │ └── graphite │ │ │ │ │ └── SurfaceAndroid.h │ │ │ ├── codec │ │ │ │ ├── SkAndroidCodec.h │ │ │ │ ├── SkAvifDecoder.h │ │ │ │ ├── SkBmpDecoder.h │ │ │ │ ├── SkCodec.h │ │ │ │ ├── SkCodecAnimation.h │ │ │ │ ├── SkEncodedImageFormat.h │ │ │ │ ├── SkEncodedOrigin.h │ │ │ │ ├── SkGifDecoder.h │ │ │ │ ├── SkIcoDecoder.h │ │ │ │ ├── SkJpegDecoder.h │ │ │ │ ├── SkJpegxlDecoder.h │ │ │ │ ├── SkPixmapUtils.h │ │ │ │ ├── SkPngChunkReader.h │ │ │ │ ├── SkPngDecoder.h │ │ │ │ ├── SkRawDecoder.h │ │ │ │ ├── SkWbmpDecoder.h │ │ │ │ └── SkWebpDecoder.h │ │ │ ├── config │ │ │ │ └── SkUserConfig.h │ │ │ ├── core │ │ │ │ ├── SkAlphaType.h │ │ │ │ ├── SkAnnotation.h │ │ │ │ ├── SkArc.h │ │ │ │ ├── SkBBHFactory.h │ │ │ │ ├── SkBitmap.h │ │ │ │ ├── SkBlendMode.h │ │ │ │ ├── SkBlender.h │ │ │ │ ├── SkBlurTypes.h │ │ │ │ ├── SkCanvas.h │ │ │ │ ├── SkCanvasVirtualEnforcer.h │ │ │ │ ├── SkCapabilities.h │ │ │ │ ├── SkClipOp.h │ │ │ │ ├── SkColor.h │ │ │ │ ├── SkColorFilter.h │ │ │ │ ├── SkColorPriv.h │ │ │ │ ├── SkColorSpace.h │ │ │ │ ├── SkColorTable.h │ │ │ │ ├── SkColorType.h │ │ │ │ ├── SkContourMeasure.h │ │ │ │ ├── SkCoverageMode.h │ │ │ │ ├── SkCubicMap.h │ │ │ │ ├── SkData.h │ │ │ │ ├── SkDataTable.h │ │ │ │ ├── SkDocument.h │ │ │ │ ├── SkDrawable.h │ │ │ │ ├── SkExecutor.h │ │ │ │ ├── SkFlattenable.h │ │ │ │ ├── SkFont.h │ │ │ │ ├── SkFontArguments.h │ │ │ │ ├── SkFontMetrics.h │ │ │ │ ├── SkFontMgr.h │ │ │ │ ├── SkFontParameters.h │ │ │ │ ├── SkFontScanner.h │ │ │ │ ├── SkFontStyle.h │ │ │ │ ├── SkFontTypes.h │ │ │ │ ├── SkFourByteTag.h │ │ │ │ ├── SkGraphics.h │ │ │ │ ├── SkImage.h │ │ │ │ ├── SkImageFilter.h │ │ │ │ ├── SkImageGenerator.h │ │ │ │ ├── SkImageInfo.h │ │ │ │ ├── SkM44.h │ │ │ │ ├── SkMallocPixelRef.h │ │ │ │ ├── SkMaskFilter.h │ │ │ │ ├── SkMatrix.h │ │ │ │ ├── SkMesh.h │ │ │ │ ├── SkMilestone.h │ │ │ │ ├── SkOpenTypeSVGDecoder.h │ │ │ │ ├── SkOverdrawCanvas.h │ │ │ │ ├── SkPaint.h │ │ │ │ ├── SkPath.h │ │ │ │ ├── SkPathBuilder.h │ │ │ │ ├── SkPathEffect.h │ │ │ │ ├── SkPathMeasure.h │ │ │ │ ├── SkPathTypes.h │ │ │ │ ├── SkPathUtils.h │ │ │ │ ├── SkPicture.h │ │ │ │ ├── SkPictureRecorder.h │ │ │ │ ├── SkPixelRef.h │ │ │ │ ├── SkPixmap.h │ │ │ │ ├── SkPoint.h │ │ │ │ ├── SkPoint3.h │ │ │ │ ├── SkRRect.h │ │ │ │ ├── SkRSXform.h │ │ │ │ ├── SkRasterHandleAllocator.h │ │ │ │ ├── SkRect.h │ │ │ │ ├── SkRefCnt.h │ │ │ │ ├── SkRegion.h │ │ │ │ ├── SkSamplingOptions.h │ │ │ │ ├── SkScalar.h │ │ │ │ ├── SkSerialProcs.h │ │ │ │ ├── SkShader.h │ │ │ │ ├── SkSize.h │ │ │ │ ├── SkSpan.h │ │ │ │ ├── SkStream.h │ │ │ │ ├── SkString.h │ │ │ │ ├── SkStrokeRec.h │ │ │ │ ├── SkSurface.h │ │ │ │ ├── SkSurfaceProps.h │ │ │ │ ├── SkSwizzle.h │ │ │ │ ├── SkTextBlob.h │ │ │ │ ├── SkTextureCompressionType.h │ │ │ │ ├── SkTileMode.h │ │ │ │ ├── SkTiledImageUtils.h │ │ │ │ ├── SkTraceMemoryDump.h │ │ │ │ ├── SkTypeface.h │ │ │ │ ├── SkTypes.h │ │ │ │ ├── SkUnPreMultiply.h │ │ │ │ ├── SkVertices.h │ │ │ │ ├── SkYUVAInfo.h │ │ │ │ └── SkYUVAPixmaps.h │ │ │ ├── docs │ │ │ │ ├── SkMultiPictureDocument.h │ │ │ │ ├── SkPDFDocument.h │ │ │ │ └── SkXPSDocument.h │ │ │ ├── effects │ │ │ │ ├── Sk1DPathEffect.h │ │ │ │ ├── Sk2DPathEffect.h │ │ │ │ ├── SkBlenders.h │ │ │ │ ├── SkBlurMaskFilter.h │ │ │ │ ├── SkColorMatrix.h │ │ │ │ ├── SkColorMatrixFilter.h │ │ │ │ ├── SkCornerPathEffect.h │ │ │ │ ├── SkDashPathEffect.h │ │ │ │ ├── SkDiscretePathEffect.h │ │ │ │ ├── SkGradientShader.h │ │ │ │ ├── SkHighContrastFilter.h │ │ │ │ ├── SkImageFilters.h │ │ │ │ ├── SkLumaColorFilter.h │ │ │ │ ├── SkOverdrawColorFilter.h │ │ │ │ ├── SkPerlinNoiseShader.h │ │ │ │ ├── SkRuntimeEffect.h │ │ │ │ ├── SkShaderMaskFilter.h │ │ │ │ ├── SkTableMaskFilter.h │ │ │ │ └── SkTrimPathEffect.h │ │ │ ├── encode │ │ │ │ ├── SkEncoder.h │ │ │ │ ├── SkICC.h │ │ │ │ ├── SkJpegEncoder.h │ │ │ │ ├── SkPngEncoder.h │ │ │ │ └── SkWebpEncoder.h │ │ │ ├── gpu │ │ │ │ ├── GpuTypes.h │ │ │ │ ├── MutableTextureState.h │ │ │ │ ├── ShaderErrorHandler.h │ │ │ │ ├── ganesh │ │ │ │ │ ├── GrBackendSemaphore.h │ │ │ │ │ ├── GrBackendSurface.h │ │ │ │ │ ├── GrContextOptions.h │ │ │ │ │ ├── GrContextThreadSafeProxy.h │ │ │ │ │ ├── GrDirectContext.h │ │ │ │ │ ├── GrDriverBugWorkarounds.h │ │ │ │ │ ├── GrDriverBugWorkaroundsAutogen.h │ │ │ │ │ ├── GrExternalTextureGenerator.h │ │ │ │ │ ├── GrRecordingContext.h │ │ │ │ │ ├── GrTypes.h │ │ │ │ │ ├── GrYUVABackendTextures.h │ │ │ │ │ ├── SkImageGanesh.h │ │ │ │ │ ├── SkMeshGanesh.h │ │ │ │ │ ├── SkSurfaceGanesh.h │ │ │ │ │ ├── d3d │ │ │ │ │ │ ├── GrD3DBackendContext.h │ │ │ │ │ │ └── GrD3DTypes.h │ │ │ │ │ ├── gl │ │ │ │ │ │ ├── GrGLAssembleHelpers.h │ │ │ │ │ │ ├── GrGLAssembleInterface.h │ │ │ │ │ │ ├── GrGLBackendSurface.h │ │ │ │ │ │ ├── GrGLConfig.h │ │ │ │ │ │ ├── GrGLDirectContext.h │ │ │ │ │ │ ├── GrGLExtensions.h │ │ │ │ │ │ ├── GrGLFunctions.h │ │ │ │ │ │ ├── GrGLInterface.h │ │ │ │ │ │ ├── GrGLMakeWebGLInterface.h │ │ │ │ │ │ ├── GrGLTypes.h │ │ │ │ │ │ ├── egl │ │ │ │ │ │ │ └── GrGLMakeEGLInterface.h │ │ │ │ │ │ ├── epoxy │ │ │ │ │ │ │ └── GrGLMakeEpoxyEGLInterface.h │ │ │ │ │ │ ├── glx │ │ │ │ │ │ │ └── GrGLMakeGLXInterface.h │ │ │ │ │ │ ├── ios │ │ │ │ │ │ │ └── GrGLMakeIOSInterface.h │ │ │ │ │ │ ├── mac │ │ │ │ │ │ │ └── GrGLMakeMacInterface.h │ │ │ │ │ │ └── win │ │ │ │ │ │ │ └── GrGLMakeWinInterface.h │ │ │ │ │ ├── mock │ │ │ │ │ │ └── GrMockTypes.h │ │ │ │ │ ├── mtl │ │ │ │ │ │ ├── GrMtlBackendContext.h │ │ │ │ │ │ ├── GrMtlBackendSemaphore.h │ │ │ │ │ │ ├── GrMtlBackendSurface.h │ │ │ │ │ │ ├── GrMtlDirectContext.h │ │ │ │ │ │ ├── GrMtlTypes.h │ │ │ │ │ │ └── SkSurfaceMetal.h │ │ │ │ │ └── vk │ │ │ │ │ │ ├── GrBackendDrawableInfo.h │ │ │ │ │ │ ├── GrVkBackendSemaphore.h │ │ │ │ │ │ ├── GrVkBackendSurface.h │ │ │ │ │ │ ├── GrVkDirectContext.h │ │ │ │ │ │ └── GrVkTypes.h │ │ │ │ ├── graphite │ │ │ │ │ ├── BackendSemaphore.h │ │ │ │ │ ├── BackendTexture.h │ │ │ │ │ ├── Context.h │ │ │ │ │ ├── ContextOptions.h │ │ │ │ │ ├── GraphiteTypes.h │ │ │ │ │ ├── Image.h │ │ │ │ │ ├── ImageProvider.h │ │ │ │ │ ├── Recorder.h │ │ │ │ │ ├── Recording.h │ │ │ │ │ ├── Surface.h │ │ │ │ │ ├── TextureInfo.h │ │ │ │ │ ├── YUVABackendTextures.h │ │ │ │ │ ├── dawn │ │ │ │ │ │ ├── DawnBackendContext.h │ │ │ │ │ │ ├── DawnTypes.h │ │ │ │ │ │ └── DawnUtils.h │ │ │ │ │ ├── mtl │ │ │ │ │ │ ├── MtlBackendContext.h │ │ │ │ │ │ ├── MtlGraphiteTypes.h │ │ │ │ │ │ └── MtlGraphiteUtils.h │ │ │ │ │ ├── precompile │ │ │ │ │ │ ├── PaintOptions.h │ │ │ │ │ │ ├── Precompile.h │ │ │ │ │ │ ├── PrecompileBase.h │ │ │ │ │ │ ├── PrecompileBlender.h │ │ │ │ │ │ ├── PrecompileColorFilter.h │ │ │ │ │ │ ├── PrecompileImageFilter.h │ │ │ │ │ │ ├── PrecompileMaskFilter.h │ │ │ │ │ │ ├── PrecompileRuntimeEffect.h │ │ │ │ │ │ └── PrecompileShader.h │ │ │ │ │ └── vk │ │ │ │ │ │ ├── VulkanGraphiteTypes.h │ │ │ │ │ │ └── VulkanGraphiteUtils.h │ │ │ │ ├── mtl │ │ │ │ │ └── MtlMemoryAllocator.h │ │ │ │ └── vk │ │ │ │ │ ├── VulkanBackendContext.h │ │ │ │ │ ├── VulkanExtensions.h │ │ │ │ │ ├── VulkanMemoryAllocator.h │ │ │ │ │ ├── VulkanMutableTextureState.h │ │ │ │ │ └── VulkanTypes.h │ │ │ ├── pathops │ │ │ │ └── SkPathOps.h │ │ │ ├── ports │ │ │ │ ├── SkCFObject.h │ │ │ │ ├── SkFontConfigInterface.h │ │ │ │ ├── SkFontMgr_FontConfigInterface.h │ │ │ │ ├── SkFontMgr_Fontations.h │ │ │ │ ├── SkFontMgr_android.h │ │ │ │ ├── SkFontMgr_android_ndk.h │ │ │ │ ├── SkFontMgr_data.h │ │ │ │ ├── SkFontMgr_directory.h │ │ │ │ ├── SkFontMgr_empty.h │ │ │ │ ├── SkFontMgr_fontconfig.h │ │ │ │ ├── SkFontMgr_fuchsia.h │ │ │ │ ├── SkFontMgr_mac_ct.h │ │ │ │ ├── SkFontScanner_Fontations.h │ │ │ │ ├── SkFontScanner_FreeType.h │ │ │ │ ├── SkImageGeneratorCG.h │ │ │ │ ├── SkImageGeneratorNDK.h │ │ │ │ ├── SkImageGeneratorWIC.h │ │ │ │ ├── SkTypeface_fontations.h │ │ │ │ ├── SkTypeface_mac.h │ │ │ │ └── SkTypeface_win.h │ │ │ ├── private │ │ │ │ ├── SkColorData.h │ │ │ │ ├── SkEncodedInfo.h │ │ │ │ ├── SkExif.h │ │ │ │ ├── SkGainmapInfo.h │ │ │ │ ├── SkGainmapShader.h │ │ │ │ ├── SkIDChangeListener.h │ │ │ │ ├── SkJpegGainmapEncoder.h │ │ │ │ ├── SkJpegMetadataDecoder.h │ │ │ │ ├── SkPathRef.h │ │ │ │ ├── SkSLSampleUsage.h │ │ │ │ ├── SkWeakRefCnt.h │ │ │ │ ├── SkXmp.h │ │ │ │ ├── base │ │ │ │ │ ├── README.md │ │ │ │ │ ├── SingleOwner.h │ │ │ │ │ ├── SkAPI.h │ │ │ │ │ ├── SkASAN.h │ │ │ │ │ ├── SkAlign.h │ │ │ │ │ ├── SkAlignedStorage.h │ │ │ │ │ ├── SkAnySubclass.h │ │ │ │ │ ├── SkAssert.h │ │ │ │ │ ├── SkAttributes.h │ │ │ │ │ ├── SkCPUTypes.h │ │ │ │ │ ├── SkContainers.h │ │ │ │ │ ├── SkDebug.h │ │ │ │ │ ├── SkDeque.h │ │ │ │ │ ├── SkFeatures.h │ │ │ │ │ ├── SkFixed.h │ │ │ │ │ ├── SkFloatingPoint.h │ │ │ │ │ ├── SkLoadUserConfig.h │ │ │ │ │ ├── SkMacros.h │ │ │ │ │ ├── SkMalloc.h │ │ │ │ │ ├── SkMath.h │ │ │ │ │ ├── SkMutex.h │ │ │ │ │ ├── SkNoncopyable.h │ │ │ │ │ ├── SkOnce.h │ │ │ │ │ ├── SkPoint_impl.h │ │ │ │ │ ├── SkSafe32.h │ │ │ │ │ ├── SkSemaphore.h │ │ │ │ │ ├── SkSpan_impl.h │ │ │ │ │ ├── SkTArray.h │ │ │ │ │ ├── SkTDArray.h │ │ │ │ │ ├── SkTFitsIn.h │ │ │ │ │ ├── SkTLogic.h │ │ │ │ │ ├── SkTPin.h │ │ │ │ │ ├── SkTemplates.h │ │ │ │ │ ├── SkThreadAnnotations.h │ │ │ │ │ ├── SkThreadID.h │ │ │ │ │ ├── SkTo.h │ │ │ │ │ └── SkTypeTraits.h │ │ │ │ ├── chromium │ │ │ │ │ ├── GrDeferredDisplayList.h │ │ │ │ │ ├── GrDeferredDisplayListRecorder.h │ │ │ │ │ ├── GrPromiseImageTexture.h │ │ │ │ │ ├── GrSurfaceCharacterization.h │ │ │ │ │ ├── GrVkSecondaryCBDrawContext.h │ │ │ │ │ ├── SkChromeRemoteGlyphCache.h │ │ │ │ │ ├── SkDiscardableMemory.h │ │ │ │ │ ├── SkImageChromium.h │ │ │ │ │ └── Slug.h │ │ │ │ └── gpu │ │ │ │ │ ├── ganesh │ │ │ │ │ ├── GrContext_Base.h │ │ │ │ │ ├── GrD3DTypesMinimal.h │ │ │ │ │ ├── GrImageContext.h │ │ │ │ │ ├── GrTextureGenerator.h │ │ │ │ │ └── GrTypesPriv.h │ │ │ │ │ └── vk │ │ │ │ │ └── SkiaVulkan.h │ │ │ ├── sksl │ │ │ │ ├── SkSLDebugTrace.h │ │ │ │ └── SkSLVersion.h │ │ │ ├── svg │ │ │ │ └── SkSVGCanvas.h │ │ │ ├── third_party │ │ │ │ └── vulkan │ │ │ │ │ └── vulkan │ │ │ │ │ ├── vk_platform.h │ │ │ │ │ ├── vk_video │ │ │ │ │ ├── vulkan_video_codec_h264std.h │ │ │ │ │ ├── vulkan_video_codec_h264std_decode.h │ │ │ │ │ ├── vulkan_video_codec_h265std.h │ │ │ │ │ ├── vulkan_video_codec_h265std_decode.h │ │ │ │ │ └── vulkan_video_codecs_common.h │ │ │ │ │ ├── vulkan.h │ │ │ │ │ ├── vulkan_android.h │ │ │ │ │ ├── vulkan_core.h │ │ │ │ │ ├── vulkan_ios.h │ │ │ │ │ ├── vulkan_macos.h │ │ │ │ │ ├── vulkan_win32.h │ │ │ │ │ └── vulkan_xcb.h │ │ │ └── utils │ │ │ │ ├── SkCamera.h │ │ │ │ ├── SkCanvasStateUtils.h │ │ │ │ ├── SkCustomTypeface.h │ │ │ │ ├── SkEventTracer.h │ │ │ │ ├── SkNWayCanvas.h │ │ │ │ ├── SkNoDrawCanvas.h │ │ │ │ ├── SkNullCanvas.h │ │ │ │ ├── SkOrderedFontMgr.h │ │ │ │ ├── SkPaintFilterCanvas.h │ │ │ │ ├── SkParse.h │ │ │ │ ├── SkParsePath.h │ │ │ │ ├── SkShadowUtils.h │ │ │ │ ├── SkTextUtils.h │ │ │ │ ├── SkTraceEventPhase.h │ │ │ │ └── mac │ │ │ │ └── SkCGUtils.h │ │ ├── modules │ │ │ ├── skcms │ │ │ │ ├── skcms.h │ │ │ │ └── src │ │ │ │ │ ├── Transform_inl.h │ │ │ │ │ ├── skcms_Transform.h │ │ │ │ │ ├── skcms_internals.h │ │ │ │ │ └── skcms_public.h │ │ │ ├── skottie │ │ │ │ ├── include │ │ │ │ │ ├── BUILD.bazel │ │ │ │ │ ├── ExternalLayer.h │ │ │ │ │ ├── Skottie.h │ │ │ │ │ ├── SkottieProperty.h │ │ │ │ │ ├── SlotManager.h │ │ │ │ │ └── TextShaper.h │ │ │ │ └── src │ │ │ │ │ ├── SkottieValue.h │ │ │ │ │ └── text │ │ │ │ │ └── SkottieShaper.h │ │ │ ├── skparagraph │ │ │ │ └── include │ │ │ │ │ ├── DartTypes.h │ │ │ │ │ ├── FontArguments.h │ │ │ │ │ ├── FontCollection.h │ │ │ │ │ ├── Metrics.h │ │ │ │ │ ├── Paragraph.h │ │ │ │ │ ├── ParagraphBuilder.h │ │ │ │ │ ├── ParagraphCache.h │ │ │ │ │ ├── ParagraphPainter.h │ │ │ │ │ ├── ParagraphStyle.h │ │ │ │ │ ├── TextShadow.h │ │ │ │ │ ├── TextStyle.h │ │ │ │ │ └── TypefaceFontProvider.h │ │ │ ├── skresources │ │ │ │ └── include │ │ │ │ │ └── SkResources.h │ │ │ ├── skshaper │ │ │ │ └── include │ │ │ │ │ ├── SkShaper.h │ │ │ │ │ ├── SkShaper_coretext.h │ │ │ │ │ ├── SkShaper_factory.h │ │ │ │ │ ├── SkShaper_harfbuzz.h │ │ │ │ │ └── SkShaper_skunicode.h │ │ │ ├── skunicode │ │ │ │ └── include │ │ │ │ │ └── SkUnicode.h │ │ │ └── svg │ │ │ │ └── include │ │ │ │ ├── SkSVGAttribute.h │ │ │ │ ├── SkSVGAttributeParser.h │ │ │ │ ├── SkSVGCircle.h │ │ │ │ ├── SkSVGClipPath.h │ │ │ │ ├── SkSVGContainer.h │ │ │ │ ├── SkSVGDOM.h │ │ │ │ ├── SkSVGDefs.h │ │ │ │ ├── SkSVGEllipse.h │ │ │ │ ├── SkSVGFe.h │ │ │ │ ├── SkSVGFeBlend.h │ │ │ │ ├── SkSVGFeColorMatrix.h │ │ │ │ ├── SkSVGFeComponentTransfer.h │ │ │ │ ├── SkSVGFeComposite.h │ │ │ │ ├── SkSVGFeDisplacementMap.h │ │ │ │ ├── SkSVGFeFlood.h │ │ │ │ ├── SkSVGFeGaussianBlur.h │ │ │ │ ├── SkSVGFeImage.h │ │ │ │ ├── SkSVGFeLightSource.h │ │ │ │ ├── SkSVGFeLighting.h │ │ │ │ ├── SkSVGFeMerge.h │ │ │ │ ├── SkSVGFeMorphology.h │ │ │ │ ├── SkSVGFeOffset.h │ │ │ │ ├── SkSVGFeTurbulence.h │ │ │ │ ├── SkSVGFilter.h │ │ │ │ ├── SkSVGFilterContext.h │ │ │ │ ├── SkSVGG.h │ │ │ │ ├── SkSVGGradient.h │ │ │ │ ├── SkSVGHiddenContainer.h │ │ │ │ ├── SkSVGIDMapper.h │ │ │ │ ├── SkSVGImage.h │ │ │ │ ├── SkSVGLine.h │ │ │ │ ├── SkSVGLinearGradient.h │ │ │ │ ├── SkSVGMask.h │ │ │ │ ├── SkSVGNode.h │ │ │ │ ├── SkSVGOpenTypeSVGDecoder.h │ │ │ │ ├── SkSVGPath.h │ │ │ │ ├── SkSVGPattern.h │ │ │ │ ├── SkSVGPoly.h │ │ │ │ ├── SkSVGRadialGradient.h │ │ │ │ ├── SkSVGRect.h │ │ │ │ ├── SkSVGRenderContext.h │ │ │ │ ├── SkSVGSVG.h │ │ │ │ ├── SkSVGShape.h │ │ │ │ ├── SkSVGStop.h │ │ │ │ ├── SkSVGText.h │ │ │ │ ├── SkSVGTransformableNode.h │ │ │ │ ├── SkSVGTypes.h │ │ │ │ ├── SkSVGUse.h │ │ │ │ └── SkSVGValue.h │ │ └── src │ │ │ ├── base │ │ │ ├── SkMathPriv.h │ │ │ ├── SkTInternalLList.h │ │ │ ├── SkTLazy.h │ │ │ └── SkUTF.h │ │ │ ├── core │ │ │ ├── SkChecksum.h │ │ │ ├── SkLRUCache.h │ │ │ └── SkTHash.h │ │ │ └── gpu │ │ │ └── ganesh │ │ │ └── gl │ │ │ └── GrGLDefines.h │ ├── v8 │ │ └── include │ │ │ ├── APIDesign.md │ │ │ ├── DEPS │ │ │ ├── OWNERS │ │ │ ├── codecache-units.h │ │ │ ├── inspector │ │ │ ├── Debugger.h │ │ │ ├── Runtime.h │ │ │ └── Schema.h │ │ │ ├── js_protocol-1.2.json │ │ │ ├── js_protocol-1.3.json │ │ │ ├── js_protocol.pdl │ │ │ ├── libplatform │ │ │ ├── DEPS │ │ │ ├── libplatform-export.h │ │ │ ├── libplatform.h │ │ │ └── v8-tracing.h │ │ │ ├── mkjso-units.h │ │ │ ├── v8-debug.h │ │ │ ├── v8-inspector-protocol.h │ │ │ ├── v8-inspector.h │ │ │ ├── v8-internal.h │ │ │ ├── v8-jsaot.h │ │ │ ├── v8-platform.h │ │ │ ├── v8-profiler.h │ │ │ ├── v8-util.h │ │ │ ├── v8-value-serializer-version.h │ │ │ ├── v8-version-string.h │ │ │ ├── v8-version.h │ │ │ ├── v8-vex.h │ │ │ ├── v8-wasm-trap-handler-posix.h │ │ │ ├── v8-wasm-trap-handler-win.h │ │ │ ├── v8.h │ │ │ ├── v8config.h │ │ │ └── xts.h │ └── x86_64.zip │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── ic_launcher_background.xml │ ├── logo.png │ └── round_logo.png │ ├── layout │ ├── activity_example.xml │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ └── strings.xml ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.gitattributes: -------------------------------------------------------------------------------- 1 | app/src/main/jniLibs/arm64-v8a/libskia.a filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | # IntelliJ 5 | /.idea/ 6 | /.idea/* 7 | /.idea/caches 8 | /.idea/libraries 9 | /.idea/modules.xml 10 | /.idea/workspace.xml 11 | /.idea/navEditor.xml 12 | /.idea/assetWizardSettings.xml 13 | /.idea/vcs.xml 14 | .DS_Store 15 | /build 16 | /captures 17 | .externalNativeBuild 18 | .cxx 19 | local.properties 20 | /app/src/main/jniLibs/arm64-v8a 21 | /app/src/main/jniLibs/x86_64 22 | /.kotlin/* 23 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example.png -------------------------------------------------------------------------------- /app/example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example1.png -------------------------------------------------------------------------------- /app/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example2.png -------------------------------------------------------------------------------- /app/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example3.png -------------------------------------------------------------------------------- /app/example4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example4.png -------------------------------------------------------------------------------- /app/example5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example5.png -------------------------------------------------------------------------------- /app/example6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example6.png -------------------------------------------------------------------------------- /app/example7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example7.png -------------------------------------------------------------------------------- /app/example8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example8.png -------------------------------------------------------------------------------- /app/example9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/example9.png -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/main/assets/bird.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/bird.gif -------------------------------------------------------------------------------- /app/src/main/assets/feng.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/feng.mp4 -------------------------------------------------------------------------------- /app/src/main/assets/font/AlimamaFangYuanTiVF-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/font/AlimamaFangYuanTiVF-Thin.ttf -------------------------------------------------------------------------------- /app/src/main/assets/font/NotoColorEmoji.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/font/NotoColorEmoji.ttf -------------------------------------------------------------------------------- /app/src/main/assets/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/font/iconfont.woff -------------------------------------------------------------------------------- /app/src/main/assets/gl_transition_window_slice.glsl: -------------------------------------------------------------------------------- 1 | uniform float2 iResolution; 2 | uniform float iTime; 3 | uniform float count; // = 10.0 4 | uniform float smoothness; // = 0.5 5 | uniform shader iChannel0; 6 | uniform shader iChannel1; 7 | uniform float2 iChannel0Resolution; 8 | uniform float2 iChannel1Resolution; 9 | uniform float shaderTouchX; 10 | 11 | float4 main(float2 coord) { 12 | float progress = shaderTouchX < 0 ? mod(iTime * 80, iResolution.x) : shaderTouchX; 13 | float pr = smoothstep(-smoothness, 0.0, coord.x - progress * (1.0 + smoothness)); 14 | float s = step(pr, fract(count * coord.x)); 15 | float4 fromColor = iChannel0.eval(coord / iResolution * iChannel0Resolution); 16 | float4 toColor = iChannel1.eval(coord / iResolution * iChannel1Resolution); 17 | return mix(fromColor, toColor, s); 18 | } -------------------------------------------------------------------------------- /app/src/main/assets/materials/baked_color.filamat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/materials/baked_color.filamat -------------------------------------------------------------------------------- /app/src/main/assets/music/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/bg.png -------------------------------------------------------------------------------- /app/src/main/assets/music/ic_next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/ic_next.png -------------------------------------------------------------------------------- /app/src/main/assets/music/ic_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/ic_pause.png -------------------------------------------------------------------------------- /app/src/main/assets/music/ic_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/ic_play.png -------------------------------------------------------------------------------- /app/src/main/assets/music/ic_previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/ic_previous.png -------------------------------------------------------------------------------- /app/src/main/assets/music/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/logo.png -------------------------------------------------------------------------------- /app/src/main/assets/music/record_player_dark_arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/record_player_dark_arm.png -------------------------------------------------------------------------------- /app/src/main/assets/music/record_player_verydark_highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/music/record_player_verydark_highlight.png -------------------------------------------------------------------------------- /app/src/main/assets/raining.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/raining.png -------------------------------------------------------------------------------- /app/src/main/assets/skia_nv12_fragment_shader.glsl: -------------------------------------------------------------------------------- 1 | uniform shader y_tex; 2 | uniform shader uv_tex; 3 | uniform float widthRatio; 4 | uniform float heightRatio; 5 | uniform float rotation; 6 | half4 main(float2 coord) { 7 | float2 texCoord = float2(coord.x / widthRatio, coord.y / heightRatio); 8 | float2 uv_coord = float2(texCoord.x / 2.0, texCoord.y / 2.0); 9 | half y = y_tex.eval(texCoord).r; 10 | half2 uv = uv_tex.eval(uv_coord).rg - 0.5; 11 | half u = uv.x; 12 | half v = uv.y; 13 | half r = y + 1.402 * v; 14 | half g = y - 0.344 * u - 0.714 * v; 15 | half b = y + 1.772 * u; 16 | return half4(r, g, b, 1.0); 17 | } -------------------------------------------------------------------------------- /app/src/main/assets/skia_video_black_white.glsl: -------------------------------------------------------------------------------- 1 | uniform float2 iResolution; 2 | uniform float iTime; 3 | uniform shader iChannel0; 4 | 5 | float4 main(float2 coord) { 6 | float4 color = iChannel0.eval(coord); 7 | float luminance = dot(color.rgb, float3(0.299, 0.587, 0.114)); 8 | float3 grayscale = mix(color.rgb, float3(luminance), 1.0); 9 | return float4(grayscale, color.a); 10 | } -------------------------------------------------------------------------------- /app/src/main/assets/skia_video_bright_shader.glsl: -------------------------------------------------------------------------------- 1 | uniform float2 iResolution; 2 | uniform float iTime; 3 | uniform shader iChannel0; 4 | 5 | float4 main(float2 coord) { 6 | float uBrightness = 0.5; 7 | float4 textureColor = iChannel0.eval(coord); 8 | return float4((textureColor.rgb + float3(uBrightness)), textureColor.w); 9 | } -------------------------------------------------------------------------------- /app/src/main/assets/skia_video_lightning_shader.glsl: -------------------------------------------------------------------------------- 1 | uniform float2 iResolution; 2 | uniform float iTime; 3 | uniform shader iChannel0; 4 | 5 | float4 main(float2 coord) { 6 | float4 color = iChannel0.eval(coord); 7 | return float4(1.0 - color.r, 1.0 - color.g, 1.0 - color.b, color.a); 8 | } -------------------------------------------------------------------------------- /app/src/main/assets/skia_yuv420p_camera_shader.glsl: -------------------------------------------------------------------------------- 1 | uniform shader y_tex; 2 | uniform shader u_tex; 3 | uniform shader v_tex; 4 | uniform float widthRatio; 5 | uniform float heightRatio; 6 | uniform float rotation; 7 | half4 main(float2 coord) { 8 | float2 texCoord = float2(coord.x / widthRatio, coord.y / heightRatio); 9 | float2 uv_coord = texCoord / 2.0; 10 | half y = y_tex.eval(texCoord).r; 11 | half u = u_tex.eval(uv_coord).r - 0.5; 12 | half v = v_tex.eval(uv_coord).r - 0.5; 13 | half r = y + 1.402 * v; 14 | half g = y - 0.344 * u - 0.714 * v; 15 | half b = y + 1.772 * u; 16 | return half4(r, g, b, 1.0); 17 | } -------------------------------------------------------------------------------- /app/src/main/assets/skia_yuv420p_fragment_shader.glsl: -------------------------------------------------------------------------------- 1 | uniform shader y_tex; 2 | uniform shader u_tex; 3 | uniform shader v_tex; 4 | uniform float widthRatio; 5 | uniform float heightRatio; 6 | half4 main(float2 coord) { 7 | float2 texCoord = float2(coord.x / widthRatio, coord.y / heightRatio); 8 | float2 uv_coord = texCoord / 2.0; 9 | half y = y_tex.eval(texCoord).r; 10 | half u = u_tex.eval(uv_coord).r - 0.5; 11 | half v = v_tex.eval(uv_coord).r - 0.5; 12 | half r = y + 1.402 * v; 13 | half g = y - 0.344 * u - 0.714 * v; 14 | half b = y + 1.772 * u; 15 | return half4(r, g, b, 1.0); 16 | } -------------------------------------------------------------------------------- /app/src/main/assets/transition1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/transition1.png -------------------------------------------------------------------------------- /app/src/main/assets/transition2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/transition2.png -------------------------------------------------------------------------------- /app/src/main/assets/vue.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/assets/yiluxiangbei.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/assets/yiluxiangbei.mp4 -------------------------------------------------------------------------------- /app/src/main/cpp/anim/LinearAnimator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IAnimator.h" 4 | #include "View.h" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class LinearAnimator : public IAnimator { 9 | 10 | public: 11 | 12 | LinearAnimator(View *view, float startValue, float endValue); 13 | 14 | void update(SkRect &rect) override; 15 | 16 | void setUpdateListener(std::function &&listener); 17 | 18 | public: 19 | 20 | v8::Persistent> jsUpdateCallback; 21 | 22 | private: 23 | 24 | float startValue = 0.0f; 25 | 26 | float endValue = 0.0f; 27 | 28 | View *targetView = nullptr; 29 | 30 | std::function updateListener = nullptr; 31 | 32 | void updateInner(); 33 | 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/cpp/anim/TranslateAnimator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IAnimator.h" 4 | #include "View.h" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class TranslateAnimator : public IAnimator { 9 | 10 | public: 11 | 12 | TranslateAnimator(View *view, 13 | float animStartX, float animEndX, 14 | float animStartY, float animEndY); 15 | 16 | virtual ~TranslateAnimator(); 17 | 18 | virtual void update(SkRect &rect) override; 19 | 20 | virtual void start() override; 21 | 22 | private: 23 | 24 | float animEndX, animEndY = 0.0f; 25 | 26 | float animStartX, animStartY = 0.0f; 27 | 28 | View *targetView = nullptr; 29 | 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/cpp/app/FrontEngineType.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace HYSkiaUI { 4 | 5 | enum FrontEngineType { 6 | Cpp = 0, 7 | JS = 1, 8 | Compose = 2, 9 | React = 3, 10 | Vue = 4 11 | }; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/cpp/app/SkiaGLApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "jni.h" 4 | #include "jni.h" 5 | #include "EGLCore.h" 6 | #include "memory" 7 | #include "AssetManager.h" 8 | #include "IFilter.h" 9 | 10 | namespace HYSkiaUI { 11 | 12 | class SkiaGLApp { 13 | 14 | public: 15 | 16 | explicit SkiaGLApp(JNIEnv *env); 17 | 18 | ~SkiaGLApp(); 19 | 20 | void create(ANativeWindow *window); 21 | 22 | void change(int width, int height, long time); 23 | 24 | void destroy(); 25 | 26 | void doFrame(long pic, long time); 27 | 28 | long MakeHardwareBufferToSkImage(JNIEnv *env, jobject hardwareBuffer); 29 | 30 | void deleteSkImage(JNIEnv *env, long skImagePtr); 31 | 32 | long attachSurfaceTexture(JNIEnv* env, int width, int height, jobject surfaceTexture); 33 | 34 | void updateTexImage(JNIEnv* env, jobject surfaceTexture, long skImagePtr); 35 | 36 | private: 37 | 38 | std::unique_ptr mEGLCore; 39 | std::unique_ptr mFilter; 40 | int mWidth = 0, mHeight = 0; 41 | JNIEnv *env = nullptr; 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/cpp/base/AssetManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct ImageData { 6 | const unsigned char *content; 7 | off_t length; 8 | }; 9 | 10 | class AssetManager { 11 | 12 | public: 13 | 14 | AssetManager(JNIEnv *env, jobject javaAssetManager); 15 | 16 | 17 | char *readFile(const char *path); 18 | 19 | ImageData *readImage(const char *path); 20 | 21 | bool exist(const char *path); 22 | 23 | private: 24 | 25 | AAssetManager *asset_manager = nullptr; 26 | 27 | }; 28 | -------------------------------------------------------------------------------- /app/src/main/cpp/base/EGLCore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "EGL/egl.h" 4 | #include "GLES3/gl3.h" 5 | #include "GLES3/gl3ext.h" 6 | #include "EGL/eglext.h" 7 | 8 | class EGLCore { 9 | 10 | public: 11 | 12 | EGLCore(); 13 | 14 | ~EGLCore(); 15 | 16 | /** 17 | * sharedCtx, 共享egl上下文 18 | * nativeWindow == nullptr 离屏 19 | * @param nativeWindow 20 | */ 21 | int createGLEnv(EGLContext sharedCtx, ANativeWindow *nativeWindow, int width, int height, bool offScreen); 22 | 23 | void releaseGLEnv(); 24 | 25 | EGLSurface getEGLSurface(); 26 | 27 | EGLContext getEGLContext(); 28 | 29 | EGLDisplay getEGLDisplay(); 30 | 31 | void swapBuffer(); 32 | 33 | void makeCurrent(); 34 | 35 | private: 36 | 37 | EGLConfig mEGLConf; 38 | EGLSurface mEGLSurface; 39 | EGLContext mEGLCtx; 40 | EGLDisplay mEGLDisplay; 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /app/src/main/cpp/base/MeasureTime.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "string" 4 | #include 5 | #include "native_log.h" 6 | 7 | class MeasureTime { 8 | 9 | public: 10 | MeasureTime() = delete; 11 | 12 | MeasureTime(const std::string& name, int minvalue = 0) 13 | : _name(name), _start(std::chrono::high_resolution_clock::now()), minValue(minvalue) {} 14 | 15 | ~MeasureTime() { 16 | auto stop = std::chrono::high_resolution_clock::now(); 17 | auto duration = std::chrono::duration_cast(stop - _start).count(); 18 | if (duration > minValue) { 19 | ALOGD("MeasureTime %s: %lld ms\n", _name.c_str(), duration) 20 | } 21 | } 22 | 23 | private: 24 | std::string _name; 25 | int minValue = -1; 26 | std::chrono::time_point _start; 27 | 28 | }; 29 | -------------------------------------------------------------------------------- /app/src/main/cpp/base/gl_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "native_log.h" 14 | 15 | GLuint createProgram(const char *vertexShader, const char *fragShader); 16 | 17 | GLuint loadShader(GLenum type, const char *shaderSrc); 18 | 19 | void checkActiveUniform(GLuint program); 20 | 21 | GLuint createTexture(GLenum type); 22 | 23 | GLuint createTextureWithBytes(unsigned char *bytes, int width, int height); 24 | 25 | GLuint createTextureWithOldTexture(GLuint texture, unsigned char *bytes, int width, int height); 26 | 27 | void createFrameBuffer(GLuint *framebuffer, GLuint *texture, int width, int height); 28 | 29 | void createFrameBuffers(GLuint *frambuffers, GLuint *textures, int width, int height, int size); 30 | 31 | void checkGLError(const char *op); 32 | 33 | #define SHADER_STRING(s) #s 34 | 35 | GLuint createShaderProgram(GLuint vertexShader, GLuint fragmentShader); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /app/src/main/cpp/base/native_log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define Android 1 6 | #define JNI_DEBUG 1 7 | #define JNI_TAG "SkiaUI" 8 | 9 | #ifdef Android 10 | #define ALOGE(format, ...) if (JNI_DEBUG) { __android_log_print(ANDROID_LOG_ERROR, JNI_TAG, format, ##__VA_ARGS__); } 11 | #define ALOGI(format, ...) if (JNI_DEBUG) { __android_log_print(ANDROID_LOG_INFO, JNI_TAG, format, ##__VA_ARGS__); } 12 | #define ALOGD(format, ...) if (JNI_DEBUG) { __android_log_print(ANDROID_LOG_DEBUG, JNI_TAG, format, ##__VA_ARGS__); } 13 | #define ALOGW(format, ...) if (JNI_DEBUG) { __android_log_print(ANDROID_LOG_WARN, JNI_TAG, format, ##__VA_ARGS__); } 14 | #else 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /app/src/main/cpp/compose/ComposeButtonJNI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "jni.h" 4 | #include "Button.h" 5 | #include "native_log.h" 6 | 7 | using namespace HYSkiaUI; 8 | 9 | const char *HYComposeButton = "com/temple/skiaui/compose/ui/HYComposeButton"; 10 | 11 | static JNINativeMethod g_ComposeButtonMethods[] = { 12 | }; 13 | 14 | static int RegisterComposeButtonMethods(JNIEnv *env) { 15 | return JNI_TRUE; 16 | } 17 | 18 | static void UnRegisterComposeButtonMethods(JNIEnv *env) { 19 | jclass clazz = env->FindClass(HYComposeButton); 20 | if (clazz == nullptr) { 21 | ALOGD("UnRegisterComposeButtonMethods fail clazz == null") 22 | } 23 | env->UnregisterNatives(clazz); 24 | } -------------------------------------------------------------------------------- /app/src/main/cpp/compose/ComposeCanvas.cpp: -------------------------------------------------------------------------------- 1 | #include "ComposeCanvas.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | ComposeCanvas::ComposeCanvas() { 6 | 7 | } 8 | 9 | ComposeCanvas::~ComposeCanvas() { 10 | 11 | } 12 | 13 | void ComposeCanvas::draw(SkCanvas *canvas) { 14 | this->canvas = canvas; 15 | canvas->save(); 16 | canvas->translate(static_cast(left), static_cast(top)); 17 | callComposeDraw(canvas); 18 | canvas->restore(); 19 | } 20 | 21 | void ComposeCanvas::setContext(std::shared_ptr &context) { 22 | View::setContext(context); 23 | auto jniEnv = context->getJniEnv(); 24 | auto jClazz = jniEnv->FindClass("com/temple/skiaui/compose/ui/HYComposeCanvas"); 25 | onDrawMethodId = jniEnv->GetMethodID(jClazz, "onDrawFromJNI", "()V"); 26 | } 27 | 28 | void ComposeCanvas::callComposeDraw(SkCanvas *canvas) { 29 | auto jniEnv = context->getJniEnv(); 30 | jniEnv->CallVoidMethod(globalJavaViewRef, onDrawMethodId); 31 | } 32 | 33 | SkCanvas *ComposeCanvas::getCanvas() { 34 | return canvas; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/cpp/compose/ComposeCanvas.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class ComposeCanvas : public View { 8 | 9 | public: 10 | 11 | ComposeCanvas(); 12 | 13 | ~ComposeCanvas(); 14 | 15 | void draw(SkCanvas *canvas) override; 16 | 17 | void setContext(std::shared_ptr &context) override; 18 | 19 | SkCanvas* getCanvas(); 20 | 21 | private: 22 | 23 | SkCanvas *canvas = nullptr; 24 | 25 | void callComposeDraw(SkCanvas *canvas); 26 | 27 | jmethodID onDrawMethodId = nullptr; 28 | 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/cpp/compose/ComposeContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SkiaUIContext.h" 4 | #include "unordered_map" 5 | #include "thread" 6 | 7 | namespace HYSkiaUI { 8 | 9 | class ComposeContext { 10 | 11 | public: 12 | 13 | static ComposeContext *getInstance() { 14 | static ComposeContext context; 15 | return &context; 16 | } 17 | 18 | std::shared_ptr &getUIContext() { 19 | return uiContextMap[std::this_thread::get_id()]; 20 | } 21 | 22 | void saveContext(std::shared_ptr &uiContext) { 23 | uiContextMap[std::this_thread::get_id()] = uiContext; 24 | } 25 | 26 | void clearContext() { 27 | uiContextMap.erase(std::this_thread::get_id()); 28 | } 29 | 30 | private: 31 | 32 | ComposeContext() {} 33 | 34 | ComposeContext(ComposeContext &other) = delete; 35 | 36 | ComposeContext &operator=(ComposeContext &other) = delete; 37 | 38 | ~ComposeContext() {} 39 | 40 | std::unordered_map> uiContextMap; 41 | 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/cpp/compose/ComposeFilamentJNI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "jni.h" 4 | #include "native_log.h" 5 | #include "FilamentView.h" 6 | 7 | using namespace HYSkiaUI; 8 | 9 | const char *HYComposeFilament = "com/temple/skiaui/compose/ui/HYComposeFilament"; 10 | 11 | static JNINativeMethod g_ComposeFilamentViewMethods[] = { 12 | }; 13 | 14 | static int RegisterComposeFilamentMethods(JNIEnv *env) { 15 | ALOGD("RegisterComposeCameraMethods start %s", HYComposeFilament) 16 | jclass clazz = env->FindClass(HYComposeFilament); 17 | if (clazz == nullptr) { 18 | ALOGD("RegisterComposeCameraMethods fail clazz == null") 19 | return JNI_FALSE; 20 | } 21 | // if (env->RegisterNatives(clazz, g_ComposeFilamentViewMethods, 22 | // std::size(g_ComposeFilamentViewMethods)) < 0) { 23 | // ALOGD("RegisterComposeCameraMethods fail") 24 | // return JNI_FALSE; 25 | // } 26 | return JNI_TRUE; 27 | } 28 | 29 | static void UnRegisterComposeFilamentMethods(JNIEnv *env) { 30 | jclass clazz = env->FindClass(HYComposeFilament); 31 | if (clazz == nullptr) { 32 | ALOGD("UnRegisterComposeCameraMethods fail clazz == null") 33 | } 34 | env->UnregisterNatives(clazz); 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/cpp/compose/ComposeFlexboxLayoutJNI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "jni.h" 4 | #include "native_log.h" 5 | #include "FlexboxLayout.h" 6 | #include "w3c_util.h" 7 | 8 | using namespace HYSkiaUI; 9 | 10 | const char *HYComposeFlexboxLayout = "com/temple/skiaui/compose/ui/HYComposeFlexboxLayout"; 11 | 12 | static JNINativeMethod g_ComposeFlexboxMethods[] = { 13 | }; 14 | 15 | static int RegisterComposeFlexboxLayoutMethods(JNIEnv *env) { 16 | ALOGD("RegisterComposeFlexboxLayoutMethods start %s", HYComposeFlexboxLayout) 17 | return JNI_TRUE; 18 | } 19 | 20 | static void UnRegisterComposeFlexboxLayoutMethods(JNIEnv *env) { 21 | ALOGD("UnRegisterComposeFlexboxLayoutMethods") 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/cpp/compose/ComposeRecyclerView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "RecyclerView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class ComposeRecyclerView : public RecyclerView { 8 | 9 | public: 10 | 11 | ComposeRecyclerView(); 12 | 13 | ~ComposeRecyclerView(); 14 | 15 | View *onCreateView(uint32_t index) override; 16 | 17 | void onBindView(uint32_t index, HYSkiaUI::View *view) override; 18 | 19 | uint32_t getViewType(uint32_t index) override; 20 | 21 | void checkJavaViewRef(jobject instance) override; 22 | 23 | private: 24 | 25 | jmethodID createViewMethodId = nullptr; 26 | jmethodID bindViewMethodId = nullptr; 27 | jmethodID viewTypeMethodId = nullptr; 28 | 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/cpp/custom/LyricScrollView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ScrollView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | enum class LyricType { 8 | Lrc, 9 | Srt, 10 | }; 11 | 12 | struct Lyric { 13 | std::string content; 14 | uint32_t type; //0=lrc; 1=srt 15 | std::vector timeMills; 16 | std::vector contentList; //逐字专用 17 | uint32_t lineIndex; 18 | }; 19 | 20 | class LyricScrollView : public ScrollView { 21 | 22 | public: 23 | 24 | LyricScrollView(); 25 | 26 | void setSourceSRT(const char *source); 27 | 28 | void draw(SkCanvas *canvas) override; 29 | 30 | void setCurrPositionFunc(std::function &&func); 31 | 32 | void pause(); 33 | 34 | void start(); 35 | 36 | private: 37 | 38 | View *initItem(int index); 39 | 40 | std::vector result; 41 | 42 | long startTimeMills = 0L; 43 | 44 | std::function currentPositionFunc = nullptr; 45 | 46 | int currentIndex = -1; 47 | 48 | bool paused = false; 49 | 50 | bool lastIndexFlag = false; 51 | 52 | }; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/cpp/filter/GrAHardwareBufferUtils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "include/core/SkTypes.h" 4 | 5 | #include "include/gpu/ganesh/GrBackendSurface.h" 6 | #include "include/gpu/ganesh/GrTypes.h" 7 | 8 | class GrDirectContext; 9 | 10 | extern "C" { 11 | typedef struct AHardwareBuffer AHardwareBuffer; 12 | } 13 | 14 | typedef void *TexImageCtx; 15 | 16 | typedef void (*DeleteImageProc)(TexImageCtx); 17 | 18 | typedef void (*UpdateImageProc)(TexImageCtx, GrDirectContext *); 19 | 20 | GrBackendTexture 21 | MakeGLBackendTexture(GrDirectContext *dContext, AHardwareBuffer *hardwareBuffer, 22 | int width, int height, DeleteImageProc *deleteProc, 23 | UpdateImageProc *updateProc, TexImageCtx *imageCtx, 24 | bool isProtectedContent, 25 | const GrBackendFormat &backendFormat, bool isRenderable); 26 | 27 | GrBackendFormat GetGLBackendFormat(GrDirectContext *dContext, 28 | uint32_t bufferFormat, 29 | bool requireKnownFormat); 30 | -------------------------------------------------------------------------------- /app/src/main/cpp/filter/IFilter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class SkPicture; 6 | 7 | namespace HYSkiaUI { 8 | 9 | class IFilter { 10 | 11 | public: 12 | 13 | IFilter() = default; 14 | 15 | virtual ~IFilter() = default; 16 | 17 | virtual void setWindowSize(int width, int height) = 0; 18 | 19 | virtual void render(SkPicture *picture) = 0; 20 | 21 | virtual long MakeHardwareBufferToSkImage(JNIEnv *env, jobject hardwareBuffer) = 0; 22 | 23 | virtual void deleteSkImage(JNIEnv *env, long skImagePtr) = 0; 24 | 25 | virtual long attachSurfaceTexture(JNIEnv* env, int width, int height, jobject surfaceTexture) = 0; 26 | 27 | virtual void updateTexImage(JNIEnv* env, jobject surfaceTexture, long skImagePtr) = 0; 28 | 29 | protected: 30 | 31 | int width = 0; 32 | int height = 0; 33 | 34 | long time = 0L; 35 | 36 | }; 37 | 38 | } -------------------------------------------------------------------------------- /app/src/main/cpp/filter/PersistentCache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "gpu/ganesh/GrContextOptions.h" 4 | #include "jni.h" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class PersistentCache : public GrContextOptions::PersistentCache { 9 | 10 | public: 11 | 12 | explicit PersistentCache(JNIEnv *env); 13 | 14 | ~PersistentCache(); 15 | 16 | sk_sp load(const SkData &key) override; 17 | 18 | void store(const SkData &key, const SkData &data) override; 19 | 20 | private: 21 | 22 | JNIEnv *jniEnv; 23 | 24 | jobject javaCache = nullptr; 25 | 26 | jmethodID storeMethodId = nullptr; 27 | 28 | jmethodID loadMethodId = nullptr; 29 | 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/cpp/inspect/Inspector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "v8-platform.h" 7 | #include "v8.h" 8 | #include "V8InspectorListener.h" 9 | #include "WebSocketServer.h" 10 | #include "V8InspectorClientImpl.h" 11 | #include "SkiaUIContext.h" 12 | 13 | namespace HYSkiaUI { 14 | 15 | class Inspector { 16 | public: 17 | Inspector(std::shared_ptr &context, int webSocketPort); 18 | 19 | void startAgent(); 20 | 21 | void printLogInChrome(std::string& log); 22 | 23 | private: 24 | void onMessage(const std::string &message); 25 | 26 | void sendMessage(const std::string &message); 27 | 28 | int waitForFrontendMessage(); 29 | 30 | v8::Handle context; 31 | std::unique_ptr websocketServer; 32 | std::unique_ptr inspectorClient; 33 | std::vector scripts = {}; 34 | std::shared_ptr runtime; 35 | std::shared_ptr uiContext; 36 | }; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/cpp/inspect/V8InspctprChannelImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "V8InspctprChannelImpl.h" 2 | #include 3 | #include "inspect_utils.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | V8InspectorChannelImp::V8InspectorChannelImp( 8 | std::shared_ptr &runtime, 9 | const std::function &onResponse) { 10 | this->runtime = runtime; 11 | this->onResponse = onResponse; 12 | } 13 | 14 | void V8InspectorChannelImp::sendResponse( 15 | int callId, 16 | std::unique_ptr message) { 17 | runtime->enterContext([this, &message](v8::Isolate *isolate, v8::Local skiaUI) { 18 | const std::string response = convertToString(isolate, message->string()); 19 | onResponse(response); 20 | }); 21 | } 22 | 23 | void V8InspectorChannelImp::sendNotification(std::unique_ptr message) { 24 | runtime->enterContext([this, &message](v8::Isolate *isolate, v8::Local skiaUI) { 25 | const std::string notification = convertToString(isolate, message->string()); 26 | onResponse(notification); 27 | }); 28 | } 29 | 30 | void V8InspectorChannelImp::flushProtocolNotifications() { 31 | // flush protocol notification 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/cpp/inspect/V8InspctprChannelImpl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "js/V8Runtime.h" 7 | 8 | namespace HYSkiaUI { 9 | 10 | class V8InspectorChannelImp final : public v8_inspector::V8Inspector::Channel { 11 | public: 12 | V8InspectorChannelImp(std::shared_ptr &runtime, 13 | const std::function &onResponse); 14 | 15 | void sendResponse(int callId, std::unique_ptr message) override; 16 | 17 | void sendNotification(std::unique_ptr message) override; 18 | 19 | void flushProtocolNotifications() override; 20 | 21 | private: 22 | std::shared_ptr runtime; 23 | std::function onResponse; 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/cpp/inspect/V8InspectorListener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "v8.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | struct V8InspectorListener { 8 | virtual void onConnected(const v8::Local &context) = 0; 9 | }; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/cpp/inspect/WebSocketServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "functional" 4 | #include "SkiaUIContext.h" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class WebSocketServer { 9 | public: 10 | WebSocketServer(std::shared_ptr &uiContext, int port, 11 | std::function onMessage); 12 | 13 | ~WebSocketServer(); 14 | 15 | void run(); 16 | 17 | void sendMessage(const std::string &message); 18 | 19 | void receiveMessage(const std::string &message); 20 | 21 | void waitForFrontendMessageOnPause(); 22 | 23 | void printLogInChrome(std::string& log); 24 | 25 | private: 26 | void startListening(); 27 | 28 | void printListeningMessage(); 29 | 30 | void waitFrontendMessage(); 31 | 32 | int port; 33 | std::function onMessage; 34 | 35 | std::shared_ptr uiContext; 36 | 37 | jmethodID runMethodId = nullptr; 38 | jmethodID sendMessageMethodId = nullptr; 39 | jmethodID startListeningMethodId = nullptr; 40 | jmethodID waitFrontendMessageMethodId = nullptr; 41 | jmethodID releaseMethodId = nullptr; 42 | jmethodID printLogInChromeMethodId = nullptr; 43 | jobject javaWSServer = nullptr; 44 | 45 | }; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/File.cpp: -------------------------------------------------------------------------------- 1 | #include "File.h" 2 | #include "native_log.h" 3 | 4 | namespace HYSkiaUI { 5 | 6 | File::File(std::string path, std::shared_ptr &context) : path(std::move(path)) { 7 | this->context = context; 8 | ALOGD("File:: new File %s", path.c_str()) 9 | } 10 | 11 | bool File::exist() { 12 | if (context == nullptr) { 13 | return false; 14 | } 15 | ALOGD("File:: exist") 16 | return context->getAssetManager()->exist(path.c_str()); 17 | } 18 | 19 | std::string File::read() { 20 | if (context == nullptr) { 21 | return ""; 22 | } 23 | ALOGD("File:: read %s", path.c_str()) 24 | return context->getAssetManager()->readFile(path.c_str()); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/File.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "string" 4 | #include "memory" 5 | #include "SkiaUIContext.h" 6 | 7 | namespace HYSkiaUI { 8 | 9 | class File { 10 | 11 | public: 12 | 13 | File() = delete; 14 | 15 | File(File &file) = delete; 16 | 17 | void operator=(File &file) = delete; 18 | 19 | File(std::string path, std::shared_ptr &context); 20 | 21 | bool exist(); 22 | 23 | std::string read(); 24 | 25 | private: 26 | 27 | std::string path; 28 | 29 | std::shared_ptr context = nullptr; 30 | 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSAudioPlayer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SkiaUIContext.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSAudioPlayer { 8 | 9 | public: 10 | 11 | JSAudioPlayer(std::shared_ptr &context, std::string& path); 12 | 13 | ~JSAudioPlayer(); 14 | 15 | void start(); 16 | 17 | void pause(); 18 | 19 | void release(); 20 | 21 | long getCurrPosition(); 22 | 23 | long getDuration(); 24 | 25 | void seek(long position); 26 | 27 | private: 28 | 29 | std::shared_ptr context = nullptr; 30 | 31 | jclass javaAudioPlayerClass = nullptr; 32 | 33 | jmethodID javaAudioPlayerConstructor = nullptr; 34 | 35 | jmethodID getFFTDataMethodID = nullptr; 36 | 37 | jmethodID startMethodID = nullptr; 38 | 39 | jmethodID pauseMethodID = nullptr; 40 | 41 | jmethodID currentPositionMethodID = nullptr; 42 | 43 | jmethodID releaseMethodID = nullptr; 44 | 45 | jmethodID getDurationMethodID = nullptr; 46 | 47 | jmethodID seekMethodID = nullptr; 48 | 49 | jmethodID isPlayingMethodID = nullptr; 50 | 51 | jobject audioPlayer = nullptr; 52 | 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSAudioPlayerBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSAudioPlayerBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSAudioPlayerBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSButtonBinding.cpp: -------------------------------------------------------------------------------- 1 | #include "JSButtonBinding.h" 2 | #include "Button.h" 3 | 4 | namespace HYSkiaUI { 5 | 6 | v8::Local 7 | JSButtonBinding::registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 8 | v8::Local inherit, 9 | v8::Local external) { 10 | auto buttonConstructor = MakeJSViewConstructor(); 11 | auto buttonTemplate = v8::FunctionTemplate::New(isolate, buttonConstructor, external); 12 | buttonTemplate->Inherit(inherit); 13 | buttonTemplate->InstanceTemplate()->SetInternalFieldCount(1); 14 | buttonTemplate->SetClassName(v8::String::NewFromUtf8(isolate, "Button")); 15 | v8::Local constructor = buttonTemplate->GetFunction(); 16 | skiaUI->Set(v8::String::NewFromUtf8(isolate, "Button"), constructor); 17 | return buttonTemplate; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSButtonBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSButtonBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSButtonBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSFileBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSFileBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSFileBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSFlexboxLayoutBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSFlexboxLayoutBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSFlexboxLayoutBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSIconBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSIconBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSIconBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSImageViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSImageViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSImageViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSLinearAnimationBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSLinearAnimationBinding : public JSBinding { 8 | public: 9 | 10 | explicit JSLinearAnimationBinding(std::shared_ptr &context): JSBinding(context) {} 11 | 12 | v8::Local 13 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 14 | v8::Local inherit, 15 | v8::Local external) override; 16 | }; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSLottieViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSLottieViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSLottieViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSPageBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSPageBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSPageBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSProgressBarBinding.h: -------------------------------------------------------------------------------- 1 | #include "JSBinding.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | class JSProgressBarBinding : public JSBinding { 6 | 7 | public: 8 | 9 | explicit JSProgressBarBinding(std::shared_ptr &context): JSBinding(context) {} 10 | 11 | v8::Local 12 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 13 | v8::Local inherit, 14 | v8::Local external) override; 15 | 16 | }; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSSVGViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSSVGViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSSVGViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSScrollViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSScrollViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSScrollViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSShaderViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSShaderViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSShaderViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSSwitchBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSSwitchBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSSwitchBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSTextEncodingBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSTextEncodingBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSTextEncodingBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSTextViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSTextViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSTextViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSVideoViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSVideoViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSVideoViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSViewGroupBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSViewGroupBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSViewGroupBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/cpp/js/JSYUVVideoViewBinding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JSBinding.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JSYUVVideoViewBinding : public JSBinding { 8 | 9 | public: 10 | 11 | explicit JSYUVVideoViewBinding(std::shared_ptr &context): JSBinding(context) {} 12 | 13 | v8::Local 14 | registerJSView(v8::Isolate *isolate, v8::Local skiaUI, 15 | v8::Local inherit, 16 | v8::Local external) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/TextEncoding.cpp: -------------------------------------------------------------------------------- 1 | #include "TextEncoding.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | TextEncoding::TextEncoding() { 6 | 7 | } 8 | 9 | const char *TextEncoding::encode(std::string &value) { 10 | return value.c_str(); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/TextEncoding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "string" 4 | #include "memory" 5 | #include "SkiaUIContext.h" 6 | 7 | namespace HYSkiaUI { 8 | 9 | class TextEncoding { 10 | 11 | public: 12 | 13 | TextEncoding(); 14 | 15 | TextEncoding(TextEncoding &file) = delete; 16 | 17 | void operator=(TextEncoding &file) = delete; 18 | 19 | const char* encode(std::string& value); 20 | 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/backPressed.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "v8.h" 4 | #include "JavascriptTest.h" 5 | 6 | using namespace HYSkiaUI; 7 | 8 | auto backPressedCallback = [](const v8::FunctionCallbackInfo &args) { 9 | v8::Isolate *isolate = args.GetIsolate(); 10 | v8::HandleScope handle_scope(isolate); 11 | if (args.Length() < 1 || !args[0]->IsFunction()) { 12 | isolate->ThrowException(v8::String::NewFromUtf8(isolate, "Invalid argument")); 13 | return; 14 | } 15 | auto data = v8::Local::Cast(args.Data()); 16 | auto app = static_cast(data->Value()); 17 | assert(app); 18 | v8::Local function = v8::Local::Cast(args[0]); 19 | auto callbackId = app->BACK_PRESSED_INDEX++; 20 | app->backPressCallbackMap[callbackId] = v8::Persistent>( 21 | isolate, function); 22 | args.GetReturnValue().Set(callbackId); 23 | }; 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/js/performance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "v8.h" 4 | #include "JavascriptTest.h" 5 | 6 | using namespace HYSkiaUI; 7 | 8 | auto nowCallback = [](const v8::FunctionCallbackInfo &args) { 9 | auto isolate = args.GetIsolate(); 10 | if (args.Length() != 0) { 11 | isolate->ThrowException(v8::String::NewFromUtf8(isolate, "Invalid argument")); 12 | return; 13 | } 14 | auto data = v8::Local::Cast(args.Data()); 15 | auto app = static_cast(data->Value()); 16 | auto result = app->getContext()->getCurrentTimeMills(); 17 | args.GetReturnValue().Set(static_cast(result)); 18 | }; 19 | -------------------------------------------------------------------------------- /app/src/main/cpp/page/PageStackManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "vector" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class Page; 8 | 9 | class PageStackManager { 10 | 11 | public: 12 | 13 | PageStackManager(); 14 | 15 | ~PageStackManager(); 16 | 17 | void push(Page *page); 18 | 19 | Page *pop(); 20 | 21 | Page *back(); 22 | 23 | const std::vector &getPages(); 24 | 25 | void showCurrentPage(); 26 | 27 | void hideCurrentPage(); 28 | 29 | void hideLastPage(); 30 | 31 | void showLastPage(); 32 | 33 | void removeDestroyedPage(); 34 | 35 | private: 36 | 37 | std::vector pages; 38 | 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/cpp/plugin/PluginManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "unordered_map" 5 | #include "string" 6 | 7 | namespace HYSkiaUI { 8 | 9 | class PluginManager { 10 | 11 | public: 12 | 13 | PluginManager(); 14 | 15 | ~PluginManager(); 16 | 17 | std::string invokeMethod(const std::string &pluginName, 18 | const std::string &methodName, 19 | const std::string &methodParam); 20 | 21 | void initJavaPluginManager(jobject javaPlugins, JNIEnv *env); 22 | 23 | void releaseJavaPluginManager(JNIEnv *env); 24 | 25 | private: 26 | 27 | jobject globalJavaPlugins = nullptr; 28 | jclass javaPluginsClass = nullptr; 29 | jmethodID javaInvokeMethod = nullptr; 30 | 31 | JNIEnv *env = nullptr; 32 | 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/BlendTestView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class BlendTestView : public View { 8 | 9 | public: 10 | 11 | BlendTestView(); 12 | 13 | ~BlendTestView(); 14 | 15 | void layout(int l, int t, int r, int b) override; 16 | 17 | void draw(SkCanvas *canvas) override; 18 | 19 | void setBlendMode(SkBlendMode mode); 20 | 21 | private: 22 | 23 | std::unique_ptr testPaint; 24 | 25 | std::unique_ptr discP; 26 | 27 | int size = 200; 28 | 29 | SkBlendMode mode; 30 | 31 | SkRect testRect; 32 | 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/CameraPage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | #include "ImageView.h" 5 | #include "CameraView.h" 6 | 7 | namespace HYSkiaUI { 8 | 9 | class CameraPage : public Page { 10 | 11 | public: 12 | 13 | void init(std::shared_ptr &context, int width, int height) override; 14 | 15 | private: 16 | 17 | void initChildren(ViewGroup *root, int width, int height); 18 | 19 | CameraView *cameraView = nullptr; 20 | 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/CanvasTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | #include "memory" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class CanvasTest : public View { 9 | 10 | public: 11 | 12 | CanvasTest(); 13 | 14 | ~CanvasTest(); 15 | 16 | void draw(SkCanvas *canvas) override; 17 | 18 | void setCircleSize(int size); 19 | 20 | private: 21 | 22 | std::unique_ptr paint; 23 | std::unique_ptr pathPaint; 24 | 25 | int size = 0; 26 | 27 | long testIndex = 0; 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/ClockView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class ClockView : public View { 8 | 9 | public: 10 | 11 | ClockView(); 12 | 13 | ~ClockView(); 14 | 15 | void draw(SkCanvas *canvas) override; 16 | 17 | private: 18 | 19 | void drawBackground(SkCanvas *canvas); 20 | 21 | void drawClockHand(SkCanvas *canvas, float angle, float length, float handWidth, SkColor color); 22 | 23 | std::unique_ptr numberPaint; 24 | 25 | std::unique_ptr font; 26 | 27 | std::unique_ptr circlePaint; 28 | 29 | std::unique_ptr detailPaint; 30 | 31 | std::unique_ptr centerPaint; 32 | 33 | std::unique_ptr handPaint; 34 | 35 | }; 36 | 37 | } -------------------------------------------------------------------------------- /app/src/main/cpp/test/CppTest.cpp: -------------------------------------------------------------------------------- 1 | #include "CppTest.h" 2 | #include "Page.h" 3 | #include "PageStackManager.h" 4 | #include "ExamplePage.h" 5 | #include "MatrixTestPage.h" 6 | 7 | namespace HYSkiaUI { 8 | 9 | void CppTest::doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) { 10 | if (root == nullptr) { 11 | ALOGD("doDrawTest %d %d", width, height) 12 | auto page = new ExamplePage(); 13 | // auto page = new QQMusicPage(); 14 | root = page; 15 | page->init(context, width, height); 16 | context->getPageStackManager()->push(page); 17 | page->enterFromRight(Page::EnterExitInfo(width, 0)); 18 | } 19 | if (root->getWidth() != width || root->getHeight() != height) { 20 | root->pageSizeChange(width, height); 21 | } 22 | performAnimations(width, height); 23 | context->getPageStackManager()->removeDestroyedPage(); 24 | for (const auto &item: context->getPageStackManager()->getPages()) { 25 | if (!item->getVisibility()) { 26 | continue; 27 | } 28 | item->drawOneFrame(drawCount); 29 | item->measure(); 30 | item->layout(0, 0, width, height); 31 | item->draw(canvas); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/CppTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ITestDraw.h" 4 | #include "Page.h" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class CppTest : public ITestDraw { 9 | 10 | public: 11 | 12 | CppTest() = default; 13 | 14 | ~CppTest() = default; 15 | 16 | virtual void doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) override; 17 | 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/EasingTestPage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class EasingTestPage : public Page { 8 | 9 | public: 10 | 11 | void init(std::shared_ptr &context, int width, int height) override; 12 | 13 | private: 14 | 15 | void initChildren(ViewGroup *root, int width, int height); 16 | 17 | }; 18 | 19 | } -------------------------------------------------------------------------------- /app/src/main/cpp/test/ExamplePage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | #include "LinearAnimator.h" 5 | #include "FlexboxLayout.h" 6 | 7 | namespace HYSkiaUI { 8 | 9 | static bool blackWhiteMode = false; 10 | 11 | class ExamplePage : public Page { 12 | 13 | public: 14 | 15 | void init(std::shared_ptr &context, int width, int height) override; 16 | 17 | void onShow() override; 18 | 19 | void onHide() override; 20 | 21 | private: 22 | 23 | void initChildren(ViewGroup *root, int width, int height); 24 | 25 | LinearAnimator *lottieAnimator = nullptr; 26 | 27 | LinearAnimator *textAnimator = nullptr; 28 | 29 | void pushPage(int width, int height); 30 | 31 | void popPage(int width, int height); 32 | 33 | }; 34 | 35 | } -------------------------------------------------------------------------------- /app/src/main/cpp/test/FilamentPage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class FilamentPage : public Page { 8 | 9 | public: 10 | 11 | void init(std::shared_ptr &context, int width, int height) override; 12 | 13 | private: 14 | 15 | void initChildren(ViewGroup *root, int width, int height); 16 | 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/GridLayoutTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class GridLayoutTest : public Page { 8 | 9 | public: 10 | 11 | void init(std::shared_ptr &context, int width, int height) override; 12 | 13 | private: 14 | 15 | void initChildren(ViewGroup *root, int width, int height); 16 | 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/JetpackComposeTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ITestDraw.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class JetpackComposeTest : public ITestDraw { 8 | 9 | public: 10 | 11 | JetpackComposeTest(JNIEnv *jniEnv); 12 | 13 | ~JetpackComposeTest() override; 14 | 15 | void doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) override; 16 | 17 | void setContext(std::shared_ptr &context) override; 18 | 19 | private: 20 | 21 | JNIEnv *jniEnv = nullptr; 22 | 23 | jobject testRef = nullptr; 24 | 25 | bool createFlag = false; 26 | 27 | jmethodID composeAppCreateMethodId = nullptr; 28 | 29 | jmethodID composeAppDestroyMethodId = nullptr; 30 | 31 | }; 32 | 33 | } -------------------------------------------------------------------------------- /app/src/main/cpp/test/MatrixTestPage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | #include "ExoPlayerView.h" 5 | #include "ShaderView.h" 6 | 7 | namespace HYSkiaUI { 8 | 9 | class MatrixTestPage : public Page { 10 | 11 | public: 12 | 13 | void init(std::shared_ptr &context, int width, int height) override; 14 | 15 | private: 16 | 17 | void initChildren(ViewGroup *root, int width, int height); 18 | 19 | ExoPlayerView *videoView = nullptr; 20 | 21 | ShaderView *shaderView = nullptr; 22 | 23 | }; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/QQMusicPage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | #include "AudioFFTView.h" 5 | #include "ProgressBar.h" 6 | #include "ImageView.h" 7 | #include "LinearAnimator.h" 8 | #include "LyricScrollView.h" 9 | #include "AndroidImageView.h" 10 | 11 | namespace HYSkiaUI { 12 | 13 | class QQMusicPage : public Page { 14 | 15 | public: 16 | 17 | void init(std::shared_ptr &context, int width, int height) override; 18 | 19 | void drawOneFrame(int drawCount) override; 20 | 21 | private: 22 | 23 | float progress = 0.0; 24 | 25 | LyricScrollView *lyricView = nullptr; 26 | 27 | AudioFFTView *fftView = nullptr; 28 | 29 | ProgressBar *progressBar = nullptr; 30 | 31 | AndroidImageView *playImage = nullptr; 32 | 33 | ImageView *armView = nullptr; 34 | 35 | void updateArmView(bool play); 36 | 37 | LinearAnimator *recordOutAnimator = nullptr; 38 | 39 | LinearAnimator *recordInnerAnimator = nullptr; 40 | 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/ReactjsTest.cpp: -------------------------------------------------------------------------------- 1 | #include "ReactjsTest.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | void ReactjsTest::doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) { 6 | JavascriptTest::doDrawTest(drawCount, canvas, width, height); 7 | if (!createFlag) { 8 | createFlag = true; 9 | auto jsBuffer = context->getAssetManager()->readFile("react_bundle.js"); 10 | v8Runtime->evaluateJavaScript(jsBuffer, "react_bundle.js"); 11 | } 12 | performAnimations(width, height); 13 | invokeFrameCallback(); 14 | context->getPageStackManager()->removeDestroyedPage(); 15 | for (const auto &item: context->getPageStackManager()->getPages()) { 16 | if (!item->getVisibility()) { 17 | continue; 18 | } 19 | item->drawOneFrame(drawCount); 20 | item->measure(); 21 | item->layout(0, 0, width, height); 22 | item->draw(canvas); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/ReactjsTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JavascriptTest.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class ReactjsTest : public JavascriptTest { 8 | 9 | public: 10 | 11 | ReactjsTest() = default; 12 | 13 | ~ReactjsTest() = default; 14 | 15 | void doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) override; 16 | 17 | private: 18 | 19 | bool createFlag = false; 20 | 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/SimpleJavascriptTest.cpp: -------------------------------------------------------------------------------- 1 | #include "SimpleJavascriptTest.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | void SimpleJavascriptTest::doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) { 6 | JavascriptTest::doDrawTest(drawCount, canvas, width, height); 7 | MeasureTime measureTime("Javascript draw"); 8 | if (!createFlag) { 9 | createFlag = true; 10 | auto jsBuffer = context->getAssetManager()->readFile("test.js"); 11 | v8Runtime->evaluateJavaScript(jsBuffer, "test.js"); 12 | } 13 | performAnimations(width, height); 14 | invokeFrameCallback(); 15 | context->getPageStackManager()->removeDestroyedPage(); 16 | for (const auto &item: context->getPageStackManager()->getPages()) { 17 | if (!item->getVisibility()) { 18 | continue; 19 | } 20 | item->drawOneFrame(drawCount); 21 | item->measure(); 22 | item->layout(0, 0, width, height); 23 | item->draw(canvas); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/SimpleJavascriptTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JavascriptTest.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class SimpleJavascriptTest : public JavascriptTest { 8 | 9 | public: 10 | 11 | SimpleJavascriptTest() = default; 12 | 13 | ~SimpleJavascriptTest() = default; 14 | 15 | void doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) override; 16 | 17 | private: 18 | 19 | bool createFlag = false; 20 | 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/TextTestPage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class TextTestPage : public Page { 8 | 9 | public: 10 | 11 | void init(std::shared_ptr &context, int width, int height) override; 12 | 13 | private: 14 | 15 | void initChildren(ViewGroup *root, int width, int height); 16 | 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/VideoShaderTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Page.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class VideoShaderTest : public Page { 8 | 9 | public: 10 | 11 | void init(std::shared_ptr &context, int width, int height) override; 12 | 13 | private: 14 | 15 | void initChildren(ViewGroup *root, int width, int height); 16 | 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/VuejsTest.cpp: -------------------------------------------------------------------------------- 1 | #include "VuejsTest.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | void VuejsTest::doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) { 6 | JavascriptTest::doDrawTest(drawCount, canvas, width, height); 7 | if (!createFlag) { 8 | createFlag = true; 9 | auto jsBuffer = context->getAssetManager()->readFile("vue_bundle.js"); 10 | v8Runtime->evaluateJavaScript(jsBuffer, "vue_bundle.js"); 11 | } 12 | performAnimations(width, height); 13 | invokeFrameCallback(); 14 | context->getPageStackManager()->removeDestroyedPage(); 15 | for (const auto &item: context->getPageStackManager()->getPages()) { 16 | if (!item->getVisibility()) { 17 | continue; 18 | } 19 | item->drawOneFrame(drawCount); 20 | item->measure(); 21 | item->layout(0, 0, width, height); 22 | item->draw(canvas); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/cpp/test/VuejsTest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JavascriptTest.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class VuejsTest : public JavascriptTest { 8 | 9 | public: 10 | 11 | VuejsTest() = default; 12 | 13 | ~VuejsTest() = default; 14 | 15 | void doDrawTest(int drawCount, SkCanvas *canvas, int width, int height) override; 16 | 17 | private: 18 | 19 | bool createFlag = false; 20 | 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/touch/ScrollDispatcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "TouchEventDispatcher.h" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class ScrollDispatcher : public TouchEventDispatcher { 9 | 10 | public: 11 | 12 | friend class ScrollView; 13 | 14 | ScrollDispatcher(ScrollView *view); 15 | 16 | virtual ~ScrollDispatcher(); 17 | 18 | virtual bool onTouchEvent(TouchEvent *touchEvent) override; 19 | 20 | virtual View *findTargetViewTraversal(ViewGroup *viewGroup, TouchEvent *touchEvent) override; 21 | 22 | virtual bool onInterceptTouchEvent(TouchEvent *touchEvent) override; 23 | 24 | protected: 25 | 26 | /** 27 | * 当手离开屏幕,scrollView还能滑动时,需要使用动画模拟fling的效果 28 | */ 29 | virtual void fling(); 30 | 31 | ScrollView *scrollView; 32 | 33 | void resetLastScroll(); 34 | 35 | }; 36 | 37 | } -------------------------------------------------------------------------------- /app/src/main/cpp/touch/TouchEvent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "native_log.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class TouchEvent { 8 | 9 | public: 10 | 11 | enum MotionEvent { 12 | ACTION_DOWN = 0, 13 | ACTION_UP = 1, 14 | ACTION_MOVE = 2, 15 | ACTION_CANCEL = 3 16 | }; 17 | 18 | TouchEvent(MotionEvent action, float x, float y) : action(action), x(x), y(y) {} 19 | 20 | ~TouchEvent() {} 21 | 22 | public: 23 | MotionEvent action; 24 | float x, y; 25 | 26 | }; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/cpp/touch/Velocity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace HYSkiaUI { 4 | 5 | class Velocity { 6 | 7 | public: 8 | 9 | Velocity(float x, float y) : xVelocity(x), yVelocity(y) {} 10 | 11 | float xVelocity; 12 | 13 | float yVelocity; 14 | 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /app/src/main/cpp/widget/Button.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TextView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class Button : public TextView { 8 | 9 | public: 10 | 11 | Button(); 12 | 13 | ~Button() override; 14 | 15 | const char *name() override; 16 | 17 | void setMeasuredDimension(int _measuredWidth, int _measuredHeight) override; 18 | 19 | void draw(SkCanvas *canvas) override; 20 | 21 | void setContext(std::shared_ptr& context) override; 22 | 23 | void setAlpha(float alpha) override; 24 | 25 | private: 26 | 27 | /** 28 | * 水波纹 29 | */ 30 | SkPaint *ripplePaint; 31 | 32 | int defaultRadius = 20; 33 | 34 | int defaultPaddingTop = 20; 35 | 36 | int defaultPaddingLeft = 40; 37 | 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/CameraView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BaseSurfaceTextureView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class CameraView : public BaseSurfaceTextureView { 8 | 9 | public: 10 | 11 | CameraView(); 12 | 13 | ~CameraView() override; 14 | 15 | const char *getJavaClassPath() override; 16 | 17 | void initJNI() override; 18 | 19 | const char *name() override; 20 | 21 | void capture(std::function)> &&captureCallback); 22 | 23 | void layout(int l, int t, int r, int b) override; 24 | 25 | void draw(SkCanvas *canvas) override; 26 | 27 | void switchCamera(); 28 | 29 | private: 30 | 31 | SkMatrix imageMatrix; 32 | 33 | SkRect srcRect; 34 | 35 | std::function)> captureCallback; 36 | 37 | bool captureInNextDraw = false; 38 | 39 | jmethodID startMethodId = nullptr; 40 | 41 | jmethodID getRotationMethodId = nullptr; 42 | 43 | jmethodID getCameraWidthMethodId = nullptr; 44 | 45 | jmethodID getCameraHeightMethodId = nullptr; 46 | 47 | jmethodID switchCameraMethodId = nullptr; 48 | 49 | float cameraRatio = 0.0f; 50 | 51 | float viewRatio = 0.0f; 52 | 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/EditText.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PlatformView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class EditText : public PlatformView { 8 | 9 | public: 10 | 11 | EditText(); 12 | 13 | ~EditText() override; 14 | 15 | const char *getJavaPlatformViewName() override; 16 | 17 | const char *name() override; 18 | 19 | void onJavaViewCreated() override; 20 | 21 | void clearFocus(); 22 | 23 | void requestFocus(); 24 | 25 | void onHide() override; 26 | 27 | void setHint(const char *hint); 28 | 29 | void setTextColor(int color); 30 | 31 | void setHintColor(int color); 32 | 33 | void setInputType(int type); 34 | 35 | protected: 36 | 37 | jmethodID clearFocusMethodId = nullptr; 38 | 39 | jmethodID requestFocusMethodId = nullptr; 40 | 41 | jmethodID setHintMethodId = nullptr; 42 | 43 | jmethodID setTextColorMethodId = nullptr; 44 | 45 | jmethodID setHintColorMethodId = nullptr; 46 | 47 | jmethodID setInputTypeMethodId = nullptr; 48 | 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/ExoPlayerView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BaseSurfaceTextureView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class ExoPlayerView : public BaseSurfaceTextureView { 8 | 9 | public: 10 | 11 | ExoPlayerView(); 12 | 13 | ~ExoPlayerView() override; 14 | 15 | const char *getJavaClassPath() override; 16 | 17 | void initJNI() override; 18 | 19 | void drawOneFrame() override; 20 | 21 | void setSource(const char *source); 22 | 23 | const char *getSource(); 24 | 25 | const char *name() override; 26 | 27 | void setRenderFirstFrameCallback(std::function &&callback); 28 | 29 | void setCustomVideoPlayer(jobject player); 30 | 31 | void setBackgroundPlayback(bool flag); 32 | 33 | void setRepeatMode(bool repeatable); 34 | 35 | private: 36 | 37 | jmethodID setSourceMethodId = nullptr; 38 | 39 | jmethodID setCustomPlayerMethodId = nullptr; 40 | 41 | jmethodID setBackgroundPlaybackMethodId = nullptr; 42 | 43 | jmethodID setRepeatModeMethodId = nullptr; 44 | 45 | std::string source; 46 | 47 | bool firstFrame = true; 48 | 49 | std::function renderFirstFrameCallback = nullptr; 50 | 51 | }; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/FilamentView.cpp: -------------------------------------------------------------------------------- 1 | #include "FilamentView.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | FilamentView::FilamentView() { 6 | } 7 | 8 | FilamentView::~FilamentView() { 9 | } 10 | 11 | const char *FilamentView::getJavaClassPath() { 12 | return "com/temple/skiaui/platform/filament/PlatformFilamentViewPlugin"; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/FilamentView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BaseSurfaceTextureView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class FilamentView : public BaseSurfaceTextureView { 8 | 9 | public: 10 | 11 | FilamentView(); 12 | 13 | ~FilamentView() override; 14 | 15 | const char * getJavaClassPath() override; 16 | 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/FlexboxLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ViewGroup.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class FlexboxLayout : public ViewGroup { 8 | 9 | public: 10 | 11 | FlexboxLayout(); 12 | 13 | ~FlexboxLayout() override; 14 | 15 | const char *name() override; 16 | 17 | virtual void setFlexDirection(YGFlexDirection direction) override; 18 | 19 | void measure() override; 20 | 21 | virtual void layout(int l, int t, int r, int b) override; 22 | 23 | YGFlexDirection _direction = YGFlexDirectionColumn; 24 | 25 | protected: 26 | 27 | void layoutChildren(int l, int t, int r, int b); 28 | 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/GridLayout.cpp: -------------------------------------------------------------------------------- 1 | #include "GridLayout.h" 2 | 3 | namespace HYSkiaUI { 4 | 5 | GridLayout::GridLayout() { 6 | 7 | } 8 | 9 | GridLayout::~GridLayout() { 10 | 11 | } 12 | 13 | void GridLayout::setContext(std::shared_ptr &context) { 14 | View::setContext(context); 15 | setFlexWrap(YGWrap::YGWrapWrap); 16 | FlexboxLayout::setFlexDirection(YGFlexDirection::YGFlexDirectionRow); 17 | } 18 | 19 | void GridLayout::measure() { 20 | if (width == 0 || height == 0) { 21 | return; 22 | } 23 | for (auto &child: children) { 24 | child->setWidth(width / count); 25 | } 26 | FlexboxLayout::measure(); 27 | } 28 | 29 | void GridLayout::layout(int l, int t, int r, int b) { 30 | View::layout(l, t, r, b); 31 | layoutChildren(l, t, r, b); 32 | } 33 | 34 | void GridLayout::setRowCount(int count) { 35 | this->count = count; 36 | markDirty(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/GridLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FlexboxLayout.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class GridLayout : public FlexboxLayout { 8 | 9 | public: 10 | 11 | GridLayout(); 12 | 13 | ~GridLayout() override; 14 | 15 | void setContext(std::shared_ptr &context) override; 16 | 17 | void measure() override; 18 | 19 | void layout(int l, int t, int r, int b) override; 20 | 21 | void setRowCount(int count); 22 | 23 | private: 24 | 25 | int count = 2; 26 | 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/Icon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class Icon : public View { 8 | 9 | public: 10 | 11 | Icon(); 12 | 13 | ~Icon() override; 14 | 15 | void measure() override; 16 | 17 | void draw(SkCanvas *canvas) override; 18 | 19 | void setIcon(int32_t text); 20 | 21 | int32_t getIcon(); 22 | 23 | void setIconSize(int size); 24 | 25 | int getIconSize(); 26 | 27 | void setIconColor(SkColor color); 28 | 29 | void setIconColor(const char *color); 30 | 31 | const char *getIconColor(); 32 | 33 | void setAlpha(float alpha) override; 34 | 35 | private: 36 | 37 | int32_t text = 0; 38 | 39 | SkGlyphID glyphId = 0; 40 | 41 | std::unique_ptr font = nullptr; 42 | 43 | int size = 100; 44 | 45 | std::unique_ptr iconPaint = nullptr; 46 | 47 | float x = 0.0; 48 | 49 | float y = 0.0; 50 | 51 | const char *iconColor = nullptr; 52 | 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/LoadingView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class LoadingView : public View { 8 | 9 | public: 10 | 11 | LoadingView(); 12 | 13 | ~LoadingView() override; 14 | 15 | void draw(SkCanvas *canvas) override; 16 | 17 | void setLoadingColor(SkColor color); 18 | 19 | void setLoadingWidth(int width); 20 | 21 | void setSize(int size); 22 | 23 | void setLoadingHeight(int height); 24 | 25 | void setLoadingDuration(int duration); 26 | 27 | const char *name() override; 28 | 29 | private: 30 | 31 | int loadingWidth = 10; 32 | 33 | int loadingHeight = 30; 34 | 35 | int size = 5; 36 | 37 | int loadingMargin = 10; 38 | 39 | std::unique_ptr paint; 40 | 41 | int duration = 800; //ms 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/LottieView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | #include 5 | 6 | using namespace skottie; 7 | 8 | namespace HYSkiaUI { 9 | 10 | class LottieView : public View { 11 | 12 | public: 13 | 14 | LottieView(); 15 | 16 | ~LottieView() override; 17 | 18 | void setSource(const char *path); 19 | 20 | const char *getSource(); 21 | 22 | void draw(SkCanvas *canvas) override; 23 | 24 | void layout(int l, int t, int r, int b) override; 25 | 26 | const char *name() override; 27 | 28 | void start(); 29 | 30 | void pause(); 31 | 32 | void setRepeat(bool repeat); 33 | 34 | private: 35 | 36 | sk_sp lottieAnimation = nullptr; 37 | 38 | SkRect lottieRect; 39 | 40 | long startTime = 0L; 41 | 42 | long endTime = 0L; 43 | 44 | bool autoPlay = true; 45 | 46 | bool repeat = true; 47 | 48 | std::string source; 49 | 50 | long pausedTime = 0L; 51 | 52 | long duration = 0L; 53 | 54 | }; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/MovingArea.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FlexboxLayout.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class MovingArea : public FlexboxLayout { 8 | 9 | public: 10 | 11 | MovingArea(); 12 | 13 | ~MovingArea() override; 14 | 15 | bool onInterceptTouchEvent(TouchEvent *touchEvent) override; 16 | 17 | bool onTouchEvent(TouchEvent *touchEvent) override; 18 | 19 | void layout(int l, int t, int r, int b) override; 20 | 21 | const char *name() override; 22 | 23 | private: 24 | 25 | float lastX = 0.0f; 26 | float lastY = 0.0f; 27 | 28 | float originAlpha = 1.0f; 29 | 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/PickerView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ScrollView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class PickerView : public ScrollView { 8 | 9 | public: 10 | 11 | PickerView(); 12 | 13 | ~PickerView() override; 14 | 15 | void setContext(std::shared_ptr& context) override; 16 | 17 | void setOnChangeListener(std::function &&callback); 18 | 19 | void onFlingStopped() override; 20 | 21 | void measure() override; 22 | 23 | void layout(int l, int t, int r, int b) override; 24 | 25 | void draw(SkCanvas *canvas) override; 26 | 27 | private: 28 | 29 | void scrollToNearestChild(); 30 | 31 | std::function changeCallback; 32 | 33 | std::unique_ptr bottomPaint; 34 | 35 | SkRect centerMask; 36 | 37 | std::unique_ptr centerPaint; 38 | 39 | int centerHeight = 0; 40 | 41 | std::vector maskColor; 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/Radio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class Radio : public View { 8 | 9 | public: 10 | 11 | Radio(); 12 | 13 | ~Radio() override; 14 | 15 | void setOnChangeListener(std::function &&changeFunc); 16 | 17 | void layout(int l, int t, int r, int b) override; 18 | 19 | void draw(SkCanvas *canvas) override; 20 | 21 | void setSelected(bool selected); 22 | 23 | private: 24 | 25 | std::function changeFunc = nullptr; 26 | 27 | bool selected = false; 28 | 29 | std::unique_ptr radioPaint = nullptr; 30 | 31 | void setOnClickListener(std::function clickListener) override; 32 | 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/SVGView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "View.h" 4 | #include "svg/include/SkSVGDOM.h" 5 | 6 | namespace HYSkiaUI { 7 | 8 | class SVGView : public View { 9 | 10 | public: 11 | 12 | SVGView(); 13 | 14 | ~SVGView() override; 15 | 16 | virtual void setSource(const char *path); 17 | 18 | const char *getSource(); 19 | 20 | virtual void setText(const std::string &text); 21 | 22 | void draw(SkCanvas *canvas) override; 23 | 24 | void layout(int l, int t, int r, int b) override; 25 | 26 | void setXY(int x, int y); 27 | 28 | const char *name() override; 29 | 30 | private: 31 | 32 | sk_sp skSVGDom = nullptr; 33 | 34 | int x = 0, y = 0; 35 | 36 | std::string src; 37 | 38 | int containerWidth = 0, containerHeight = 0; 39 | 40 | SkMatrix svgMatrix; 41 | 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/cpp/widget/WebView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PlatformView.h" 4 | 5 | namespace HYSkiaUI { 6 | 7 | class WebView : public PlatformView { 8 | 9 | public: 10 | 11 | WebView(); 12 | 13 | ~WebView() override; 14 | 15 | void loadUrl(const char *url); 16 | 17 | void setProgress(int progress); 18 | 19 | void setProgressCallback(std::function &&callback); 20 | 21 | const char *getJavaPlatformViewName() override; 22 | 23 | void onJavaViewCreated() override; 24 | 25 | const char *name() override; 26 | 27 | private: 28 | 29 | jmethodID loadUrlMethodId = nullptr; 30 | 31 | std::string url; 32 | 33 | std::function progressCallback = nullptr; 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/cpp/yoga/YGNodePrint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #ifdef DEBUG 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | #include 15 | 16 | namespace facebook { 17 | namespace yoga { 18 | 19 | void YGNodeToString( 20 | std::string& str, 21 | YGNodeRef node, 22 | YGPrintOptions options, 23 | uint32_t level); 24 | 25 | } // namespace yoga 26 | } // namespace facebook 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /app/src/main/cpp/yoga/YGValue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #include 9 | 10 | const YGValue YGValueZero = {0, YGUnitPoint}; 11 | const YGValue YGValueUndefined = {YGUndefined, YGUnitUndefined}; 12 | const YGValue YGValueAuto = {YGUndefined, YGUnitAuto}; 13 | -------------------------------------------------------------------------------- /app/src/main/cpp/yoga/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | struct YGNode; 13 | struct YGConfig; 14 | 15 | namespace facebook { 16 | namespace yoga { 17 | 18 | namespace detail { 19 | 20 | struct Log { 21 | static void log( 22 | YGNode* node, 23 | YGLogLevel level, 24 | void*, 25 | const char* message, 26 | ...) noexcept; 27 | 28 | static void log( 29 | YGConfig* config, 30 | YGLogLevel level, 31 | void*, 32 | const char* format, 33 | ...) noexcept; 34 | }; 35 | 36 | } // namespace detail 37 | } // namespace yoga 38 | } // namespace facebook 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/HYSkiaUIApp.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui 2 | 3 | import android.app.Activity 4 | import android.app.Application 5 | import android.os.Build 6 | 7 | class HYSkiaUIApp : Application() { 8 | 9 | override fun onCreate() { 10 | super.onCreate() 11 | mInstance = this 12 | } 13 | 14 | companion object { 15 | private lateinit var mInstance: HYSkiaUIApp 16 | 17 | fun getInstance(): HYSkiaUIApp { 18 | return mInstance 19 | } 20 | 21 | private var globalFrameRate = 60 22 | } 23 | 24 | fun setFrameRate(activity: Activity) { 25 | globalFrameRate = if (Build.VERSION.SDK_INT >= 30) { 26 | activity.display?.mode?.refreshRate?.toInt() ?: 60 27 | } else { 28 | 60 29 | } 30 | } 31 | 32 | fun getFrameRate(): Int { 33 | return globalFrameRate 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/ISkiaView.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui 2 | 3 | interface ISkiaView { 4 | 5 | fun initEngine(type: Int) 6 | 7 | fun setRenderCallback(renderCallback: RenderCallback) 8 | 9 | fun onBackPressed() 10 | 11 | fun release() 12 | 13 | fun onUIModeChange() 14 | 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/RenderCallback.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui 2 | 3 | interface RenderCallback { 4 | 5 | fun updateFps(draw: Int, render: Int) 6 | 7 | fun onPlatformBackPressed() 8 | 9 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/audio/IAudioCallback.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.audio 2 | 3 | interface IAudioCallback { 4 | 5 | fun onComplete() {} 6 | 7 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/bitmap/AndroidBitmapLoader.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.bitmap 2 | 3 | import com.temple.skiaui.HYSkiaEngine 4 | 5 | class AndroidBitmapLoader(val engine: HYSkiaEngine, val ref: Long) { 6 | 7 | private var imageLoader: ImageLoader = GlideImageLoader(engine, ref) 8 | 9 | fun setSource(source: String, viewWidth: Int, viewHeight: Int) { 10 | imageLoader.requestBitmap(source, viewWidth, viewHeight) 11 | } 12 | 13 | fun setResId(resId: Int, viewWidth: Int, viewHeight: Int) { 14 | imageLoader.requestDrawable(resId, viewWidth, viewHeight) 15 | } 16 | 17 | fun release() { 18 | imageLoader.release() 19 | } 20 | 21 | private fun start() { 22 | imageLoader.start() 23 | } 24 | 25 | private fun stop() { 26 | imageLoader.stop() 27 | } 28 | 29 | companion object { 30 | private const val TAG = "AndroidBitmap" 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/bitmap/ImageLoader.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.bitmap 2 | 3 | import android.graphics.drawable.Drawable 4 | 5 | interface ImageLoader : Drawable.Callback { 6 | 7 | fun requestBitmap(source: String, viewWidth: Int, viewHeight: Int) 8 | 9 | fun requestDrawable(resId: Int, viewWidth: Int, viewHeight: Int) 10 | 11 | fun start() 12 | 13 | fun stop() 14 | 15 | fun release() 16 | 17 | override fun scheduleDrawable(who: Drawable, what: Runnable, `when`: Long) {} 18 | 19 | override fun unscheduleDrawable(who: Drawable, what: Runnable) {} 20 | 21 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/example/HYComposeExampleApp.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.example 2 | 3 | import android.util.Log 4 | import androidx.compose.ui.unit.Dp 5 | import com.temple.skiaui.HYSkiaEngine 6 | import com.temple.skiaui.compose.runtime.HYComposeApplication 7 | import com.temple.skiaui.compose.runtime.HYComposeSDK 8 | 9 | class HYComposeExampleApp(engine: HYSkiaEngine) : HYComposeApplication(engine) { 10 | 11 | init { 12 | engine.registerJetpackCompose() 13 | HYComposeSDK.initSDK(engine) 14 | } 15 | 16 | override fun onCreate(width: Dp, height: Dp) { 17 | Log.d(TAG, "onCreate") 18 | HYComposeExamplePage(engine).apply { 19 | start(width, height) 20 | HYComposeSDK.pushPage(this) 21 | } 22 | } 23 | 24 | override fun onDestroy() { 25 | Log.d(TAG, "onDestroy") 26 | } 27 | 28 | companion object { 29 | private const val TAG = "HYComposeExampleApp" 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/example/theme/Color.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.example.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | val Purple80 = Color(0xFFD0BCFF) 6 | val PurpleGrey80 = Color(0xFFCCC2DC) 7 | 8 | val Purple40 = Color(0xFF6650a4) 9 | val PurpleGrey40 = Color(0xFF625b71) -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/example/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.example.theme 2 | 3 | import androidx.compose.foundation.isSystemInDarkTheme 4 | import androidx.compose.material3.MaterialTheme 5 | import androidx.compose.material3.darkColorScheme 6 | import androidx.compose.material3.lightColorScheme 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.ui.graphics.Color 9 | 10 | private val DarkColorScheme = darkColorScheme( 11 | primary = Purple80, 12 | secondary = PurpleGrey80, 13 | // tertiary = Color.Black, 14 | // tertiaryContainer = Color.Red 15 | ) 16 | 17 | private val LightColorScheme = lightColorScheme( 18 | primary = Purple40, 19 | secondary = PurpleGrey40, 20 | // tertiary = Color.White, 21 | // tertiaryContainer = Color.Blue 22 | ) 23 | 24 | @Composable 25 | fun JetpackComposeTheme( 26 | darkTheme: Boolean = isSystemInDarkTheme(), 27 | dynamicColor: Boolean = false, 28 | content: @Composable () -> Unit 29 | ) { 30 | val colorScheme = when { 31 | darkTheme -> DarkColorScheme 32 | else -> LightColorScheme 33 | } 34 | 35 | MaterialTheme( 36 | colorScheme = colorScheme, 37 | typography = Typography, 38 | content = content 39 | ) 40 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/example/theme/Type.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.example.theme 2 | 3 | import androidx.compose.material3.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.FontFamily 6 | import androidx.compose.ui.text.font.FontWeight 7 | import androidx.compose.ui.unit.sp 8 | 9 | // Set of Material typography styles to start with 10 | val Typography = Typography( 11 | bodyLarge = TextStyle( 12 | fontFamily = FontFamily.Default, 13 | fontWeight = FontWeight.Normal, 14 | fontSize = 16.sp, 15 | lineHeight = 24.sp, 16 | letterSpacing = 0.5.sp 17 | ) 18 | /* Other default text styles to override 19 | titleLarge = TextStyle( 20 | fontFamily = FontFamily.Default, 21 | fontWeight = FontWeight.Normal, 22 | fontSize = 22.sp, 23 | lineHeight = 28.sp, 24 | letterSpacing = 0.sp 25 | ), 26 | labelSmall = TextStyle( 27 | fontFamily = FontFamily.Default, 28 | fontWeight = FontWeight.Medium, 29 | fontSize = 11.sp, 30 | lineHeight = 16.sp, 31 | letterSpacing = 0.5.sp 32 | ) 33 | */ 34 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/foundation/Attributes.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.foundation 2 | 3 | data class ShaderSource(var source: String, var list: Array) { 4 | 5 | override fun equals(other: Any?): Boolean { 6 | return super.equals(other) 7 | } 8 | 9 | override fun hashCode(): Int { 10 | return super.hashCode() 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/foundation/StyleKey.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.foundation 2 | 3 | object StyleKey { 4 | const val width = "width" 5 | const val height = "height" 6 | const val backgroundColor = "backgroundColor" 7 | const val position = "position" 8 | const val corner = "corner" 9 | const val minSize = "minSize" 10 | const val textSize = "textSize" 11 | const val flexDirection = "flexDirection" 12 | const val justifyContent = "justifyContent" 13 | const val alignItems = "alignItems" 14 | const val alignSelf = "alignSelf" 15 | const val margins = "margins" 16 | const val paddings = "paddings" 17 | const val wrap = "wrap" 18 | const val widthPercent = "widthPercent" 19 | const val heightPercent = "heightPercent" 20 | const val flex = "flex" 21 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/material/HYBadge.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.material 2 | 3 | import androidx.compose.material3.MaterialTheme 4 | import androidx.compose.material3.contentColorFor 5 | import androidx.compose.runtime.Composable 6 | import androidx.compose.ui.graphics.Color 7 | import androidx.compose.ui.unit.dp 8 | import com.temple.skiaui.compose.foundation.Modifier 9 | import com.temple.skiaui.compose.foundation.backgroundColor 10 | import com.temple.skiaui.compose.foundation.corner 11 | import com.temple.skiaui.compose.foundation.paddings 12 | import com.temple.skiaui.compose.runtime.Text 13 | 14 | @Composable 15 | fun Badge( 16 | content: String, 17 | containerColor: Color = MaterialTheme.colorScheme.error, 18 | contentColor: Color = contentColorFor(MaterialTheme.colorScheme.error) 19 | ) { 20 | val paddingTop = if (content.isEmpty()) 8.dp else 5.dp 21 | Text( 22 | modifier = Modifier.backgroundColor(containerColor) 23 | .corner(Int.MAX_VALUE.dp) 24 | .paddings(arrayOf(9.dp, paddingTop, 9.dp, paddingTop)), 25 | content = content, 26 | textSize = 10.dp, 27 | color = contentColor 28 | ) 29 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/runtime/HYComposeApplication.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.runtime 2 | 3 | import androidx.compose.ui.unit.Dp 4 | import com.temple.skiaui.HYSkiaEngine 5 | import com.temple.skiaui.compose.ui.util.px2dp 6 | 7 | abstract class HYComposeApplication(val engine: HYSkiaEngine) { 8 | 9 | open fun onCreate(width: Dp, height: Dp) { 10 | 11 | } 12 | 13 | open fun onDestroy() { 14 | 15 | } 16 | 17 | private fun innerOnCreate(width: Int, height: Int) { 18 | onCreate(px2dp(width), px2dp(height)) 19 | } 20 | 21 | private fun innerOnDestroy() { 22 | onDestroy() 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/runtime/HYComposeSDK.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.runtime 2 | 3 | import android.util.Log 4 | import com.temple.skiaui.HYSkiaEngine 5 | import java.util.Stack 6 | 7 | object HYComposeSDK { 8 | 9 | private const val TAG = "HYComposeSDK" 10 | 11 | private lateinit var pageStack: Stack 12 | 13 | fun initSDK(engine: HYSkiaEngine) { 14 | pageStack = Stack() 15 | } 16 | 17 | fun DeInitSDK() { 18 | pageStack.clear() 19 | } 20 | 21 | fun pushPage(page: HYComposeBasePage) { 22 | Log.d(TAG, "pushPage") 23 | pageStack.push(page) 24 | } 25 | 26 | fun popPage(engine: HYSkiaEngine) { 27 | engine.onBackPressed() 28 | } 29 | 30 | fun onPagePoped() { 31 | if (pageStack.empty()) { 32 | Log.e(TAG, "popPage failed") 33 | return 34 | } 35 | val page = pageStack.pop() 36 | page.dispose() 37 | if (pageStack.empty()) { 38 | DeInitSDK() 39 | } 40 | } 41 | 42 | fun onUIModeChange() { 43 | pageStack.forEach { 44 | it.onUIModeChange() 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/AutoReleasable.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | interface AutoReleasable { 4 | 5 | fun release() 6 | 7 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeAndroidImage.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import androidx.annotation.DrawableRes 4 | import com.temple.skiaui.compose.foundation.Modifier 5 | 6 | class HYComposeAndroidImage(modifier: Modifier) : HYComposeView(modifier) { 7 | 8 | override fun getViewType() = "AndroidImage" 9 | 10 | fun setResource(source: String?) { 11 | if (source.isNullOrEmpty()) { 12 | return 13 | } 14 | nativeSetResource(ref, source) 15 | } 16 | 17 | fun setResId(@DrawableRes resId: Int) { 18 | if (resId == 0) { 19 | return 20 | } 21 | nativeSetResId(ref, resId) 22 | } 23 | 24 | fun setContentScale(scale: ContentScale) { 25 | if (scale == ContentScale.Unspecified) { 26 | return 27 | } 28 | nativeSetScale(ref, scale.value) 29 | } 30 | 31 | fun setBlur(value: Float) { 32 | nativeSetBlur(ref, value) 33 | } 34 | 35 | private external fun nativeSetResource(ref: Long, source: String) 36 | private external fun nativeSetResId(ref: Long, resId: Int) 37 | private external fun nativeSetScale(ref: Long, scale: String) 38 | private external fun nativeSetBlur(ref: Long, blur: Float); 39 | 40 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeBaseSurfaceTexture.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | abstract class HYComposeBaseSurfaceTexture(modifier: Modifier) : HYComposeView(modifier) { 6 | 7 | fun setShaderPath(path: String?) { 8 | if (path.isNullOrEmpty()) { 9 | return 10 | } 11 | nativeSetShaderPath(ref, path) 12 | } 13 | 14 | fun setShaderCode(code: String?) { 15 | if (code.isNullOrEmpty()) { 16 | return 17 | } 18 | nativeSetShaderCode(ref, code) 19 | } 20 | 21 | private external fun nativeSetShaderPath(ref: Long, path: String) 22 | private external fun nativeSetShaderCode(ref: Long, code: String) 23 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeButton.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeButton(modifier: Modifier) : HYComposeText(modifier) { 6 | 7 | override fun getViewType(): String = "Button" 8 | 9 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeCamera.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | interface CameraCallback { 6 | fun onImageCaptured(imagePtr: Long) 7 | } 8 | 9 | class HYComposeCamera(modifier: Modifier) : HYComposeBaseSurfaceTexture(modifier) { 10 | 11 | override fun getViewType(): String { 12 | return "Camera" 13 | } 14 | 15 | fun capture(callback: CameraCallback) { 16 | nativeCapture(ref, callback) 17 | } 18 | 19 | private external fun nativeCapture(ref: Long, callback: CameraCallback) 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeFilament.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeFilament(modifier: Modifier) : HYComposeBaseSurfaceTexture(modifier) { 6 | 7 | override fun getViewType(): String = "Filament" 8 | 9 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeFlexboxLayout.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | open class HYComposeFlexboxLayout(modifier: Modifier) : HYComposeViewGroup(modifier) { 6 | 7 | override fun getViewType(): String = "FlexboxLayout" 8 | 9 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeIcon.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import androidx.compose.ui.graphics.Color 4 | import com.temple.skiaui.compose.foundation.Modifier 5 | import com.temple.skiaui.compose.ui.util.composeColorToSkiaColor 6 | 7 | class HYComposeIcon(modifier: Modifier) : HYComposeView(modifier) { 8 | 9 | override fun getViewType(): String = "Icon" 10 | 11 | fun setIcon(icon: Int) { 12 | nativeSetIcon(ref, icon) 13 | } 14 | 15 | fun setIconSize(size: Int) { 16 | nativeSetSize(ref, size) 17 | } 18 | 19 | fun setIconColor(color: Color) { 20 | nativeSetColor(ref, composeColorToSkiaColor(color)) 21 | } 22 | 23 | private external fun nativeSetIcon(ref: Long, icon: Int) 24 | private external fun nativeSetSize(ref: Long, size: Int) 25 | private external fun nativeSetColor(ref: Long, color: Int) 26 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeImage.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeImage(modifier: Modifier) : HYComposeView(modifier) { 6 | 7 | override fun getViewType(): String = "Image" 8 | 9 | fun setImageSource(source: String) { 10 | nativeSetSource(ref, source) 11 | } 12 | 13 | private external fun nativeSetSource(shaderView: Long, source: String) 14 | 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeLoadingView.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import androidx.compose.ui.graphics.Color 4 | import com.temple.skiaui.compose.foundation.Modifier 5 | import com.temple.skiaui.compose.ui.util.composeColorToSkiaColor 6 | 7 | class HYComposeLoadingView(modifier: Modifier) : HYComposeView(modifier) { 8 | 9 | override fun getViewType(): String = "Loading" 10 | 11 | fun setColor(color: Color) { 12 | nativeSetColor(ref, composeColorToSkiaColor(color)) 13 | } 14 | 15 | private external fun nativeSetColor(loadingView: Long, color: Int) 16 | 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeLottie.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeLottie(modifier: Modifier) : HYComposeView(modifier) { 6 | 7 | override fun getViewType(): String = "Lottie" 8 | 9 | fun setSource(source: String) { 10 | nativeSetSource(ref, source) 11 | } 12 | 13 | fun start() { 14 | nativeStart(ref) 15 | } 16 | 17 | fun pause() { 18 | nativePause(ref) 19 | } 20 | 21 | private external fun nativeSetSource(lottieView: Long, source: String) 22 | private external fun nativeStart(lottieView: Long) 23 | private external fun nativePause(lottieView: Long) 24 | 25 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposePage.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import android.util.Log 4 | import com.temple.skiaui.compose.foundation.Modifier 5 | 6 | class HYComposePage(modifier: Modifier, val onShow: () -> Unit, val onHide: () -> Unit) : 7 | HYComposeViewGroup(modifier) { 8 | 9 | override fun getViewType(): String = "Page" 10 | 11 | fun push(width: Int) { 12 | nativePush(ref, width) 13 | } 14 | 15 | fun pop() { 16 | nativePop(ref) 17 | } 18 | 19 | private fun onShowFromNative() { 20 | Log.d("HYComposePage", "onShow") 21 | onShow() 22 | } 23 | 24 | private fun onHideFromNative() { 25 | Log.d("HYComposePage", "onHide") 26 | onHide() 27 | } 28 | 29 | private external fun nativePush(page: Long, width: Int) 30 | private external fun nativePop(page: Long) 31 | 32 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposePaint.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import androidx.compose.ui.graphics.Color 4 | import com.temple.skiaui.compose.ui.util.composeColorToSkiaColor 5 | 6 | class HYComposePaint : AutoReleasable { 7 | 8 | var ref: Long = nativeInit() 9 | 10 | fun setAntiAlias(aa: Boolean) { 11 | nativeSetAntiAlias(ref, aa) 12 | } 13 | 14 | fun setColor(color: Color) { 15 | nativeSetColor(ref, composeColorToSkiaColor(color)) 16 | } 17 | 18 | override fun release() { 19 | nativeDeInit(ref) 20 | } 21 | 22 | private external fun nativeInit(): Long 23 | private external fun nativeSetAntiAlias(ref: Long, aa: Boolean) 24 | private external fun nativeSetColor(ref: Long, color: Int) 25 | private external fun nativeDeInit(ref: Long) 26 | 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposePath.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | class HYComposePath : AutoReleasable { 4 | 5 | var ref = nativeInit() 6 | 7 | fun moveTo(x: Float, y: Float) { 8 | nativeMoveTo(ref, x, y) 9 | } 10 | 11 | fun lineTo(x: Float, y: Float) { 12 | nativeLineTo(ref, x, y) 13 | } 14 | 15 | fun close() { 16 | nativeClose(ref) 17 | } 18 | 19 | override fun release() { 20 | nativeDeInit(ref) 21 | } 22 | 23 | private external fun nativeInit(): Long 24 | private external fun nativeMoveTo(ref: Long, x: Float, y: Float) 25 | private external fun nativeLineTo(ref: Long, x: Float, y: Float) 26 | private external fun nativeClose(ref: Long) 27 | private external fun nativeDeInit(ref: Long) 28 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeRecyclerView.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeRecyclerView( 6 | modifier: Modifier, 7 | val createView: (index: Int) -> HYComposeView, 8 | val bindView: (index: Int, node: HYComposeView) -> Unit, 9 | val viewType: (index: Int) -> Int, 10 | val dataSize: Int 11 | ) : HYComposeScrollView(modifier) { 12 | 13 | override fun getViewType(): String = "RecyclerView" 14 | 15 | fun setDataSize(size: Int) { 16 | nativeSetDataSize(ref, size) 17 | } 18 | 19 | private fun createViewFromJNI(index: Int): Long { 20 | return createView(index).ref 21 | } 22 | 23 | private fun bindViewFromJNI(index: Int, view: HYComposeView) { 24 | bindView(index, view) 25 | } 26 | 27 | fun getViewTypeFromJNI(index: Int): Int { 28 | return viewType(index) 29 | } 30 | 31 | private external fun nativeSetDataSize(ref: Long, size: Int) 32 | 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeSVG.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeSVG(modifier: Modifier) : HYComposeView(modifier) { 6 | 7 | override fun getViewType(): String = "SVG" 8 | 9 | fun setSource(source: String) { 10 | nativeSetSource(ref, source) 11 | } 12 | 13 | private external fun nativeSetSource(svg: Long, source: String) 14 | 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeScrollView.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | open class HYComposeScrollView(modifier: Modifier) : HYComposeFlexboxLayout(modifier) { 6 | 7 | private var position = -1 8 | private var offset = 0 9 | 10 | override fun getViewType(): String = "Scroll" 11 | 12 | fun scrollToPosition(position: Int) { 13 | if (position == this.position) { 14 | return 15 | } 16 | nativeScrollToPosition(ref, position) 17 | } 18 | 19 | fun scrollTo(offset: Int) { 20 | if (offset == this.offset) { 21 | return 22 | } 23 | nativeScrollOffset(ref, offset) 24 | } 25 | 26 | fun getDistanceByIndex(index: Int): Int { 27 | return nativeGetDistanceByIndex(ref, index) 28 | } 29 | 30 | private external fun nativeScrollToPosition(ref: Long, position: Int) 31 | private external fun nativeScrollOffset(ref: Long, offset: Int) 32 | private external fun nativeGetDistanceByIndex(ref: Long, index: Int): Int 33 | 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeShader.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | import com.temple.skiaui.compose.foundation.ShaderSource 5 | 6 | class HYComposeShader(modifier: Modifier) : HYComposeView(modifier) { 7 | 8 | override fun getViewType(): String = "Shader" 9 | 10 | fun setShaderSource(shaderSource: ShaderSource) { 11 | nativeSetSource(ref, shaderSource.source, shaderSource.list) 12 | } 13 | 14 | private external fun nativeSetSource(shaderView: Long, source: String, images: Array) 15 | 16 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeSwitch.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeSwitch(modifier: Modifier) : HYComposeView(modifier) { 6 | 7 | override fun getViewType(): String = "Switch" 8 | 9 | fun setEnable(enable: Boolean) { 10 | nativeSetEnable(ref, enable) 11 | } 12 | 13 | fun setColor(color: String) { 14 | nativeSetColor(ref, color) 15 | } 16 | 17 | private external fun nativeSetEnable(ref: Long, enable: Boolean) 18 | private external fun nativeSetColor(ref: Long, color: String) 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/HYComposeWeb.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui 2 | 3 | import com.temple.skiaui.compose.foundation.Modifier 4 | 5 | class HYComposeWeb(modifier: Modifier) : HYComposeView(modifier) { 6 | 7 | fun loadUrl(url: String) { 8 | nativeLoadUrl(ref, url) 9 | } 10 | 11 | override fun getViewType(): String = "Web" 12 | 13 | private external fun nativeLoadUrl(videoView: Long, url: String) 14 | 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/util/Bitmap_androidKt.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui.util 2 | 3 | import android.content.res.Resources 4 | import android.graphics.Bitmap 5 | import android.graphics.BitmapFactory 6 | import androidx.annotation.DrawableRes 7 | 8 | fun decodeDrawableResource(res: Resources, @DrawableRes resId: Int, reqWidth: Int): Bitmap { 9 | val options = BitmapFactory.Options().apply { 10 | inJustDecodeBounds = true 11 | BitmapFactory.decodeResource(res, resId, this) 12 | inSampleSize = calculateInSampleSize(this, reqWidth) 13 | inJustDecodeBounds = false 14 | } 15 | return BitmapFactory.decodeResource(res, resId, options) 16 | } 17 | 18 | private fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int): Int { 19 | val width = options.outWidth 20 | var inSampleSize = 1 21 | if (width > reqWidth) { 22 | val halfWidth = width / 2 23 | while (halfWidth / inSampleSize >= reqWidth) { 24 | inSampleSize *= 2 25 | } 26 | } 27 | return inSampleSize 28 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/util/Colors_androidKt.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui.util 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | internal fun composeColorToSkiaColor(color: Color): Int { 6 | return (color.value shr 32).toInt() 7 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/compose/ui/util/Dp_androidKt.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.compose.ui.util 2 | 3 | import androidx.compose.ui.unit.Dp 4 | import com.temple.skiaui.HYSkiaUIApp 5 | 6 | private val density = HYSkiaUIApp.getInstance().resources.displayMetrics.density 7 | 8 | fun dp2px(dp: Dp) = (dp.value * density + 0.5).toInt() 9 | 10 | fun dp2pxf(dp: Dp) = (dp.value * density + 0.5).toFloat() 11 | 12 | fun px2dp(px: Int): Dp = Dp(px / density) 13 | 14 | fun dpArrayToIntArray(array: Array): IntArray { 15 | return IntArray(array.size) { index -> 16 | dp2px(array[index]) 17 | } 18 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/platform/HYSurfaceCallback.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.platform 2 | 3 | interface HYSurfaceViewCallback { 4 | 5 | fun onSurfaceCreated() 6 | 7 | fun onSurfaceChanged(width: Int, height: Int) 8 | 9 | fun onSurfaceDestroyed() 10 | 11 | fun onShow() 12 | 13 | fun onHide() 14 | 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/platform/ICanvasProvider.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.platform 2 | 3 | import android.graphics.Canvas 4 | import android.view.Surface 5 | 6 | interface ICanvasProvider { 7 | 8 | fun lockCanvas(originCanvas: Canvas): Canvas? 9 | 10 | fun unLockCanvas(canvas: Canvas) 11 | 12 | fun getSurface(): Surface? 13 | 14 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/platform/SurfaceObj.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.platform 2 | 3 | import android.graphics.SurfaceTexture 4 | import android.view.Surface 5 | 6 | class SurfaceObj { 7 | 8 | var surfaceTexture: SurfaceTexture? = null 9 | 10 | var surface: Surface? = null 11 | 12 | var width = 0 13 | 14 | var height = 0 15 | 16 | fun release() { 17 | surfaceTexture?.setOnFrameAvailableListener(null) 18 | surfaceTexture?.release() 19 | surface?.release() 20 | } 21 | 22 | fun setDefaultBufferSize(width: Int, height: Int) { 23 | this.width = width 24 | this.height = height 25 | surfaceTexture?.setDefaultBufferSize(width, height) 26 | } 27 | 28 | companion object { 29 | var INDEX = 0 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/platform/data/ImageReaderYUVData.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.platform.data 2 | 3 | import java.nio.ByteBuffer 4 | 5 | open class ImageReaderYUVData { 6 | 7 | lateinit var yData: ByteBuffer 8 | 9 | lateinit var uData: ByteBuffer 10 | 11 | lateinit var vData: ByteBuffer 12 | 13 | var width = 0 14 | 15 | var height = 0 16 | 17 | var strideY = 0 18 | 19 | var strideU = 0 20 | 21 | var strideV = 0 22 | 23 | var rotation = 0 24 | 25 | lateinit var rData: ByteBuffer 26 | 27 | lateinit var gData: ByteBuffer 28 | 29 | lateinit var bData: ByteBuffer 30 | 31 | lateinit var aData: ByteBuffer 32 | 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/platform/video/IVideoPlayer.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.platform.video 2 | 3 | import android.view.Surface 4 | 5 | interface IVideoPlayer : IVideoListener { 6 | 7 | fun setSource(source: String) 8 | 9 | fun setVideoSurface(surface: Surface?) 10 | 11 | fun setRepeat(flag: Boolean) 12 | 13 | fun prepare() 14 | 15 | fun play() 16 | 17 | fun pause() 18 | 19 | fun stop() 20 | 21 | fun release() 22 | 23 | fun seekTo(positionMs: Long) 24 | 25 | fun getCurrentPosition(): Long 26 | 27 | fun getDuration(): Long 28 | 29 | fun setVideoListener(listener: IVideoListener?) 30 | 31 | } 32 | 33 | interface IVideoListener { 34 | fun onRenderedFirstFrame() 35 | fun onVideoSizeChanged(videoWidth: Int, videoHeight: Int) 36 | fun onPlayEnd() 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/platform/webview/IWebViewCallback.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.platform.webview 2 | 3 | interface IWebViewCallback { 4 | 5 | fun onProgressChanged(progress: Int) 6 | 7 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/plugin/IPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.plugin 2 | 3 | interface IPlugin { 4 | 5 | fun getName(): String 6 | 7 | fun invoke(methodName: String, methodParam: String): String 8 | 9 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/plugin/InspectWSServer.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.plugin 2 | 3 | import org.java_websocket.WebSocket 4 | import org.java_websocket.handshake.ClientHandshake 5 | import org.java_websocket.server.WebSocketServer 6 | import java.lang.Exception 7 | import java.net.InetSocketAddress 8 | 9 | class InspectWSServer(port: Int): WebSocketServer(InetSocketAddress(port)) { 10 | 11 | private var conn: WebSocket? = null 12 | 13 | override fun onOpen(conn: WebSocket?, handshake: ClientHandshake?) { 14 | this.conn = conn 15 | } 16 | 17 | override fun onClose(conn: WebSocket?, code: Int, reason: String?, remote: Boolean) { 18 | this.conn = null 19 | } 20 | 21 | override fun onMessage(conn: WebSocket?, message: String?) { 22 | 23 | } 24 | 25 | override fun onError(conn: WebSocket?, ex: Exception?) { 26 | this.conn = null 27 | } 28 | 29 | override fun onStart() { 30 | 31 | } 32 | 33 | fun send(message: String) { 34 | this.conn?.send(message) 35 | } 36 | 37 | companion object { 38 | private const val TAG = "Inspect-WebServer" 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/plugin/PluginManager.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.plugin 2 | 3 | class PluginManager { 4 | 5 | private val plugins = mutableMapOf() 6 | 7 | init { 8 | registerPlugin(ToastPlugin()) 9 | } 10 | 11 | fun registerPlugin(plugin: IPlugin) { 12 | plugins[plugin.getName()] = plugin 13 | } 14 | 15 | fun clearPlugins() { 16 | plugins.clear() 17 | } 18 | 19 | fun invokeMethod(pluginName: String, methodName: String, methodParam: String): String { 20 | return plugins[pluginName]?.invoke(methodName, methodParam) ?: "" 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/plugin/ToastPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.plugin 2 | 3 | import android.os.Handler 4 | import android.os.Looper 5 | import android.widget.Toast 6 | import com.temple.skiaui.HYSkiaUIApp 7 | 8 | class ToastPlugin : IPlugin { 9 | 10 | override fun getName(): String = "toast" 11 | 12 | private val mainHandler = Handler(Looper.getMainLooper()) 13 | 14 | private var toast: Toast? = null 15 | 16 | override fun invoke(methodName: String, methodParam: String): String { 17 | mainHandler.post { 18 | if (methodName == "show") { 19 | toast?.cancel() 20 | toast = Toast.makeText(HYSkiaUIApp.getInstance(), methodParam, Toast.LENGTH_SHORT) 21 | toast?.show() 22 | } 23 | } 24 | return "" 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/temple/skiaui/video/YUVData.kt: -------------------------------------------------------------------------------- 1 | package com.temple.skiaui.video 2 | 3 | import java.nio.ByteBuffer 4 | 5 | class YUVData { 6 | 7 | lateinit var data: ByteBuffer 8 | 9 | var videoWidth = 0 10 | 11 | var videoHeight = 0 12 | 13 | var stride = 0 14 | } -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/jniLibs/arm64-v8a.zip -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/android/AHardwareBufferUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef AHardwareBufferUtils_DEFINED 8 | #define AHardwareBufferUtils_DEFINED 9 | 10 | #include "include/core/SkColorType.h" 11 | #include "include/core/SkTypes.h" 12 | 13 | #if __ANDROID_API__ >= 26 14 | 15 | namespace AHardwareBufferUtils { 16 | 17 | SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat); 18 | 19 | } // namespace AHardwareBufferUtils 20 | 21 | #endif 22 | 23 | #endif // AHardwareBufferUtils_DEFINED 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/android/SkCanvasAndroid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkCanvasAndroid_DEFINED 9 | #define SkCanvasAndroid_DEFINED 10 | 11 | class SkCanvas; 12 | struct SkIRect; 13 | class GrBackendRenderTarget; 14 | 15 | namespace skgpu::ganesh { 16 | SkIRect TopLayerBounds(const SkCanvas*); 17 | GrBackendRenderTarget TopLayerBackendRenderTarget(const SkCanvas*); 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/codec/SkEncodedImageFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkEncodedImageFormat_DEFINED 9 | #define SkEncodedImageFormat_DEFINED 10 | 11 | #include 12 | 13 | /** 14 | * Enum describing format of encoded data. 15 | */ 16 | enum class SkEncodedImageFormat { 17 | kBMP, 18 | kGIF, 19 | kICO, 20 | kJPEG, 21 | kPNG, 22 | kWBMP, 23 | kWEBP, 24 | kPKM, 25 | kKTX, 26 | kASTC, 27 | kDNG, 28 | kHEIF, 29 | kAVIF, 30 | kJPEGXL, 31 | }; 32 | 33 | #endif // SkEncodedImageFormat_DEFINED 34 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/codec/SkPixmapUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkPixmapUtils_DEFINED 9 | #define SkPixmapUtils_DEFINED 10 | 11 | #include "include/codec/SkEncodedOrigin.h" 12 | #include "include/core/SkImageInfo.h" 13 | #include "include/private/base/SkAPI.h" 14 | 15 | class SkPixmap; 16 | 17 | namespace SkPixmapUtils { 18 | /** 19 | * Copy the pixels in src into dst, applying the orientation transformations specified 20 | * by origin. If the inputs are invalid, this returns false and no copy is made. 21 | */ 22 | SK_API bool Orient(const SkPixmap& dst, const SkPixmap& src, SkEncodedOrigin origin); 23 | 24 | /** 25 | * Return a copy of the provided ImageInfo with the width and height swapped. 26 | */ 27 | SK_API SkImageInfo SwapWidthHeight(const SkImageInfo& info); 28 | 29 | } // namespace SkPixmapUtils 30 | 31 | #endif // SkPixmapUtils_DEFINED 32 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkBlender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkBlender_DEFINED 9 | #define SkBlender_DEFINED 10 | 11 | #include "include/core/SkBlendMode.h" 12 | #include "include/core/SkFlattenable.h" 13 | 14 | /** 15 | * SkBlender represents a custom blend function in the Skia pipeline. A blender combines a source 16 | * color (the result of our paint) and destination color (from the canvas) into a final color. 17 | */ 18 | class SK_API SkBlender : public SkFlattenable { 19 | public: 20 | /** 21 | * Create a blender that implements the specified BlendMode. 22 | */ 23 | static sk_sp Mode(SkBlendMode mode); 24 | 25 | private: 26 | SkBlender() = default; 27 | friend class SkBlenderBase; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkBlurTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkBlurTypes_DEFINED 9 | #define SkBlurTypes_DEFINED 10 | 11 | enum SkBlurStyle : int { 12 | kNormal_SkBlurStyle, //!< fuzzy inside and outside 13 | kSolid_SkBlurStyle, //!< solid inside, fuzzy outside 14 | kOuter_SkBlurStyle, //!< nothing inside, fuzzy outside 15 | kInner_SkBlurStyle, //!< fuzzy inside, nothing outside 16 | 17 | kLastEnum_SkBlurStyle = kInner_SkBlurStyle, 18 | }; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkCapabilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkCapabilities_DEFINED 9 | #define SkCapabilities_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkTypes.h" 13 | #include "include/sksl/SkSLVersion.h" 14 | 15 | namespace SkSL { struct ShaderCaps; } 16 | 17 | namespace skgpu::graphite { class Caps; } 18 | 19 | class SK_API SkCapabilities : public SkRefCnt { 20 | public: 21 | static sk_sp RasterBackend(); 22 | 23 | SkSL::Version skslVersion() const { return fSkSLVersion; } 24 | 25 | protected: 26 | friend class skgpu::graphite::Caps; // for ctor 27 | 28 | SkCapabilities() = default; 29 | 30 | void initSkCaps(const SkSL::ShaderCaps*); 31 | 32 | SkSL::Version fSkSLVersion = SkSL::Version::k100; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkClipOp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkClipOp_DEFINED 9 | #define SkClipOp_DEFINED 10 | 11 | #include "include/core/SkTypes.h" 12 | 13 | enum class SkClipOp { 14 | kDifference = 0, 15 | kIntersect = 1, 16 | kMax_EnumValue = kIntersect 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkCoverageMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkCoverageMode_DEFINED 9 | #define SkCoverageMode_DEFINED 10 | 11 | /** 12 | * Describes geometric operations (ala SkRegion::Op) that can be applied to coverage bytes. 13 | * These can be thought of as variants of porter-duff (SkBlendMode) modes, but only applied 14 | * to the alpha channel. 15 | * 16 | * See SkMaskFilter for ways to use these when combining two different masks. 17 | */ 18 | enum class SkCoverageMode { 19 | kUnion, // A ∪ B A+B-A*B 20 | kIntersect, // A ∩ B A*B 21 | kDifference, // A - B A*(1-B) 22 | kReverseDifference, // B - A B*(1-A) 23 | kXor, // A ⊕ B A+B-2*A*B 24 | 25 | kLast = kXor, 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkFontTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontTypes_DEFINED 9 | #define SkFontTypes_DEFINED 10 | 11 | enum class SkTextEncoding { 12 | kUTF8, //!< uses bytes to represent UTF-8 or ASCII 13 | kUTF16, //!< uses two byte words to represent most of Unicode 14 | kUTF32, //!< uses four byte words to represent all of Unicode 15 | kGlyphID, //!< uses two byte words to represent glyph indices 16 | }; 17 | 18 | enum class SkFontHinting { 19 | kNone, //!< glyph outlines unchanged 20 | kSlight, //!< minimal modification to improve constrast 21 | kNormal, //!< glyph outlines modified to improve constrast 22 | kFull, //!< modifies glyph outlines for maximum constrast 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkFourByteTag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFourByteTag_DEFINED 9 | #define SkFourByteTag_DEFINED 10 | 11 | #include 12 | 13 | using SkFourByteTag = uint32_t; 14 | 15 | static inline constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d) { 16 | return (((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | (uint32_t)d); 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkMilestone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SK_MILESTONE 8 | #define SK_MILESTONE 132 9 | #endif 10 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkOpenTypeSVGDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkOpenTypeSVGDecoder_DEFINED 9 | #define SkOpenTypeSVGDecoder_DEFINED 10 | 11 | #include "include/core/SkColor.h" 12 | #include "include/core/SkSpan.h" 13 | #include "include/core/SkTypes.h" 14 | 15 | #include 16 | 17 | class SkCanvas; 18 | 19 | class SkOpenTypeSVGDecoder { 20 | public: 21 | /** Each instance probably owns an SVG DOM. 22 | * The instance may be cached so needs to report how much memory it retains. 23 | */ 24 | virtual size_t approximateSize() = 0; 25 | virtual bool render(SkCanvas&, int upem, SkGlyphID glyphId, 26 | SkColor foregroundColor, SkSpan palette) = 0; 27 | virtual ~SkOpenTypeSVGDecoder() = default; 28 | }; 29 | 30 | #endif // SkOpenTypeSVGDecoder_DEFINED 31 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkPoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 5 | */ 6 | 7 | // SkPoint is part of the public API, but is also required by code in base. The following include 8 | // forwarding allows SkPoint to participate in the API and for use by code in base. 9 | 10 | #include "include/private/base/SkPoint_impl.h" // IWYU pragma: export 11 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkSpan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | // We want SkSpan to be a public API, but it is also fundamental to many of our internal types. 9 | // Thus, we have a public file that clients can include. This file defers to the private copy 10 | // so we do not have a dependency cycle from our "base" files to our "core" files. 11 | 12 | #include "include/private/base/SkSpan_impl.h" // IWYU pragma: export 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkSwizzle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSwizzle_DEFINED 9 | #define SkSwizzle_DEFINED 10 | 11 | #include "include/private/base/SkAPI.h" 12 | 13 | #include 14 | 15 | /** 16 | Swizzles byte order of |count| 32-bit pixels, swapping R and B. 17 | (RGBA <-> BGRA) 18 | */ 19 | SK_API void SkSwapRB(uint32_t* dest, const uint32_t* src, int count); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/core/SkTileMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkTileModes_DEFINED 9 | #define SkTileModes_DEFINED 10 | 11 | #include "include/core/SkTypes.h" 12 | 13 | enum class SkTileMode { 14 | /** 15 | * Replicate the edge color if the shader draws outside of its 16 | * original bounds. 17 | */ 18 | kClamp, 19 | 20 | /** 21 | * Repeat the shader's image horizontally and vertically. 22 | */ 23 | kRepeat, 24 | 25 | /** 26 | * Repeat the shader's image horizontally and vertically, alternating 27 | * mirror images so that adjacent images always seam. 28 | */ 29 | kMirror, 30 | 31 | /** 32 | * Only draw within the original domain, return transparent-black everywhere else. 33 | */ 34 | kDecal, 35 | 36 | kLastTileMode = kDecal, 37 | }; 38 | 39 | static constexpr int kSkTileModeCount = static_cast(SkTileMode::kLastTileMode) + 1; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/docs/SkXPSDocument.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkXPSDocument_DEFINED 9 | #define SkXPSDocument_DEFINED 10 | 11 | #include "include/core/SkTypes.h" 12 | 13 | #ifdef SK_BUILD_FOR_WIN 14 | 15 | #include "include/core/SkDocument.h" 16 | 17 | struct IXpsOMObjectFactory; 18 | 19 | namespace SkXPS { 20 | 21 | SK_API sk_sp MakeDocument(SkWStream* stream, 22 | IXpsOMObjectFactory* xpsFactory, 23 | SkScalar dpi = SK_ScalarDefaultRasterDPI); 24 | 25 | } // namespace SkXPS 26 | #endif // SK_BUILD_FOR_WIN 27 | #endif // SkXPSDocument_DEFINED 28 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/effects/Sk2DPathEffect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef Sk2DPathEffect_DEFINED 9 | #define Sk2DPathEffect_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkScalar.h" 13 | #include "include/core/SkTypes.h" 14 | 15 | class SkMatrix; 16 | class SkPath; 17 | class SkPathEffect; 18 | 19 | class SK_API SkLine2DPathEffect { 20 | public: 21 | static sk_sp Make(SkScalar width, const SkMatrix& matrix); 22 | 23 | static void RegisterFlattenables(); 24 | }; 25 | 26 | class SK_API SkPath2DPathEffect { 27 | public: 28 | static sk_sp Make(const SkMatrix& matrix, const SkPath& path); 29 | 30 | static void RegisterFlattenables(); 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/effects/SkBlenders.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkBlenders_DEFINED 9 | #define SkBlenders_DEFINED 10 | 11 | #include "include/core/SkBlender.h" 12 | 13 | class SK_API SkBlenders { 14 | public: 15 | /** 16 | * Create a blender that implements the following: 17 | * k1 * src * dst + k2 * src + k3 * dst + k4 18 | * @param k1, k2, k3, k4 The four coefficients. 19 | * @param enforcePMColor If true, the RGB channels will be clamped to the calculated alpha. 20 | */ 21 | static sk_sp Arithmetic(float k1, float k2, float k3, float k4, bool enforcePremul); 22 | 23 | private: 24 | SkBlenders() = delete; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/effects/SkColorMatrixFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkColorMatrixFilter_DEFINED 9 | #define SkColorMatrixFilter_DEFINED 10 | 11 | #include "include/core/SkColorFilter.h" 12 | 13 | // (DEPRECATED) This factory function is deprecated. Please use the one in 14 | // SkColorFilters (i.e., Lighting). 15 | class SK_API SkColorMatrixFilter : public SkColorFilter { 16 | public: 17 | static sk_sp MakeLightingFilter(SkColor mul, SkColor add) { 18 | return SkColorFilters::Lighting(mul, add); 19 | } 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/effects/SkCornerPathEffect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkCornerPathEffect_DEFINED 9 | #define SkCornerPathEffect_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkScalar.h" 13 | #include "include/core/SkTypes.h" 14 | 15 | class SkPathEffect; 16 | 17 | /** \class SkCornerPathEffect 18 | 19 | SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners 20 | into various treatments (e.g. rounded corners) 21 | */ 22 | class SK_API SkCornerPathEffect { 23 | public: 24 | /** radius must be > 0 to have an effect. It specifies the distance from each corner 25 | that should be "rounded". 26 | */ 27 | static sk_sp Make(SkScalar radius); 28 | 29 | static void RegisterFlattenables(); 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/effects/SkOverdrawColorFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "include/core/SkColor.h" 9 | #include "include/core/SkRefCnt.h" 10 | #include "include/core/SkTypes.h" 11 | 12 | class SkColorFilter; 13 | 14 | #ifndef SkOverdrawColorFilter_DEFINED 15 | #define SkOverdrawColorFilter_DEFINED 16 | 17 | /** 18 | * Uses the value in the src alpha channel to set the dst pixel. 19 | * 0 -> colors[0] 20 | * 1 -> colors[1] 21 | * ... 22 | * 5 (or larger) -> colors[5] 23 | * 24 | * https://fiddle.skia.org/c/@overdrawcolorfilter_grid 25 | */ 26 | class SK_API SkOverdrawColorFilter { 27 | public: 28 | static constexpr int kNumColors = 6; 29 | 30 | static sk_sp MakeWithSkColors(const SkColor[kNumColors]); 31 | }; 32 | 33 | #endif // SkOverdrawColorFilter_DEFINED 34 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/effects/SkShaderMaskFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkShaderMaskFilter_DEFINED 9 | #define SkShaderMaskFilter_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkTypes.h" 13 | 14 | class SkMaskFilter; 15 | class SkShader; 16 | 17 | // (DEPRECATED) This factory function is deprecated. ShaderMaskFilters will be deleted entirely 18 | // in an upcoming Skia release. 19 | class SK_API SkShaderMaskFilter { 20 | public: 21 | static sk_sp Make(sk_sp shader); 22 | 23 | private: 24 | static void RegisterFlattenables(); 25 | friend class SkFlattenable; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/d3d/GrD3DBackendContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrD3DBackendContext_DEFINED 9 | #define GrD3DBackendContext_DEFINED 10 | 11 | // GrD3DTypes.h includes d3d12.h, which in turn includes windows.h, which redefines many 12 | // common identifiers such as: 13 | // * interface 14 | // * small 15 | // * near 16 | // * far 17 | // * CreateSemaphore 18 | // * MemoryBarrier 19 | // 20 | // You should only include GrD3DBackendContext.h if you are prepared to rename those identifiers. 21 | #include "include/gpu/ganesh/d3d/GrD3DTypes.h" 22 | 23 | #include "include/gpu/ganesh/GrTypes.h" 24 | 25 | // The BackendContext contains all of the base D3D objects needed by the GrD3DGpu. The assumption 26 | // is that the client will set these up and pass them to the GrD3DGpu constructor. 27 | struct SK_API GrD3DBackendContext { 28 | gr_cp fAdapter; 29 | gr_cp fDevice; 30 | gr_cp fQueue; 31 | sk_sp fMemoryAllocator; 32 | GrProtected fProtectedContext = GrProtected::kNo; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/GrGLAssembleHelpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef GrGLAssembleHelpers_DEFINED 8 | #define GrGLAssembleHelpers_DEFINED 9 | 10 | #include "include/gpu/ganesh/gl/GrGLAssembleInterface.h" 11 | #include "include/gpu/ganesh/gl/GrGLFunctions.h" 12 | #include "include/gpu/ganesh/gl/GrGLTypes.h" 13 | 14 | void GrGetEGLQueryAndDisplay(GrEGLQueryStringFn** queryString, GrEGLDisplay* display, 15 | void* ctx, GrGLGetProc get); 16 | 17 | #endif // GrGLAssembleHelpers_DEFINED 18 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/GrGLDirectContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrGLDirectContext_DEFINED 9 | #define GrGLDirectContext_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | class GrDirectContext; 15 | struct GrContextOptions; 16 | struct GrGLInterface; 17 | 18 | namespace GrDirectContexts { 19 | /** 20 | * Creates a GrDirectContext for a backend context. GrGLInterface must be non-null. 21 | */ 22 | SK_API sk_sp MakeGL(sk_sp, const GrContextOptions&); 23 | SK_API sk_sp MakeGL(sk_sp); 24 | #if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE) 25 | SK_API sk_sp MakeGL(const GrContextOptions&); 26 | SK_API sk_sp MakeGL(); 27 | #endif 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/GrGLMakeWebGLInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef GrGLMakeWebGLInterface_DEFINED 8 | #define GrGLMakeWebGLInterface_DEFINED 9 | 10 | #include "include/core/SkRefCnt.h" 11 | #include "include/private/base/SkAPI.h" 12 | 13 | struct GrGLInterface; 14 | 15 | namespace GrGLInterfaces { 16 | SK_API sk_sp MakeWebGL(); 17 | } 18 | 19 | #endif // GrGLMakeWebGLInterface_DEFINED 20 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/egl/GrGLMakeEGLInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef GrGLMakeEGLInterface_DEFINED 8 | #define GrGLMakeEGLInterface_DEFINED 9 | 10 | #include "include/core/SkRefCnt.h" 11 | #include "include/gpu/ganesh/GrTypes.h" 12 | 13 | struct GrGLInterface; 14 | 15 | namespace GrGLInterfaces { 16 | SK_API sk_sp MakeEGL(); 17 | } 18 | 19 | #if !defined(SK_DISABLE_LEGACY_EGLINTERFACE_FACTORY) 20 | sk_sp GrGLMakeEGLInterface(); 21 | #endif 22 | 23 | #endif // GrGLMakeEGLInterface_DEFINED 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/epoxy/GrGLMakeEpoxyEGLInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrGLMakeEpoxyEGLInterface_DEFINED 9 | #define GrGLMakeEpoxyEGLInterface_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | struct GrGLInterface; 15 | 16 | namespace GrGLInterfaces { 17 | SK_API sk_sp MakeEpoxyEGL(); 18 | } 19 | 20 | #endif // GrGLMakeEpoxyEGLInterface_DEFINED 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef GrGLMakeGLXInterface_DEFINED 8 | #define GrGLMakeGLXInterface_DEFINED 9 | 10 | #include "include/core/SkRefCnt.h" 11 | #include "include/private/base/SkAPI.h" 12 | 13 | struct GrGLInterface; 14 | 15 | namespace GrGLInterfaces { 16 | SK_API sk_sp MakeGLX(); 17 | } 18 | 19 | #if !defined(SK_DISABLE_LEGACY_GLXINTERFACE_FACTORY) 20 | sk_sp GrGLMakeGLXInterface(); 21 | #endif 22 | 23 | #endif // GrGLMakeGLXInterface_DEFINED 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/ios/GrGLMakeIOSInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrGLMakeIOSInterface_DEFINED 9 | #define GrGLMakeIOSInterface_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | struct GrGLInterface; 15 | 16 | namespace GrGLInterfaces { 17 | SK_API sk_sp MakeIOS(); 18 | } 19 | 20 | #endif // GrGLMakeIOSInterface_DEFINED 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/mac/GrGLMakeMacInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrGLMakeMacInterface_DEFINED 9 | #define GrGLMakeMacInterface_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | struct GrGLInterface; 15 | 16 | namespace GrGLInterfaces { 17 | SK_API sk_sp MakeMac(); 18 | } 19 | 20 | #endif // GrGLMakeMacInterface_DEFINED 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/gl/win/GrGLMakeWinInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrGLMakeWinInterface_DEFINED 9 | #define GrGLMakeWinInterface_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | struct GrGLInterface; 15 | 16 | namespace GrGLInterfaces { 17 | SK_API sk_sp MakeWin(); 18 | } 19 | 20 | #endif // GrGLMakeWinInterface_DEFINED 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrMtlBackendContext_DEFINED 9 | #define GrMtlBackendContext_DEFINED 10 | 11 | #include "include/gpu/ganesh/mtl/GrMtlTypes.h" 12 | #include "include/ports/SkCFObject.h" 13 | 14 | // The BackendContext contains all of the base Metal objects needed by the GrMtlGpu. The assumption 15 | // is that the client will set these up and pass them to the GrMtlGpu constructor. 16 | struct SK_API GrMtlBackendContext { 17 | sk_cfp fDevice; 18 | sk_cfp fQueue; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/mtl/GrMtlBackendSemaphore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | * 7 | */ 8 | #ifndef GrMtlBackendSemaphore_DEFINED 9 | #define GrMtlBackendSemaphore_DEFINED 10 | 11 | #include "include/gpu/ganesh/GrBackendSemaphore.h" 12 | #include "include/gpu/ganesh/mtl/GrMtlTypes.h" 13 | #include "include/private/base/SkAPI.h" 14 | 15 | namespace GrBackendSemaphores { 16 | // It is the creator's responsibility to ref the MTLEvent passed in here, via __bridge_retained. 17 | // The other end will wrap this BackendSemaphore and take the ref, via __bridge_transfer. 18 | SK_API GrBackendSemaphore MakeMtl(GrMTLHandle event, uint64_t value); 19 | SK_API GrMTLHandle GetMtlHandle(const GrBackendSemaphore&); 20 | SK_API uint64_t GetMtlValue(const GrBackendSemaphore&); 21 | } // namespace GrBackendSemaphores 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrMtlDirectContext_DEFINED 9 | #define GrMtlDirectContext_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | class GrDirectContext; 15 | struct GrContextOptions; 16 | struct GrMtlBackendContext; 17 | 18 | namespace GrDirectContexts { 19 | /** 20 | * Makes a GrDirectContext which uses Metal as the backend. The GrMtlBackendContext contains a 21 | * MTLDevice and MTLCommandQueue which should be used by the backend. These objects must 22 | * have their own ref which will be released when the GrMtlBackendContext is destroyed. 23 | * Ganesh will take its own ref on the objects which will be released when the GrDirectContext 24 | * is destroyed. 25 | */ 26 | SK_API sk_sp MakeMetal(const GrMtlBackendContext&, const GrContextOptions&); 27 | SK_API sk_sp MakeMetal(const GrMtlBackendContext&); 28 | } // namespace GrDirectContexts 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | * 7 | */ 8 | #ifndef GrVkBackendSemaphore_DEFINED 9 | #define GrVkBackendSemaphore_DEFINED 10 | 11 | #include "include/gpu/ganesh/GrBackendSemaphore.h" 12 | #include "include/private/base/SkAPI.h" 13 | #include "include/private/gpu/vk/SkiaVulkan.h" 14 | 15 | namespace GrBackendSemaphores { 16 | SK_API GrBackendSemaphore MakeVk(VkSemaphore semaphore); 17 | SK_API VkSemaphore GetVkSemaphore(const GrBackendSemaphore&); 18 | } // namespace GrBackendSemaphores 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/ganesh/vk/GrVkDirectContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef GrVkDirectContext_DEFINED 9 | #define GrVkDirectContext_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | class GrDirectContext; 15 | struct GrContextOptions; 16 | namespace skgpu { 17 | struct VulkanBackendContext; 18 | } 19 | 20 | namespace GrDirectContexts { 21 | /** 22 | * The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned 23 | * GrDirectContext is destroyed. This also means that any objects created with this 24 | * GrDirectContext (e.g. SkSurfaces, SkImages, etc.) must also be released as they may hold 25 | * refs on the GrDirectContext. Once all these objects and the GrDirectContext are released, 26 | * then it is safe to delete the vulkan objects. 27 | */ 28 | SK_API sk_sp MakeVulkan(const skgpu::VulkanBackendContext&, 29 | const GrContextOptions&); 30 | SK_API sk_sp MakeVulkan(const skgpu::VulkanBackendContext&); 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/graphite/dawn/DawnUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef skgpu_graphite_DawnUtils_DEFINED 9 | #define skgpu_graphite_DawnUtils_DEFINED 10 | 11 | #include 12 | 13 | #include "include/private/base/SkAPI.h" 14 | 15 | namespace skgpu::graphite { 16 | 17 | class Context; 18 | struct ContextOptions; 19 | struct DawnBackendContext; 20 | 21 | namespace ContextFactory { 22 | SK_API std::unique_ptr MakeDawn(const DawnBackendContext&, const ContextOptions&); 23 | } // namespace ContextFactory 24 | 25 | } // namespace skgpu::graphite 26 | 27 | 28 | #endif // skgpu_graphite_DawnUtils_DEFINED 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/graphite/mtl/MtlBackendContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef skgpu_graphite_MtlBackendContext_DEFINED 9 | #define skgpu_graphite_MtlBackendContext_DEFINED 10 | 11 | #include "include/ports/SkCFObject.h" 12 | #include "include/private/base/SkAPI.h" 13 | 14 | #import 15 | 16 | namespace skgpu::graphite { 17 | 18 | // The MtlBackendContext contains all of the base Metal objects needed by the graphite Metal 19 | // backend. The client will create this object and pass it into the Context::MakeMetal factory call 20 | // when setting up Skia. 21 | struct SK_API MtlBackendContext { 22 | sk_cfp fDevice; 23 | sk_cfp fQueue; 24 | }; 25 | 26 | } // namespace skgpu::graphite 27 | 28 | #endif // skgpu_graphite_MtlBackendContext_DEFINED 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef skgpu_graphite_MtlGraphiteUtils_DEFINED 9 | #define skgpu_graphite_MtlGraphiteUtils_DEFINED 10 | 11 | #include 12 | 13 | #include "include/private/base/SkAPI.h" 14 | 15 | namespace skgpu::graphite { 16 | 17 | class Context; 18 | struct ContextOptions; 19 | struct MtlBackendContext; 20 | 21 | namespace ContextFactory { 22 | SK_API std::unique_ptr MakeMetal(const MtlBackendContext&, const ContextOptions&); 23 | } // namespace ContextFactory 24 | 25 | } // namespace skgpu::graphite 26 | 27 | #endif // skgpu_graphite_MtlGraphiteUtils_DEFINED 28 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef skgpu_graphite_VulkanGraphiteUtils_DEFINED 9 | #define skgpu_graphite_VulkanGraphiteUtils_DEFINED 10 | 11 | #include 12 | 13 | #include "include/private/base/SkAPI.h" 14 | 15 | namespace skgpu { struct VulkanBackendContext; } 16 | 17 | namespace skgpu::graphite { 18 | 19 | class Context; 20 | struct ContextOptions; 21 | 22 | namespace ContextFactory { 23 | SK_API std::unique_ptr MakeVulkan(const VulkanBackendContext&, const ContextOptions&); 24 | } // namespace ContextFactory 25 | 26 | } // namespace skgpu::graphite 27 | 28 | #endif // skgpu_graphite_VulkanGraphiteUtils_DEFINED 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/mtl/MtlMemoryAllocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef skgpu_MtlMemoryAllocator_DEFINED 9 | #define skgpu_MtlMemoryAllocator_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | 13 | #ifdef __APPLE__ 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #endif 18 | 19 | namespace skgpu { 20 | 21 | // interface classes for the GPU memory allocator 22 | class MtlAlloc : public SkRefCnt { 23 | public: 24 | ~MtlAlloc() override = default; 25 | }; 26 | 27 | #ifdef __OBJC__ 28 | class MtlMemoryAllocator : public SkRefCnt { 29 | public: 30 | virtual id newBufferWithLength(NSUInteger length, MTLResourceOptions options, 31 | sk_sp* allocation) = 0; 32 | virtual id newTextureWithDescriptor(MTLTextureDescriptor* texDesc, 33 | sk_sp* allocation) = 0; 34 | }; 35 | #endif 36 | 37 | } // namespace skgpu 38 | 39 | #endif // __APPLE__ 40 | 41 | #endif // skgpu_MtlMemoryAllocator_DEFINED 42 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/gpu/vk/VulkanMutableTextureState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef skgpu_VulkanMutableTextureState_DEFINED 9 | #define skgpu_VulkanMutableTextureState_DEFINED 10 | 11 | #include "include/gpu/MutableTextureState.h" 12 | #include "include/private/base/SkAPI.h" 13 | #include "include/private/gpu/vk/SkiaVulkan.h" 14 | 15 | #include 16 | 17 | namespace skgpu::MutableTextureStates { 18 | SK_API MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex); 19 | 20 | SK_API VkImageLayout GetVkImageLayout(const MutableTextureState& state); 21 | SK_API VkImageLayout GetVkImageLayout(const MutableTextureState* state); 22 | SK_API uint32_t GetVkQueueFamilyIndex(const MutableTextureState& state); 23 | SK_API uint32_t GetVkQueueFamilyIndex(const MutableTextureState* state); 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_FontConfigInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_FontConfigInterface_DEFINED 9 | #define SkFontMgr_FontConfigInterface_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkTypes.h" 13 | 14 | class SkFontMgr; 15 | class SkFontConfigInterface; 16 | 17 | /** Creates a SkFontMgr which wraps a SkFontConfigInterface. */ 18 | SK_API sk_sp SkFontMgr_New_FCI(sk_sp fci); 19 | 20 | #endif // #ifndef SkFontMgr_FontConfigInterface_DEFINED 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_Fontations.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_fontations_DEFINED 9 | #define SkFontMgr_fontations_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | 13 | class SkFontMgr; 14 | 15 | /** Create a font manager instantiating fonts using the Rust Fontations backend. 16 | * This font manager does not support matching fonts, only instantiation. 17 | */ 18 | SK_API sk_sp SkFontMgr_New_Fontations_Empty(); 19 | 20 | #endif // #ifndef SkFontMgr_fontations_DEFINED 21 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_android_ndk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_android_ndk_DEFINED 9 | #define SkFontMgr_android_ndk_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkTypes.h" 13 | 14 | #include 15 | 16 | class SkFontMgr; 17 | class SkFontScanner; 18 | 19 | /** Create a font manager for Android NDK. May return nullptr if unavailable (API < 29). */ 20 | SK_API sk_sp SkFontMgr_New_AndroidNDK(bool cacheFontFiles); 21 | 22 | SK_API sk_sp SkFontMgr_New_AndroidNDK(bool cacheFontFiles, 23 | std::unique_ptr scanner); 24 | 25 | #endif // SkFontMgr_android_ndk_DEFINED 26 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkFontMgr_data_DEFINED 8 | #define SkFontMgr_data_DEFINED 9 | 10 | #include "include/core/SkData.h" 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkSpan.h" 13 | #include "include/core/SkTypes.h" 14 | 15 | class SkFontMgr; 16 | 17 | /** Create a custom font manager which wraps a collection of SkData-stored fonts. 18 | * This font manager uses FreeType for rendering. 19 | */ 20 | SK_API sk_sp SkFontMgr_New_Custom_Data(SkSpan>); 21 | 22 | #endif // SkFontMgr_data_DEFINED 23 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_directory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_directory_DEFINED 9 | #define SkFontMgr_directory_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkTypes.h" 13 | 14 | class SkFontMgr; 15 | 16 | /** Create a custom font manager which scans a given directory for font files. 17 | * This font manager uses FreeType for rendering. 18 | */ 19 | SK_API sk_sp SkFontMgr_New_Custom_Directory(const char* dir); 20 | 21 | #endif // SkFontMgr_directory_DEFINED 22 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_empty.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_empty_DEFINED 9 | #define SkFontMgr_empty_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkTypes.h" 13 | 14 | class SkFontMgr; 15 | 16 | /** Create a custom font manager that contains no built-in fonts. 17 | * This font manager uses FreeType for rendering. 18 | */ 19 | SK_API sk_sp SkFontMgr_New_Custom_Empty(); 20 | 21 | #endif // SkFontMgr_empty_DEFINED 22 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_fontconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_fontconfig_DEFINED 9 | #define SkFontMgr_fontconfig_DEFINED 10 | 11 | #include 12 | #include "include/core/SkRefCnt.h" 13 | #include 14 | 15 | class SkFontMgr; 16 | 17 | /** Create a font manager around a FontConfig instance. 18 | * If 'fc' is NULL, will use a new default config. 19 | * Takes ownership of 'fc' and will call FcConfigDestroy on it. 20 | */ 21 | class SkFontScanner; 22 | SK_API sk_sp SkFontMgr_New_FontConfig(FcConfig* fc, std::unique_ptr scanner); 23 | SK_API sk_sp SkFontMgr_New_FontConfig(FcConfig* fc); 24 | #endif // #ifndef SkFontMgr_fontconfig_DEFINED 25 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_fuchsia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_fuchsia_DEFINED 9 | #define SkFontMgr_fuchsia_DEFINED 10 | 11 | #include 12 | 13 | #include "include/core/SkRefCnt.h" 14 | 15 | class SkFontMgr; 16 | 17 | SK_API sk_sp SkFontMgr_New_Fuchsia(fuchsia::fonts::ProviderSyncPtr provider); 18 | 19 | #endif // SkFontMgr_fuchsia_DEFINED 20 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontMgr_mac_ct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFontMgr_mac_ct_DEFINED 9 | #define SkFontMgr_mac_ct_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/core/SkTypes.h" 13 | 14 | #ifdef SK_BUILD_FOR_MAC 15 | #import 16 | #endif 17 | 18 | #ifdef SK_BUILD_FOR_IOS 19 | #include 20 | #endif 21 | 22 | class SkFontMgr; 23 | 24 | /** Create a font manager for CoreText. If the collection is nullptr the system default will be used. */ 25 | SK_API extern sk_sp SkFontMgr_New_CoreText(CTFontCollectionRef); 26 | 27 | #endif // SkFontMgr_mac_ct_DEFINED 28 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontScanner_Fontations.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SKFONTSCANNER_FONTATIONS_H_ 9 | #define SKFONTSCANNER_FONTATIONS_H_ 10 | 11 | #include "include/core/SkFontScanner.h" 12 | 13 | SK_API std::unique_ptr SkFontScanner_Make_Fontations(); 14 | 15 | #endif // SKFONTSCANNER_FONTATIONS_H_ 16 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkFontScanner_FreeType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SKFONTSCANNER_FREETYPE_H_ 9 | #define SKFONTSCANNER_FREETYPE_H_ 10 | 11 | #include "include/core/SkFontScanner.h" 12 | 13 | SK_API std::unique_ptr SkFontScanner_Make_FreeType(); 14 | 15 | #endif // SKFONTSCANNER_FREETYPE_H_ 16 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkImageGeneratorCG.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkImageGeneratorCG_DEFINED 8 | #define SkImageGeneratorCG_DEFINED 9 | 10 | // This is needed as clients may override the target platform 11 | // using SkUserConfig 12 | #include "include/private/base/SkLoadUserConfig.h" 13 | 14 | #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 15 | 16 | #include "include/core/SkData.h" 17 | #include "include/core/SkImageGenerator.h" 18 | #include "include/core/SkRefCnt.h" 19 | #include "include/private/base/SkAPI.h" 20 | 21 | #include 22 | 23 | namespace SkImageGeneratorCG { 24 | SK_API std::unique_ptr MakeFromEncodedCG(sk_sp); 25 | } // namespace SkImageGeneratorCG 26 | 27 | #endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 28 | #endif // SkImageGeneratorCG_DEFINED 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/ports/SkTypeface_fontations.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkTypeface_fontations_DEFINED 9 | #define SkTypeface_fontations_DEFINED 10 | 11 | #include "include/core/SkFontArguments.h" 12 | #include "include/core/SkRefCnt.h" 13 | #include "include/core/SkTypeface.h" 14 | #include "include/core/SkTypes.h" 15 | 16 | #include 17 | 18 | SK_API sk_sp SkTypeface_Make_Fontations(std::unique_ptr fontData, 19 | const SkFontArguments& args); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/private/base/README.md: -------------------------------------------------------------------------------- 1 | Files in "base" are used by many parts of Skia, but are not part of the public Skia API. 2 | See also src/base for other files that are part of base, but not needed by the public API. 3 | 4 | Files here should not depend on anything other than system headers or other files in base. -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/private/base/SkCPUTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkCPUTypes_DEFINED 8 | #define SkCPUTypes_DEFINED 9 | 10 | // TODO(bungeman,kjlubick) There are a lot of assumptions throughout the codebase that 11 | // these types are 32 bits, when they could be more or less. Public APIs should stop 12 | // using these. Internally, we could use uint_fast8_t and uint_fast16_t, but not in 13 | // public APIs due to ABI incompatibilities. 14 | 15 | /** Fast type for unsigned 8 bits. Use for parameter passing and local 16 | variables, not for storage 17 | */ 18 | typedef unsigned U8CPU; 19 | 20 | /** Fast type for unsigned 16 bits. Use for parameter passing and local 21 | variables, not for storage 22 | */ 23 | typedef unsigned U16CPU; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/private/base/SkDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkDebug_DEFINED 9 | #define SkDebug_DEFINED 10 | 11 | #include "include/private/base/SkAPI.h" 12 | #include "include/private/base/SkAttributes.h" 13 | #include "include/private/base/SkLoadUserConfig.h" // IWYU pragma: keep 14 | 15 | #if !defined(SkDebugf) 16 | void SK_SPI SkDebugf(const char format[], ...) SK_PRINTF_LIKE(1, 2); 17 | #endif 18 | 19 | #if defined(SK_DEBUG) 20 | #define SkDEBUGCODE(...) __VA_ARGS__ 21 | #define SkDEBUGF(...) SkDebugf(__VA_ARGS__) 22 | #else 23 | #define SkDEBUGCODE(...) 24 | #define SkDEBUGF(...) 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/private/base/SkNoncopyable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkNoncopyable_DEFINED 9 | #define SkNoncopyable_DEFINED 10 | 11 | #include "include/private/base/SkAPI.h" 12 | 13 | /** \class SkNoncopyable (DEPRECATED) 14 | 15 | SkNoncopyable is the base class for objects that do not want to 16 | be copied. It hides its copy-constructor and its assignment-operator. 17 | */ 18 | class SK_API SkNoncopyable { 19 | public: 20 | SkNoncopyable() = default; 21 | 22 | SkNoncopyable(SkNoncopyable&&) = default; 23 | SkNoncopyable& operator =(SkNoncopyable&&) = default; 24 | 25 | private: 26 | SkNoncopyable(const SkNoncopyable&) = delete; 27 | SkNoncopyable& operator=(const SkNoncopyable&) = delete; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/private/base/SkTPin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkTPin_DEFINED 9 | #define SkTPin_DEFINED 10 | 11 | #include 12 | 13 | /** @return x pinned (clamped) between lo and hi, inclusively. 14 | 15 | Unlike std::clamp(), SkTPin() always returns a value between lo and hi. 16 | If x is NaN, SkTPin() returns lo but std::clamp() returns NaN. 17 | */ 18 | template 19 | static constexpr const T& SkTPin(const T& x, const T& lo, const T& hi) { 20 | return std::max(lo, std::min(x, hi)); 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/private/base/SkThreadID.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkThreadID_DEFINED 9 | #define SkThreadID_DEFINED 10 | 11 | #include "include/private/base/SkAPI.h" 12 | #include "include/private/base/SkDebug.h" 13 | 14 | #include 15 | 16 | typedef int64_t SkThreadID; 17 | 18 | // SkMutex.h uses SkGetThreadID in debug only code. 19 | SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID(); 20 | 21 | const SkThreadID kIllegalThreadID = 0; 22 | 23 | #endif // SkThreadID_DEFINED 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/private/gpu/vk/SkiaVulkan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkiaVulkan_DEFINED 9 | #define SkiaVulkan_DEFINED 10 | 11 | #include "include/core/SkTypes.h" 12 | 13 | // IWYU pragma: begin_exports 14 | 15 | #if defined(SK_USE_INTERNAL_VULKAN_HEADERS) && !defined(SK_BUILD_FOR_GOOGLE3) 16 | #include "include/third_party/vulkan/vulkan/vulkan_core.h" 17 | #else 18 | // For google3 builds we don't set SKIA_IMPLEMENTATION so we need to make sure that the vulkan 19 | // headers stay up to date for our needs 20 | #include 21 | #endif 22 | 23 | #ifdef SK_BUILD_FOR_ANDROID 24 | // This is needed to get android extensions for external memory 25 | #if defined(SK_USE_INTERNAL_VULKAN_HEADERS) && !defined(SK_BUILD_FOR_GOOGLE3) 26 | #include "include/third_party/vulkan/vulkan/vulkan_android.h" 27 | #else 28 | // For google3 builds we don't set SKIA_IMPLEMENTATION so we need to make sure that the vulkan 29 | // headers stay up to date for our needs 30 | #include 31 | #endif 32 | #endif 33 | 34 | // IWYU pragma: end_exports 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/sksl/SkSLDebugTrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SKSL_DEBUG_TRACE 9 | #define SKSL_DEBUG_TRACE 10 | 11 | #include "include/core/SkRefCnt.h" 12 | 13 | class SkWStream; 14 | 15 | namespace SkSL { 16 | 17 | class DebugTrace : public SkRefCnt { 18 | public: 19 | /** Serializes a debug trace to JSON which can be parsed by our debugger. */ 20 | virtual void writeTrace(SkWStream* w) const = 0; 21 | 22 | /** Generates a human-readable dump of the debug trace. */ 23 | virtual void dump(SkWStream* o) const = 0; 24 | }; 25 | 26 | } // namespace SkSL 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/sksl/SkSLVersion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSLVersion_DEFINED 9 | #define SkSLVersion_DEFINED 10 | 11 | namespace SkSL { 12 | 13 | enum class Version { 14 | /** 15 | * Desktop GLSL 1.10, GLSL ES 1.00, WebGL 1.0 16 | */ 17 | k100, 18 | 19 | /** 20 | * Desktop GLSL 3.30, GLSL ES 3.00, WebGL 2.0 21 | */ 22 | k300, 23 | }; 24 | 25 | } // namespace SkSL 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODECS_COMMON_H_ 2 | #define VULKAN_VIDEO_CODECS_COMMON_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2023 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codecs_common is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codecs_common 1 24 | #if !defined(VK_NO_STDINT_H) 25 | #include 26 | #endif 27 | 28 | #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ 29 | ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/utils/SkNullCanvas.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkNullCanvas_DEFINED 9 | #define SkNullCanvas_DEFINED 10 | 11 | #include "include/core/SkTypes.h" 12 | 13 | #include 14 | 15 | class SkCanvas; 16 | 17 | /** 18 | * Creates a canvas that draws nothing. This is useful for performance testing. 19 | */ 20 | SK_API std::unique_ptr SkMakeNullCanvas(); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/utils/SkParsePath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkParsePath_DEFINED 11 | #define SkParsePath_DEFINED 12 | 13 | #include "include/core/SkPath.h" 14 | 15 | class SkString; 16 | 17 | class SK_API SkParsePath { 18 | public: 19 | static bool FromSVGString(const char str[], SkPath*); 20 | 21 | enum class PathEncoding { Absolute, Relative }; 22 | static SkString ToSVGString(const SkPath&, PathEncoding = PathEncoding::Absolute); 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/include/utils/SkTraceEventPhase.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | #ifndef SkTraceEventPhase_DEFINED 5 | #define SkTraceEventPhase_DEFINED 6 | 7 | // Phase indicates the nature of an event entry. E.g. part of a begin/end pair. 8 | #define TRACE_EVENT_PHASE_BEGIN ('B') 9 | #define TRACE_EVENT_PHASE_END ('E') 10 | #define TRACE_EVENT_PHASE_COMPLETE ('X') 11 | #define TRACE_EVENT_PHASE_INSTANT ('I') 12 | #define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S') 13 | #define TRACE_EVENT_PHASE_ASYNC_END ('F') 14 | #define TRACE_EVENT_PHASE_COUNTER ('C') 15 | #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') 16 | #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') 17 | #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') 18 | 19 | #endif // SkTraceEventPhase_DEFINED 20 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/skcms/skcms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "src/skcms_public.h" // NO_G3_REWRITE 11 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/skottie/include/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_filegroup") 2 | 3 | licenses(["notice"]) 4 | 5 | exports_files_legacy() 6 | 7 | skia_filegroup( 8 | name = "hdrs", 9 | srcs = [ 10 | "ExternalLayer.h", 11 | "Skottie.h", 12 | "SkottieProperty.h", 13 | "SlotManager.h", 14 | "TextShaper.h", 15 | ], 16 | visibility = ["//modules/skottie:__pkg__"], 17 | ) 18 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/skottie/src/text/SkottieShaper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | // Temporary forward to allow client migration. 9 | #include "modules/skottie/include/TextShaper.h" 10 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/skparagraph/include/TextShadow.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Google LLC. 2 | #ifndef TextShadow_DEFINED 3 | #define TextShadow_DEFINED 4 | 5 | #include "include/core/SkColor.h" 6 | #include "include/core/SkPoint.h" 7 | 8 | namespace skia { 9 | namespace textlayout { 10 | 11 | class TextShadow { 12 | public: 13 | SkColor fColor = SK_ColorBLACK; 14 | SkPoint fOffset; 15 | double fBlurSigma = 0.0; 16 | 17 | TextShadow(); 18 | 19 | TextShadow(SkColor color, SkPoint offset, double blurSigma); 20 | 21 | bool operator==(const TextShadow& other) const; 22 | 23 | bool operator!=(const TextShadow& other) const; 24 | 25 | bool hasShadow() const; 26 | }; 27 | } // namespace textlayout 28 | } // namespace skia 29 | 30 | #endif // TextShadow_DEFINED 31 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/skshaper/include/SkShaper_coretext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkShaper_coretext_DEFINED 9 | #define SkShaper_coretext_DEFINED 10 | 11 | #include "modules/skshaper/include/SkShaper.h" 12 | 13 | #include 14 | 15 | namespace SkShapers::CT { 16 | SKSHAPER_API std::unique_ptr CoreText(); 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/skshaper/include/SkShaper_skunicode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkShaper_skunicode_DEFINED 9 | #define SkShaper_skunicode_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "modules/skshaper/include/SkShaper.h" 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | class SkUnicode; 19 | 20 | namespace SkShapers::unicode { 21 | SKSHAPER_API std::unique_ptr BidiRunIterator(sk_sp unicode, 22 | const char* utf8, 23 | size_t utf8Bytes, 24 | uint8_t bidiLevel); 25 | 26 | } // namespace SkShapers::unicode 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/svg/include/SkSVGDefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSVGDefs_DEFINED 9 | #define SkSVGDefs_DEFINED 10 | 11 | #include "modules/svg/include/SkSVGHiddenContainer.h" 12 | 13 | class SK_API SkSVGDefs : public SkSVGHiddenContainer { 14 | public: 15 | static sk_sp Make() { return sk_sp(new SkSVGDefs()); } 16 | 17 | private: 18 | SkSVGDefs() : INHERITED(SkSVGTag::kDefs) {} 19 | 20 | using INHERITED = SkSVGHiddenContainer; 21 | }; 22 | 23 | #endif // SkSVGDefs_DEFINED 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/svg/include/SkSVGG.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSVGG_DEFINED 9 | #define SkSVGG_DEFINED 10 | 11 | #include "modules/svg/include/SkSVGContainer.h" 12 | 13 | class SK_API SkSVGG : public SkSVGContainer { 14 | public: 15 | static sk_sp Make() { return sk_sp(new SkSVGG()); } 16 | 17 | private: 18 | SkSVGG() : INHERITED(SkSVGTag::kG) { } 19 | 20 | using INHERITED = SkSVGContainer; 21 | }; 22 | 23 | #endif // SkSVGG_DEFINED 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/svg/include/SkSVGHiddenContainer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSVGHiddenContainer_DEFINED 9 | #define SkSVGHiddenContainer_DEFINED 10 | 11 | #include "modules/svg/include/SkSVGContainer.h" 12 | 13 | class SK_API SkSVGHiddenContainer : public SkSVGContainer { 14 | protected: 15 | explicit SkSVGHiddenContainer(SkSVGTag t) : INHERITED(t) {} 16 | 17 | void onRender(const SkSVGRenderContext&) const final {} 18 | 19 | private: 20 | using INHERITED = SkSVGContainer; 21 | }; 22 | 23 | #endif // SkSVGHiddenContainer_DEFINED 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/svg/include/SkSVGIDMapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSVGIDMapper_DEFINED 9 | #define SkSVGIDMapper_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "src/core/SkTHash.h" 13 | 14 | class SkString; 15 | class SkSVGNode; 16 | 17 | using SkSVGIDMapper = skia_private::THashMap>; 18 | 19 | #endif // SkSVGIDMapper_DEFINED 20 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSVGOpenTypeSVGDecoder_DEFINED 9 | #define SkSVGOpenTypeSVGDecoder_DEFINED 10 | 11 | #include "include/core/SkColor.h" 12 | #include "include/core/SkOpenTypeSVGDecoder.h" 13 | #include "include/core/SkRefCnt.h" 14 | #include "include/core/SkSpan.h" 15 | #include "include/core/SkTypes.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | class SkCanvas; 22 | class SkSVGDOM; 23 | 24 | class SkSVGOpenTypeSVGDecoder : public SkOpenTypeSVGDecoder { 25 | public: 26 | static std::unique_ptr Make(const uint8_t* svg, size_t svgLength); 27 | size_t approximateSize() override; 28 | bool render(SkCanvas&, int upem, SkGlyphID glyphId, 29 | SkColor foregroundColor, SkSpan palette) override; 30 | ~SkSVGOpenTypeSVGDecoder() override; 31 | private: 32 | SkSVGOpenTypeSVGDecoder(sk_sp skSvg, size_t approximateSize); 33 | sk_sp fSkSvg; 34 | size_t fApproximateSize; 35 | }; 36 | 37 | #endif // SkSVGOpenTypeSVGDecoder_DEFINED 38 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/svg/include/SkSVGShape.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSVGShape_DEFINED 9 | #define SkSVGShape_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | #include "modules/svg/include/SkSVGTransformableNode.h" 14 | 15 | class SkCanvas; 16 | class SkPaint; 17 | class SkSVGLengthContext; 18 | class SkSVGNode; 19 | class SkSVGRenderContext; 20 | enum class SkPathFillType; 21 | enum class SkSVGTag; 22 | 23 | class SK_API SkSVGShape : public SkSVGTransformableNode { 24 | public: 25 | void appendChild(sk_sp) override; 26 | 27 | protected: 28 | SkSVGShape(SkSVGTag); 29 | 30 | void onRender(const SkSVGRenderContext&) const final; 31 | 32 | virtual void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, 33 | SkPathFillType) const = 0; 34 | 35 | private: 36 | using INHERITED = SkSVGTransformableNode; 37 | }; 38 | 39 | #endif // SkSVGShape_DEFINED 40 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/skia/modules/svg/include/SkSVGStop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkSVGStop_DEFINED 9 | #define SkSVGStop_DEFINED 10 | 11 | #include "include/core/SkRefCnt.h" 12 | #include "include/private/base/SkAPI.h" 13 | #include "modules/svg/include/SkSVGHiddenContainer.h" 14 | #include "modules/svg/include/SkSVGNode.h" 15 | #include "modules/svg/include/SkSVGTypes.h" 16 | 17 | class SK_API SkSVGStop : public SkSVGHiddenContainer { 18 | public: 19 | static constexpr SkSVGTag tag = SkSVGTag::kStop; 20 | 21 | static sk_sp Make() { 22 | return sk_sp(new SkSVGStop()); 23 | } 24 | 25 | SVG_ATTR(Offset, SkSVGLength, SkSVGLength(0, SkSVGLength::Unit::kPercentage)) 26 | 27 | protected: 28 | bool parseAndSetAttribute(const char*, const char*) override; 29 | 30 | private: 31 | SkSVGStop(); 32 | 33 | using INHERITED = SkSVGHiddenContainer; 34 | }; 35 | 36 | #endif // SkSVGStop_DEFINED 37 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/DEPS: -------------------------------------------------------------------------------- 1 | include_rules = [ 2 | # v8-inspector-protocol.h depends on generated files under include/inspector. 3 | "+inspector", 4 | ] 5 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/OWNERS: -------------------------------------------------------------------------------- 1 | adamk@chromium.org 2 | danno@chromium.org 3 | ulan@chromium.org 4 | verwaest@chromium.org 5 | yangguo@chromium.org 6 | 7 | per-file *DEPS=file:../COMMON_OWNERS 8 | per-file v8-internal.h=file:../COMMON_OWNERS 9 | per-file v8-inspector.h=dgozman@chromium.org 10 | per-file v8-inspector.h=pfeldman@chromium.org 11 | per-file v8-inspector.h=kozyatinskiy@chromium.org 12 | per-file v8-inspector-protocol.h=dgozman@chromium.org 13 | per-file v8-inspector-protocol.h=pfeldman@chromium.org 14 | per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org 15 | per-file js_protocol.pdl=dgozman@chromium.org 16 | per-file js_protocol.pdl=pfeldman@chromium.org 17 | 18 | # COMPONENT: Blink>JavaScript>API 19 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/codecache-units.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2017 Alibaba Group Holding Limited. All Rights Reserved. 3 | */ 4 | #ifndef YUNOS_INCLUDE_CODECACHE_UNITS_H 5 | #define YUNOS_INCLUDE_CODECACHE_UNITS_H 6 | 7 | namespace yunos { 8 | 9 | class CodeCacheUnits { 10 | public: 11 | static bool IsGenerateCodeCacheNeeded(const char* appRootPath); 12 | static bool GenerateCodeCache(const char* appRootPath); 13 | }; 14 | } 15 | #endif // YUNOS_INCLUDE_CODECACHE_UNITS_H 16 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/libplatform/DEPS: -------------------------------------------------------------------------------- 1 | include_rules = [ 2 | "+libplatform/libplatform-export.h", 3 | ] 4 | 5 | specific_include_rules = { 6 | "libplatform\.h": [ 7 | "+libplatform/v8-tracing.h", 8 | ], 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/libplatform/libplatform-export.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ 6 | #define V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ 7 | 8 | #if defined(_WIN32) 9 | 10 | #ifdef BUILDING_V8_PLATFORM_SHARED 11 | #define V8_PLATFORM_EXPORT __declspec(dllexport) 12 | #elif USING_V8_PLATFORM_SHARED 13 | #define V8_PLATFORM_EXPORT __declspec(dllimport) 14 | #else 15 | #define V8_PLATFORM_EXPORT 16 | #endif // BUILDING_V8_PLATFORM_SHARED 17 | 18 | #else // defined(_WIN32) 19 | 20 | // Setup for Linux shared library export. 21 | #ifdef BUILDING_V8_PLATFORM_SHARED 22 | #define V8_PLATFORM_EXPORT __attribute__((visibility("default"))) 23 | #else 24 | #define V8_PLATFORM_EXPORT 25 | #endif 26 | 27 | #endif // defined(_WIN32) 28 | 29 | #endif // V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ 30 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/v8-inspector-protocol.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_V8_INSPECTOR_PROTOCOL_H_ 6 | #define V8_V8_INSPECTOR_PROTOCOL_H_ 7 | 8 | #include "inspector/Debugger.h" // NOLINT(build/include) 9 | #include "inspector/Runtime.h" // NOLINT(build/include) 10 | #include "inspector/Schema.h" // NOLINT(build/include) 11 | #include "v8-inspector.h" // NOLINT(build/include) 12 | 13 | #endif // V8_V8_INSPECTOR_PROTOCOL_H_ 14 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/v8-value-serializer-version.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /** 6 | * Compile-time constants. 7 | * 8 | * This header provides access to information about the value serializer at 9 | * compile time, without declaring or defining any symbols that require linking 10 | * to V8. 11 | */ 12 | 13 | #ifndef INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_ 14 | #define INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_ 15 | 16 | #include 17 | 18 | namespace v8 { 19 | 20 | constexpr uint32_t CurrentValueSerializerFormatVersion() { return 13; } 21 | 22 | } // namespace v8 23 | 24 | #endif // INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_ 25 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/v8-vex.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_V8_VEX_H_ 2 | #define INCLUDE_V8_VEX_H_ 3 | 4 | #include "v8.h" 5 | 6 | namespace v8 { 7 | 8 | class V8_EXPORT Vex { 9 | public: 10 | static std::vector CreateVexCode( 11 | Isolate* isolate, Local unbound_script); 12 | 13 | static std::vector CreateVexCode( 14 | Isolate* isolate, Local func); 15 | }; 16 | 17 | class V8_EXPORT VexPackage { 18 | public: 19 | MaybeLocal GetScript(Isolate* isolate, 20 | const char* resource_name) const; 21 | 22 | bool Has(const char* resource_name) const; 23 | 24 | static const VexPackage* Load(const uint8_t* data, 25 | size_t size); 26 | }; 27 | 28 | } 29 | 30 | #endif // INCLUDE_V8_VEX_H_ 31 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/v8/include/v8-wasm-trap-handler-win.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_WASM_TRAP_HANDLER_WIN_H_ 6 | #define V8_WASM_TRAP_HANDLER_WIN_H_ 7 | 8 | #include 9 | 10 | #include "v8config.h" // NOLINT(build/include) 11 | 12 | namespace v8 { 13 | /** 14 | * This function determines whether a memory access violation has been an 15 | * out-of-bounds memory access in WebAssembly. If so, it will modify the 16 | * exception parameter and add a return address where the execution can continue 17 | * after the exception handling, and return true. Otherwise the return value 18 | * will be false. 19 | * 20 | * The parameter to this function corresponds to the one passed to a Windows 21 | * vectored exception handler. Use this function only on Windows. 22 | * 23 | * \param exception An EXCEPTION_POINTERS* as provided to the exception handler. 24 | */ 25 | V8_EXPORT bool TryHandleWebAssemblyTrapWindows(EXCEPTION_POINTERS* exception); 26 | 27 | } // namespace v8 28 | #endif // V8_WASM_TRAP_HANDLER_WIN_H_ 29 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86_64.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/jniLibs/x86_64.zip -------------------------------------------------------------------------------- /app/src/main/res/drawable/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/res/drawable/logo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/round_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/res/drawable/round_logo.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | plugins { 3 | id("com.android.application") version "8.9.1" apply false 4 | id("org.jetbrains.kotlin.android") version "2.1.10" apply false 5 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanpuer/SkiaUI2/d894a500b2b9649174fb994f0b1ab8a0adc7bb43/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Mar 28 08:47:13 CST 2025 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.11.1-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | gradlePluginPortal() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | 13 | 14 | mavenCentral() 15 | } 16 | } 17 | 18 | rootProject.name = "SkiaUI" 19 | include(":app") 20 | --------------------------------------------------------------------------------