├── .github └── FUNDING.yml ├── .gitignore ├── .metadata ├── .pubignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example ├── .gitignore ├── README.md ├── analysis_options.yaml ├── lib │ └── main.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── flutter_screen_capture.dart └── src │ ├── captured_screen_area.dart │ ├── screen_capture.dart │ └── views │ ├── captured_screen_area_view.dart │ ├── screen_area_live_view.dart │ └── screen_color_live_view.dart ├── linux ├── CMakeLists.txt ├── flutter_screen_capture_plugin.cc └── include │ └── flutter_screen_capture │ └── flutter_screen_capture_plugin.h ├── macos ├── Classes │ └── FlutterScreenCapturePlugin.swift └── flutter_screen_capture.podspec ├── pubspec.yaml ├── scripts └── publish.bash └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter_screen_capture_plugin.cpp ├── flutter_screen_capture_plugin.h ├── flutter_screen_capture_plugin_c_api.cpp └── include └── flutter_screen_capture └── flutter_screen_capture_plugin_c_api.h /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: albemala 4 | buy_me_a_coffee: albemala 5 | #patreon: # Replace with a single Patreon username 6 | #open_collective: # Replace with a single Open Collective username 7 | #ko_fi: # Replace with a single Ko-fi username 8 | #tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 9 | #community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 10 | #liberapay: # Replace with a single Liberapay username 11 | #issuehunt: # Replace with a single IssueHunt username 12 | #lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | #polar: # Replace with a single Polar username 14 | #thanks_dev: # Replace with a single thanks.dev username 15 | #custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | .vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | 32 | **/cmake-build-debug-visual-studio/** 33 | **/cmake-build-debug/** -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "ef1af02aead6fe2414f3aafa5a61087b610e1332" 8 | channel: "stable" 9 | 10 | project_type: plugin 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 17 | base_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 18 | - platform: linux 19 | create_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 20 | base_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 21 | - platform: macos 22 | create_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 23 | base_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 24 | - platform: windows 25 | create_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 26 | base_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332 27 | 28 | # User provided section 29 | 30 | # List of Local paths (relative to this file) that should be 31 | # ignored by the migrate tool. 32 | # 33 | # Files that are not part of the templates will be ignored by default. 34 | unmanaged_files: 35 | - 'lib/main.dart' 36 | - 'ios/Runner.xcodeproj/project.pbxproj' 37 | -------------------------------------------------------------------------------- /.pubignore: -------------------------------------------------------------------------------- 1 | build/ 2 | example/build/ 3 | scripts/ 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.2.3 2 | 3 | - Updated funding information 4 | 5 | ## 1.2.2 6 | 7 | - Updated readme 8 | 9 | ## 1.2.1 10 | 11 | - Upgraded dependencies 12 | - Updated example macOS config 13 | 14 | ## 1.2.0 15 | 16 | - Targeting Dart 3.2 and Flutter 3.16 17 | - Upgraded dependencies 18 | - Fixed linter issues 19 | 20 | ## 1.1.0 21 | 22 | - Targeting Dart 2.19 and Flutter 3.7 23 | - Upgraded dependencies 24 | - Fixed crash when capturing area outside of primary screen 25 | - Targeting min macOS 10.14 in example 26 | 27 | ## 1.0.2 28 | 29 | - Removed homepage link from pubspec file 30 | 31 | ## 1.0.1 32 | 33 | - Fixed warnings 34 | 35 | ## 1.0.0 36 | 37 | * Capture screen area on macOS 38 | * Capture screen area on Windows 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 albemala 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_screen_capture 2 | 3 | [![Pub](https://img.shields.io/pub/v/flutter_screen_capture)](https://pub.dev/packages/flutter_screen_capture) 4 | 5 | A plugin to capture the entire screen or part of it on desktop platforms. 6 | 7 | | | macOS | Windows | Linux | 8 | |:------------|:------|:--------|:------| 9 | | **Support** | ✅ | ✅ | ❌ | 10 | 11 | ## Usage 12 | 13 | ### Capture the entire screen 14 | 15 | ```dart 16 | final area = await ScreenCapture().captureEntireScreen(); 17 | ``` 18 | 19 | ### Capture a specific area of the screen 20 | 21 | ```dart 22 | final topLeftCorner = Rect.fromLTWH(0, 0, 100, 100); 23 | final area = await ScreenCapture().captureScreenArea(topLeftCorner); 24 | ``` 25 | 26 | ### Capture a single pixel color 27 | 28 | ```dart 29 | final color = await ScreenCapture().captureScreenColor(100, 100); 30 | ``` 31 | 32 | ### Widgets 33 | 34 | There are 2 widgets you can use to see a live preview of a screen area or a pixel color. 35 | They both display what's under the mouse cursor. 36 | 37 | Screen area preview: 38 | 39 | ```dart 40 | SizedBox( 41 | width: 72, 42 | height: 72, 43 | child: ScreenAreaLiveView(areaSize: 72 / 4), 44 | ) 45 | ``` 46 | 47 | Color live preview: 48 | 49 | ```dart 50 | SizedBox( 51 | width: 48, 52 | height: 48, 53 | child: ScreenColorLiveView(), 54 | ) 55 | ``` 56 | 57 | ### Advanced usage 58 | 59 | See the [example app](https://github.com/albemala/flutter_screen_capture/tree/main/example) for a complete usage 60 | example. 61 | 62 | ## Current limitations 63 | 64 | - Linux is not supported yet. 65 | - Capturing on multiple screens is not supported yet. 66 | - Capturing on high-resolution screens (e.g. Retina displays) is not supported yet. 67 | 68 | ## Projects using this package 69 | 70 | - **[Hexee Pro](https://hexee.app/)** - Palette editor & Advanced color toolkit for designers and developers. 71 | 72 | Feel free to submit a pull request to add your project to this list. 73 | 74 | ## Support this project 75 | 76 | - [GitHub Sponsor](https://github.com/sponsors/albemala) 77 | - [Buy Me A Coffee](https://www.buymeacoffee.com/albemala) 78 | 79 | ## Other projects 80 | 81 | [All my projects](https://projects.albemala.me/) 82 | 83 | ## Credits 84 | 85 | Created by [@albemala](https://github.com/albemala) ([Twitter](https://twitter.com/albemala)) 86 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:very_good_analysis/analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | public_member_api_docs: false 6 | sort_constructors_first: false 7 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_screen_capture_example 2 | 3 | Demonstrates how to use the flutter_screen_capture plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screen_capture/flutter_screen_capture.dart'; 3 | import 'package:screen_retriever/screen_retriever.dart'; 4 | 5 | void main() { 6 | runApp(const MyApp()); 7 | } 8 | 9 | class MyApp extends StatefulWidget { 10 | const MyApp({super.key}); 11 | 12 | @override 13 | State createState() => _MyAppState(); 14 | } 15 | 16 | class _MyAppState extends State { 17 | final _plugin = ScreenCapture(); 18 | Color? _color; 19 | CapturedScreenArea? _screenArea; 20 | CapturedScreenArea? _fullScreenArea; 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return RawKeyboardListener( 25 | focusNode: FocusNode(), 26 | onKey: (key) async { 27 | switch (key.character) { 28 | case 'c': // capture screen pixel 29 | await _captureScreenPixel(); 30 | break; 31 | case 'a': // capture screen area 32 | await _captureScreenArea(); 33 | break; 34 | case 'f': // capture full screen 35 | await _captureFullScreen(); 36 | break; 37 | } 38 | }, 39 | child: MaterialApp( 40 | home: Scaffold( 41 | body: SingleChildScrollView( 42 | padding: const EdgeInsets.all(32), 43 | child: Column( 44 | mainAxisSize: MainAxisSize.min, 45 | crossAxisAlignment: CrossAxisAlignment.start, 46 | children: [ 47 | Text( 48 | 'Screen pixel color', 49 | style: Theme.of(context).textTheme.titleLarge, 50 | ), 51 | const SizedBox(height: 24), 52 | const Row( 53 | children: [ 54 | SizedBox( 55 | width: 64, 56 | height: 64, 57 | child: ScreenColorLiveView(), 58 | ), 59 | SizedBox(width: 24), 60 | Text('Live at cursor position'), 61 | ], 62 | ), 63 | const SizedBox(height: 24), 64 | Row( 65 | children: [ 66 | Container( 67 | width: 64, 68 | height: 64, 69 | color: _color, 70 | ), 71 | const SizedBox(width: 24), 72 | const Text('Press C to capture color at cursor position'), 73 | ], 74 | ), 75 | const SizedBox(height: 64), 76 | Text( 77 | 'Screen area', 78 | style: Theme.of(context).textTheme.titleLarge, 79 | ), 80 | const SizedBox(height: 24), 81 | const Row( 82 | children: [ 83 | SizedBox( 84 | width: 72, 85 | height: 72, 86 | child: ScreenAreaLiveView(areaSize: 72 / 4), 87 | ), 88 | SizedBox(width: 24), 89 | Text('Live at cursor position'), 90 | ], 91 | ), 92 | const SizedBox(height: 24), 93 | Row( 94 | children: [ 95 | if (_screenArea != null) 96 | CapturedScreenAreaView(area: _screenArea!), 97 | const SizedBox(width: 24), 98 | const Text('Press A to capture screen at cursor position'), 99 | ], 100 | ), 101 | const SizedBox(height: 64), 102 | Text( 103 | 'Full screen', 104 | style: Theme.of(context).textTheme.titleLarge, 105 | ), 106 | const SizedBox(height: 24), 107 | const Text('Press F to capture the entire screen'), 108 | const SizedBox(height: 24), 109 | if (_fullScreenArea != null) 110 | CapturedScreenAreaView(area: _fullScreenArea!), 111 | ], 112 | ), 113 | ), 114 | ), 115 | ), 116 | ); 117 | } 118 | 119 | Future _captureScreenPixel() async { 120 | final cursorScreenPoint = 121 | await ScreenRetriever.instance.getCursorScreenPoint(); 122 | final color = await _plugin.captureScreenColor( 123 | cursorScreenPoint.dx, 124 | cursorScreenPoint.dy, 125 | ); 126 | setState(() { 127 | _color = color; 128 | }); 129 | } 130 | 131 | Future _captureScreenArea() async { 132 | final cursorScreenPoint = 133 | await ScreenRetriever.instance.getCursorScreenPoint(); 134 | final rect = Rect.fromCircle(center: cursorScreenPoint, radius: 72 / 2); 135 | final area = await _plugin.captureScreenArea(rect); 136 | setState(() { 137 | _screenArea = area; 138 | }); 139 | } 140 | 141 | Future _captureFullScreen() async { 142 | final area = await _plugin.captureEntireScreen(); 143 | setState(() { 144 | _fullScreenArea = area; 145 | }); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "flutter_screen_capture_example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "me.albemala.flutter_screen_capture") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) flutter_screen_capture_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterScreenCapturePlugin"); 15 | flutter_screen_capture_plugin_register_with_registrar(flutter_screen_capture_registrar); 16 | g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin"); 18 | screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | flutter_screen_capture 7 | screen_retriever_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "flutter_screen_capture_example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "flutter_screen_capture_example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import flutter_screen_capture 9 | import screen_retriever_macos 10 | 11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 12 | FlutterScreenCapturePlugin.register(with: registry.registrar(forPlugin: "FlutterScreenCapturePlugin")) 13 | ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin")) 14 | } 15 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - flutter_screen_capture (0.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - screen_retriever_macos (0.0.1): 6 | - FlutterMacOS 7 | 8 | DEPENDENCIES: 9 | - flutter_screen_capture (from `Flutter/ephemeral/.symlinks/plugins/flutter_screen_capture/macos`) 10 | - FlutterMacOS (from `Flutter/ephemeral`) 11 | - screen_retriever_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos`) 12 | 13 | EXTERNAL SOURCES: 14 | flutter_screen_capture: 15 | :path: Flutter/ephemeral/.symlinks/plugins/flutter_screen_capture/macos 16 | FlutterMacOS: 17 | :path: Flutter/ephemeral 18 | screen_retriever_macos: 19 | :path: Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos 20 | 21 | SPEC CHECKSUMS: 22 | flutter_screen_capture: cc0f1c99c1e984e1a91df15c13a3ffac53d80288 23 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 24 | screen_retriever_macos: 776e0fa5d42c6163d2bf772d22478df4b302b161 25 | 26 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 27 | 28 | COCOAPODS: 1.13.0 29 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; 13 | buildPhases = ( 14 | 33CC111E2044C6BF0003C045 /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | ); 18 | name = "Flutter Assemble"; 19 | productName = FLX; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 25 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 26 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 27 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 28 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 29 | 88A920905D1E1888AA8A45F8 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 373DF57058F92E17D2AEF8D6 /* Pods_Runner.framework */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 33CC10E52044A3C60003C045 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 33CC111A2044C6BA0003C045; 38 | remoteInfo = FLX; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXCopyFilesBuildPhase section */ 43 | 33CC110E2044A8840003C045 /* Bundle Framework */ = { 44 | isa = PBXCopyFilesBuildPhase; 45 | buildActionMask = 2147483647; 46 | dstPath = ""; 47 | dstSubfolderSpec = 10; 48 | files = ( 49 | ); 50 | name = "Bundle Framework"; 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXCopyFilesBuildPhase section */ 54 | 55 | /* Begin PBXFileReference section */ 56 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 57 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 58 | 33CC10ED2044A3C60003C045 /* flutter_screen_capture_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = flutter_screen_capture_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 60 | 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 61 | 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 62 | 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; 63 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; 64 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 65 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 66 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; 67 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 68 | 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 69 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 70 | 373DF57058F92E17D2AEF8D6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | 448F8258D53F598AA06376DE /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 72 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 73 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; 74 | D17A01605084F8390C49BE12 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 75 | DC22E0F0E850FCEF2823B23A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | 33CC10EA2044A3C60003C045 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | 88A920905D1E1888AA8A45F8 /* Pods_Runner.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 33BA886A226E78AF003329D5 /* Configs */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */, 94 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 95 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 96 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, 97 | ); 98 | path = Configs; 99 | sourceTree = ""; 100 | }; 101 | 33CC10E42044A3C60003C045 = { 102 | isa = PBXGroup; 103 | children = ( 104 | 33FAB671232836740065AC1E /* Runner */, 105 | 33CEB47122A05771004F2AC0 /* Flutter */, 106 | 33CC10EE2044A3C60003C045 /* Products */, 107 | D73912EC22F37F3D000D13A0 /* Frameworks */, 108 | 5E3041999650AD15F3C200F3 /* Pods */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 33CC10EE2044A3C60003C045 /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 33CC10ED2044A3C60003C045 /* flutter_screen_capture_example.app */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 33CC11242044D66E0003C045 /* Resources */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 33CC10F22044A3C60003C045 /* Assets.xcassets */, 124 | 33CC10F42044A3C60003C045 /* MainMenu.xib */, 125 | 33CC10F72044A3C60003C045 /* Info.plist */, 126 | ); 127 | name = Resources; 128 | path = ..; 129 | sourceTree = ""; 130 | }; 131 | 33CEB47122A05771004F2AC0 /* Flutter */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 135 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 136 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 137 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 138 | ); 139 | path = Flutter; 140 | sourceTree = ""; 141 | }; 142 | 33FAB671232836740065AC1E /* Runner */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 146 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 147 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */, 148 | 33E51914231749380026EE4D /* Release.entitlements */, 149 | 33CC11242044D66E0003C045 /* Resources */, 150 | 33BA886A226E78AF003329D5 /* Configs */, 151 | ); 152 | path = Runner; 153 | sourceTree = ""; 154 | }; 155 | 5E3041999650AD15F3C200F3 /* Pods */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 448F8258D53F598AA06376DE /* Pods-Runner.debug.xcconfig */, 159 | DC22E0F0E850FCEF2823B23A /* Pods-Runner.release.xcconfig */, 160 | D17A01605084F8390C49BE12 /* Pods-Runner.profile.xcconfig */, 161 | ); 162 | name = Pods; 163 | path = Pods; 164 | sourceTree = ""; 165 | }; 166 | D73912EC22F37F3D000D13A0 /* Frameworks */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 373DF57058F92E17D2AEF8D6 /* Pods_Runner.framework */, 170 | ); 171 | name = Frameworks; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXGroup section */ 175 | 176 | /* Begin PBXNativeTarget section */ 177 | 33CC10EC2044A3C60003C045 /* Runner */ = { 178 | isa = PBXNativeTarget; 179 | buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; 180 | buildPhases = ( 181 | AE22635144CD2FAC1587033D /* [CP] Check Pods Manifest.lock */, 182 | 33CC10E92044A3C60003C045 /* Sources */, 183 | 33CC10EA2044A3C60003C045 /* Frameworks */, 184 | 33CC10EB2044A3C60003C045 /* Resources */, 185 | 33CC110E2044A8840003C045 /* Bundle Framework */, 186 | 3399D490228B24CF009A79C7 /* ShellScript */, 187 | BB216E793EB7770313680019 /* [CP] Embed Pods Frameworks */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 33CC11202044C79F0003C045 /* PBXTargetDependency */, 193 | ); 194 | name = Runner; 195 | productName = Runner; 196 | productReference = 33CC10ED2044A3C60003C045 /* flutter_screen_capture_example.app */; 197 | productType = "com.apple.product-type.application"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | 33CC10E52044A3C60003C045 /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastSwiftUpdateCheck = 0920; 206 | LastUpgradeCheck = 1510; 207 | ORGANIZATIONNAME = ""; 208 | TargetAttributes = { 209 | 33CC10EC2044A3C60003C045 = { 210 | CreatedOnToolsVersion = 9.2; 211 | LastSwiftMigration = 1100; 212 | ProvisioningStyle = Automatic; 213 | SystemCapabilities = { 214 | com.apple.Sandbox = { 215 | enabled = 1; 216 | }; 217 | }; 218 | }; 219 | 33CC111A2044C6BA0003C045 = { 220 | CreatedOnToolsVersion = 9.2; 221 | ProvisioningStyle = Manual; 222 | }; 223 | }; 224 | }; 225 | buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; 226 | compatibilityVersion = "Xcode 9.3"; 227 | developmentRegion = en; 228 | hasScannedForEncodings = 0; 229 | knownRegions = ( 230 | en, 231 | Base, 232 | ); 233 | mainGroup = 33CC10E42044A3C60003C045; 234 | productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; 235 | projectDirPath = ""; 236 | projectRoot = ""; 237 | targets = ( 238 | 33CC10EC2044A3C60003C045 /* Runner */, 239 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */, 240 | ); 241 | }; 242 | /* End PBXProject section */ 243 | 244 | /* Begin PBXResourcesBuildPhase section */ 245 | 33CC10EB2044A3C60003C045 /* Resources */ = { 246 | isa = PBXResourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 250 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXResourcesBuildPhase section */ 255 | 256 | /* Begin PBXShellScriptBuildPhase section */ 257 | 3399D490228B24CF009A79C7 /* ShellScript */ = { 258 | isa = PBXShellScriptBuildPhase; 259 | alwaysOutOfDate = 1; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | ); 263 | inputFileListPaths = ( 264 | ); 265 | inputPaths = ( 266 | ); 267 | outputFileListPaths = ( 268 | ); 269 | outputPaths = ( 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | shellPath = /bin/sh; 273 | shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; 274 | }; 275 | 33CC111E2044C6BF0003C045 /* ShellScript */ = { 276 | isa = PBXShellScriptBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | ); 280 | inputFileListPaths = ( 281 | Flutter/ephemeral/FlutterInputs.xcfilelist, 282 | ); 283 | inputPaths = ( 284 | Flutter/ephemeral/tripwire, 285 | ); 286 | outputFileListPaths = ( 287 | Flutter/ephemeral/FlutterOutputs.xcfilelist, 288 | ); 289 | outputPaths = ( 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | shellPath = /bin/sh; 293 | shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; 294 | }; 295 | AE22635144CD2FAC1587033D /* [CP] Check Pods Manifest.lock */ = { 296 | isa = PBXShellScriptBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | ); 300 | inputFileListPaths = ( 301 | ); 302 | inputPaths = ( 303 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 304 | "${PODS_ROOT}/Manifest.lock", 305 | ); 306 | name = "[CP] Check Pods Manifest.lock"; 307 | outputFileListPaths = ( 308 | ); 309 | outputPaths = ( 310 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | shellPath = /bin/sh; 314 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 315 | showEnvVarsInLog = 0; 316 | }; 317 | BB216E793EB7770313680019 /* [CP] Embed Pods Frameworks */ = { 318 | isa = PBXShellScriptBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | ); 322 | inputFileListPaths = ( 323 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 324 | ); 325 | name = "[CP] Embed Pods Frameworks"; 326 | outputFileListPaths = ( 327 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | shellPath = /bin/sh; 331 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 332 | showEnvVarsInLog = 0; 333 | }; 334 | /* End PBXShellScriptBuildPhase section */ 335 | 336 | /* Begin PBXSourcesBuildPhase section */ 337 | 33CC10E92044A3C60003C045 /* Sources */ = { 338 | isa = PBXSourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 342 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 343 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | }; 347 | /* End PBXSourcesBuildPhase section */ 348 | 349 | /* Begin PBXTargetDependency section */ 350 | 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { 351 | isa = PBXTargetDependency; 352 | target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; 353 | targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; 354 | }; 355 | /* End PBXTargetDependency section */ 356 | 357 | /* Begin PBXVariantGroup section */ 358 | 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { 359 | isa = PBXVariantGroup; 360 | children = ( 361 | 33CC10F52044A3C60003C045 /* Base */, 362 | ); 363 | name = MainMenu.xib; 364 | path = Runner; 365 | sourceTree = ""; 366 | }; 367 | /* End PBXVariantGroup section */ 368 | 369 | /* Begin XCBuildConfiguration section */ 370 | 338D0CE9231458BD00FA5F75 /* Profile */ = { 371 | isa = XCBuildConfiguration; 372 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 373 | buildSettings = { 374 | ALWAYS_SEARCH_USER_PATHS = NO; 375 | CLANG_ANALYZER_NONNULL = YES; 376 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 377 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 378 | CLANG_CXX_LIBRARY = "libc++"; 379 | CLANG_ENABLE_MODULES = YES; 380 | CLANG_ENABLE_OBJC_ARC = YES; 381 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 382 | CLANG_WARN_BOOL_CONVERSION = YES; 383 | CLANG_WARN_CONSTANT_CONVERSION = YES; 384 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 385 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 386 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INFINITE_RECURSION = YES; 390 | CLANG_WARN_INT_CONVERSION = YES; 391 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 393 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 394 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 395 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 396 | CODE_SIGN_IDENTITY = "-"; 397 | COPY_PHASE_STRIP = NO; 398 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 399 | ENABLE_NS_ASSERTIONS = NO; 400 | ENABLE_STRICT_OBJC_MSGSEND = YES; 401 | GCC_C_LANGUAGE_STANDARD = gnu11; 402 | GCC_NO_COMMON_BLOCKS = YES; 403 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 404 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 405 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 406 | GCC_WARN_UNUSED_FUNCTION = YES; 407 | GCC_WARN_UNUSED_VARIABLE = YES; 408 | MACOSX_DEPLOYMENT_TARGET = 10.14; 409 | MTL_ENABLE_DEBUG_INFO = NO; 410 | SDKROOT = macosx; 411 | SWIFT_COMPILATION_MODE = wholemodule; 412 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 413 | }; 414 | name = Profile; 415 | }; 416 | 338D0CEA231458BD00FA5F75 /* Profile */ = { 417 | isa = XCBuildConfiguration; 418 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 419 | buildSettings = { 420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 421 | CLANG_ENABLE_MODULES = YES; 422 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 423 | CODE_SIGN_STYLE = Automatic; 424 | COMBINE_HIDPI_IMAGES = YES; 425 | INFOPLIST_FILE = Runner/Info.plist; 426 | LD_RUNPATH_SEARCH_PATHS = ( 427 | "$(inherited)", 428 | "@executable_path/../Frameworks", 429 | ); 430 | PROVISIONING_PROFILE_SPECIFIER = ""; 431 | SWIFT_VERSION = 5.0; 432 | }; 433 | name = Profile; 434 | }; 435 | 338D0CEB231458BD00FA5F75 /* Profile */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | CODE_SIGN_STYLE = Manual; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | }; 441 | name = Profile; 442 | }; 443 | 33CC10F92044A3C60003C045 /* Debug */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 446 | buildSettings = { 447 | ALWAYS_SEARCH_USER_PATHS = NO; 448 | CLANG_ANALYZER_NONNULL = YES; 449 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 450 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 451 | CLANG_CXX_LIBRARY = "libc++"; 452 | CLANG_ENABLE_MODULES = YES; 453 | CLANG_ENABLE_OBJC_ARC = YES; 454 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 455 | CLANG_WARN_BOOL_CONVERSION = YES; 456 | CLANG_WARN_CONSTANT_CONVERSION = YES; 457 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 458 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 459 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 460 | CLANG_WARN_EMPTY_BODY = YES; 461 | CLANG_WARN_ENUM_CONVERSION = YES; 462 | CLANG_WARN_INFINITE_RECURSION = YES; 463 | CLANG_WARN_INT_CONVERSION = YES; 464 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 465 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 466 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 467 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 468 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 469 | CODE_SIGN_IDENTITY = "-"; 470 | COPY_PHASE_STRIP = NO; 471 | DEBUG_INFORMATION_FORMAT = dwarf; 472 | ENABLE_STRICT_OBJC_MSGSEND = YES; 473 | ENABLE_TESTABILITY = YES; 474 | GCC_C_LANGUAGE_STANDARD = gnu11; 475 | GCC_DYNAMIC_NO_PIC = NO; 476 | GCC_NO_COMMON_BLOCKS = YES; 477 | GCC_OPTIMIZATION_LEVEL = 0; 478 | GCC_PREPROCESSOR_DEFINITIONS = ( 479 | "DEBUG=1", 480 | "$(inherited)", 481 | ); 482 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 483 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 484 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 485 | GCC_WARN_UNUSED_FUNCTION = YES; 486 | GCC_WARN_UNUSED_VARIABLE = YES; 487 | MACOSX_DEPLOYMENT_TARGET = 10.14; 488 | MTL_ENABLE_DEBUG_INFO = YES; 489 | ONLY_ACTIVE_ARCH = YES; 490 | SDKROOT = macosx; 491 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 492 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 493 | }; 494 | name = Debug; 495 | }; 496 | 33CC10FA2044A3C60003C045 /* Release */ = { 497 | isa = XCBuildConfiguration; 498 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 499 | buildSettings = { 500 | ALWAYS_SEARCH_USER_PATHS = NO; 501 | CLANG_ANALYZER_NONNULL = YES; 502 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 503 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 504 | CLANG_CXX_LIBRARY = "libc++"; 505 | CLANG_ENABLE_MODULES = YES; 506 | CLANG_ENABLE_OBJC_ARC = YES; 507 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 508 | CLANG_WARN_BOOL_CONVERSION = YES; 509 | CLANG_WARN_CONSTANT_CONVERSION = YES; 510 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 511 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 512 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 513 | CLANG_WARN_EMPTY_BODY = YES; 514 | CLANG_WARN_ENUM_CONVERSION = YES; 515 | CLANG_WARN_INFINITE_RECURSION = YES; 516 | CLANG_WARN_INT_CONVERSION = YES; 517 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 518 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 519 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 520 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 521 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 522 | CODE_SIGN_IDENTITY = "-"; 523 | COPY_PHASE_STRIP = NO; 524 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 525 | ENABLE_NS_ASSERTIONS = NO; 526 | ENABLE_STRICT_OBJC_MSGSEND = YES; 527 | GCC_C_LANGUAGE_STANDARD = gnu11; 528 | GCC_NO_COMMON_BLOCKS = YES; 529 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 530 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 531 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 532 | GCC_WARN_UNUSED_FUNCTION = YES; 533 | GCC_WARN_UNUSED_VARIABLE = YES; 534 | MACOSX_DEPLOYMENT_TARGET = 10.14; 535 | MTL_ENABLE_DEBUG_INFO = NO; 536 | SDKROOT = macosx; 537 | SWIFT_COMPILATION_MODE = wholemodule; 538 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 539 | }; 540 | name = Release; 541 | }; 542 | 33CC10FC2044A3C60003C045 /* Debug */ = { 543 | isa = XCBuildConfiguration; 544 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 545 | buildSettings = { 546 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 547 | CLANG_ENABLE_MODULES = YES; 548 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 549 | CODE_SIGN_STYLE = Automatic; 550 | COMBINE_HIDPI_IMAGES = YES; 551 | INFOPLIST_FILE = Runner/Info.plist; 552 | LD_RUNPATH_SEARCH_PATHS = ( 553 | "$(inherited)", 554 | "@executable_path/../Frameworks", 555 | ); 556 | PROVISIONING_PROFILE_SPECIFIER = ""; 557 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 558 | SWIFT_VERSION = 5.0; 559 | }; 560 | name = Debug; 561 | }; 562 | 33CC10FD2044A3C60003C045 /* Release */ = { 563 | isa = XCBuildConfiguration; 564 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 565 | buildSettings = { 566 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 567 | CLANG_ENABLE_MODULES = YES; 568 | CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; 569 | CODE_SIGN_STYLE = Automatic; 570 | COMBINE_HIDPI_IMAGES = YES; 571 | INFOPLIST_FILE = Runner/Info.plist; 572 | LD_RUNPATH_SEARCH_PATHS = ( 573 | "$(inherited)", 574 | "@executable_path/../Frameworks", 575 | ); 576 | PROVISIONING_PROFILE_SPECIFIER = ""; 577 | SWIFT_VERSION = 5.0; 578 | }; 579 | name = Release; 580 | }; 581 | 33CC111C2044C6BA0003C045 /* Debug */ = { 582 | isa = XCBuildConfiguration; 583 | buildSettings = { 584 | CODE_SIGN_STYLE = Manual; 585 | PRODUCT_NAME = "$(TARGET_NAME)"; 586 | }; 587 | name = Debug; 588 | }; 589 | 33CC111D2044C6BA0003C045 /* Release */ = { 590 | isa = XCBuildConfiguration; 591 | buildSettings = { 592 | CODE_SIGN_STYLE = Automatic; 593 | PRODUCT_NAME = "$(TARGET_NAME)"; 594 | }; 595 | name = Release; 596 | }; 597 | /* End XCBuildConfiguration section */ 598 | 599 | /* Begin XCConfigurationList section */ 600 | 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { 601 | isa = XCConfigurationList; 602 | buildConfigurations = ( 603 | 33CC10F92044A3C60003C045 /* Debug */, 604 | 33CC10FA2044A3C60003C045 /* Release */, 605 | 338D0CE9231458BD00FA5F75 /* Profile */, 606 | ); 607 | defaultConfigurationIsVisible = 0; 608 | defaultConfigurationName = Release; 609 | }; 610 | 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { 611 | isa = XCConfigurationList; 612 | buildConfigurations = ( 613 | 33CC10FC2044A3C60003C045 /* Debug */, 614 | 33CC10FD2044A3C60003C045 /* Release */, 615 | 338D0CEA231458BD00FA5F75 /* Profile */, 616 | ); 617 | defaultConfigurationIsVisible = 0; 618 | defaultConfigurationName = Release; 619 | }; 620 | 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { 621 | isa = XCConfigurationList; 622 | buildConfigurations = ( 623 | 33CC111C2044C6BA0003C045 /* Debug */, 624 | 33CC111D2044C6BA0003C045 /* Release */, 625 | 338D0CEB231458BD00FA5F75 /* Profile */, 626 | ); 627 | defaultConfigurationIsVisible = 0; 628 | defaultConfigurationName = Release; 629 | }; 630 | /* End XCConfigurationList section */ 631 | }; 632 | rootObject = 33CC10E52044A3C60003C045 /* Project object */; 633 | } 634 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = flutter_screen_capture_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = me.albemala.flutterScreenCaptureExample 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 me.albemala. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "3.6.1" 12 | async: 13 | dependency: transitive 14 | description: 15 | name: async 16 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.11.0" 20 | boolean_selector: 21 | dependency: transitive 22 | description: 23 | name: boolean_selector 24 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "2.1.1" 28 | characters: 29 | dependency: transitive 30 | description: 31 | name: characters 32 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.3.0" 36 | clock: 37 | dependency: transitive 38 | description: 39 | name: clock 40 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.1.1" 44 | collection: 45 | dependency: transitive 46 | description: 47 | name: collection 48 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.18.0" 52 | crypto: 53 | dependency: transitive 54 | description: 55 | name: crypto 56 | sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "3.0.6" 60 | fake_async: 61 | dependency: transitive 62 | description: 63 | name: fake_async 64 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "1.3.1" 68 | flutter: 69 | dependency: "direct main" 70 | description: flutter 71 | source: sdk 72 | version: "0.0.0" 73 | flutter_lints: 74 | dependency: "direct dev" 75 | description: 76 | name: flutter_lints 77 | sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" 78 | url: "https://pub.dev" 79 | source: hosted 80 | version: "4.0.0" 81 | flutter_screen_capture: 82 | dependency: "direct main" 83 | description: 84 | path: ".." 85 | relative: true 86 | source: path 87 | version: "1.2.3" 88 | flutter_test: 89 | dependency: "direct dev" 90 | description: flutter 91 | source: sdk 92 | version: "0.0.0" 93 | image: 94 | dependency: transitive 95 | description: 96 | name: image 97 | sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d 98 | url: "https://pub.dev" 99 | source: hosted 100 | version: "4.3.0" 101 | json_annotation: 102 | dependency: transitive 103 | description: 104 | name: json_annotation 105 | sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" 106 | url: "https://pub.dev" 107 | source: hosted 108 | version: "4.9.0" 109 | leak_tracker: 110 | dependency: transitive 111 | description: 112 | name: leak_tracker 113 | sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" 114 | url: "https://pub.dev" 115 | source: hosted 116 | version: "10.0.5" 117 | leak_tracker_flutter_testing: 118 | dependency: transitive 119 | description: 120 | name: leak_tracker_flutter_testing 121 | sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" 122 | url: "https://pub.dev" 123 | source: hosted 124 | version: "3.0.5" 125 | leak_tracker_testing: 126 | dependency: transitive 127 | description: 128 | name: leak_tracker_testing 129 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 130 | url: "https://pub.dev" 131 | source: hosted 132 | version: "3.0.1" 133 | lints: 134 | dependency: transitive 135 | description: 136 | name: lints 137 | sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" 138 | url: "https://pub.dev" 139 | source: hosted 140 | version: "4.0.0" 141 | matcher: 142 | dependency: transitive 143 | description: 144 | name: matcher 145 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 146 | url: "https://pub.dev" 147 | source: hosted 148 | version: "0.12.16+1" 149 | material_color_utilities: 150 | dependency: transitive 151 | description: 152 | name: material_color_utilities 153 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 154 | url: "https://pub.dev" 155 | source: hosted 156 | version: "0.11.1" 157 | meta: 158 | dependency: transitive 159 | description: 160 | name: meta 161 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 162 | url: "https://pub.dev" 163 | source: hosted 164 | version: "1.15.0" 165 | path: 166 | dependency: transitive 167 | description: 168 | name: path 169 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 170 | url: "https://pub.dev" 171 | source: hosted 172 | version: "1.9.0" 173 | petitparser: 174 | dependency: transitive 175 | description: 176 | name: petitparser 177 | sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 178 | url: "https://pub.dev" 179 | source: hosted 180 | version: "6.0.2" 181 | plugin_platform_interface: 182 | dependency: transitive 183 | description: 184 | name: plugin_platform_interface 185 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 186 | url: "https://pub.dev" 187 | source: hosted 188 | version: "2.1.8" 189 | screen_retriever: 190 | dependency: "direct main" 191 | description: 192 | name: screen_retriever 193 | sha256: "570dbc8e4f70bac451e0efc9c9bb19fa2d6799a11e6ef04f946d7886d2e23d0c" 194 | url: "https://pub.dev" 195 | source: hosted 196 | version: "0.2.0" 197 | screen_retriever_linux: 198 | dependency: transitive 199 | description: 200 | name: screen_retriever_linux 201 | sha256: f7f8120c92ef0784e58491ab664d01efda79a922b025ff286e29aa123ea3dd18 202 | url: "https://pub.dev" 203 | source: hosted 204 | version: "0.2.0" 205 | screen_retriever_macos: 206 | dependency: transitive 207 | description: 208 | name: screen_retriever_macos 209 | sha256: "71f956e65c97315dd661d71f828708bd97b6d358e776f1a30d5aa7d22d78a149" 210 | url: "https://pub.dev" 211 | source: hosted 212 | version: "0.2.0" 213 | screen_retriever_platform_interface: 214 | dependency: transitive 215 | description: 216 | name: screen_retriever_platform_interface 217 | sha256: ee197f4581ff0d5608587819af40490748e1e39e648d7680ecf95c05197240c0 218 | url: "https://pub.dev" 219 | source: hosted 220 | version: "0.2.0" 221 | screen_retriever_windows: 222 | dependency: transitive 223 | description: 224 | name: screen_retriever_windows 225 | sha256: "449ee257f03ca98a57288ee526a301a430a344a161f9202b4fcc38576716fe13" 226 | url: "https://pub.dev" 227 | source: hosted 228 | version: "0.2.0" 229 | sky_engine: 230 | dependency: transitive 231 | description: flutter 232 | source: sdk 233 | version: "0.0.99" 234 | source_span: 235 | dependency: transitive 236 | description: 237 | name: source_span 238 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 239 | url: "https://pub.dev" 240 | source: hosted 241 | version: "1.10.0" 242 | stack_trace: 243 | dependency: transitive 244 | description: 245 | name: stack_trace 246 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 247 | url: "https://pub.dev" 248 | source: hosted 249 | version: "1.11.1" 250 | stream_channel: 251 | dependency: transitive 252 | description: 253 | name: stream_channel 254 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 255 | url: "https://pub.dev" 256 | source: hosted 257 | version: "2.1.2" 258 | string_scanner: 259 | dependency: transitive 260 | description: 261 | name: string_scanner 262 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 263 | url: "https://pub.dev" 264 | source: hosted 265 | version: "1.2.0" 266 | term_glyph: 267 | dependency: transitive 268 | description: 269 | name: term_glyph 270 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 271 | url: "https://pub.dev" 272 | source: hosted 273 | version: "1.2.1" 274 | test_api: 275 | dependency: transitive 276 | description: 277 | name: test_api 278 | sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" 279 | url: "https://pub.dev" 280 | source: hosted 281 | version: "0.7.2" 282 | typed_data: 283 | dependency: transitive 284 | description: 285 | name: typed_data 286 | sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 287 | url: "https://pub.dev" 288 | source: hosted 289 | version: "1.4.0" 290 | vector_math: 291 | dependency: transitive 292 | description: 293 | name: vector_math 294 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 295 | url: "https://pub.dev" 296 | source: hosted 297 | version: "2.1.4" 298 | vm_service: 299 | dependency: transitive 300 | description: 301 | name: vm_service 302 | sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" 303 | url: "https://pub.dev" 304 | source: hosted 305 | version: "14.2.5" 306 | xml: 307 | dependency: transitive 308 | description: 309 | name: xml 310 | sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 311 | url: "https://pub.dev" 312 | source: hosted 313 | version: "6.5.0" 314 | sdks: 315 | dart: ">=3.5.0 <4.0.0" 316 | flutter: ">=3.18.0-18.0.pre.54" 317 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_screen_capture_example 2 | description: Demonstrates how to use the flutter_screen_capture plugin. 3 | 4 | publish_to: 'none' 5 | 6 | environment: 7 | sdk: ">=3.2.0 <4.0.0" 8 | flutter: ">=3.16.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | flutter_screen_capture: 15 | path: ../ 16 | 17 | screen_retriever: ^0.2.0 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | 23 | flutter_lints: ^4.0.0 24 | 25 | flutter: 26 | uses-material-design: true 27 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(flutter_screen_capture_example LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "flutter_screen_capture_example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | # target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd4100) 44 | target_compile_options(${TARGET} PRIVATE /EHsc) 45 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # Application build; see runner/CMakeLists.txt. 54 | add_subdirectory("runner") 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Fully re-copy the assets directory on each build to avoid having stale files 91 | # from a previous install. 92 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 93 | install(CODE " 94 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 95 | " COMPONENT Runtime) 96 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 97 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 98 | 99 | # Install the AOT library on non-Debug builds only. 100 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 101 | CONFIGURATIONS Profile;Release 102 | COMPONENT Runtime) 103 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | FlutterScreenCapturePluginCApiRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("FlutterScreenCapturePluginCApi")); 15 | ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi")); 17 | } 18 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | flutter_screen_capture 7 | screen_retriever_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Disable Windows macros that collide with C++ standard library functions. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 25 | 26 | # Add dependency libraries and include directories. Add any application-specific 27 | # dependencies here. 28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 30 | 31 | # Run the Flutter tool portions of the build. This must not be removed. 32 | add_dependencies(${BINARY_NAME} flutter_assemble) 33 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "me.albemala" "\0" 93 | VALUE "FileDescription", "flutter_screen_capture_example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "flutter_screen_capture_example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 me.albemala. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "flutter_screen_capture_example.exe" "\0" 98 | VALUE "ProductName", "flutter_screen_capture_example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"flutter_screen_capture_example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albemala/flutter_screen_capture/4c20a02735fa72ee9c221bd9d1c33d203c6a7bdf/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /lib/flutter_screen_capture.dart: -------------------------------------------------------------------------------- 1 | export 'src/captured_screen_area.dart'; 2 | export 'src/screen_capture.dart'; 3 | export 'src/views/captured_screen_area_view.dart'; 4 | export 'src/views/screen_area_live_view.dart'; 5 | export 'src/views/screen_color_live_view.dart'; 6 | -------------------------------------------------------------------------------- /lib/src/captured_screen_area.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:flutter/widgets.dart'; 5 | import 'package:image/image.dart' as image_lib; 6 | 7 | @immutable 8 | class CapturedScreenArea { 9 | final Uint8List buffer; 10 | final int width; 11 | final int height; 12 | final int bitsPerPixel; 13 | final int bytesPerPixel; 14 | 15 | double get aspectRatio => width / height; 16 | 17 | const CapturedScreenArea({ 18 | required this.buffer, 19 | required this.width, 20 | required this.height, 21 | required this.bitsPerPixel, 22 | required this.bytesPerPixel, 23 | }); 24 | 25 | factory CapturedScreenArea.fromJson(Map json) { 26 | return CapturedScreenArea( 27 | buffer: Uint8List.fromList( 28 | (json['buffer'] as List? ?? []).cast(), 29 | ), 30 | width: json['width'] as int? ?? 0, 31 | height: json['height'] as int? ?? 0, 32 | bitsPerPixel: json['bitsPerPixel'] as int? ?? 0, 33 | bytesPerPixel: json['bytesPerPixel'] as int? ?? 0, 34 | ); 35 | } 36 | 37 | Map toJson() { 38 | return { 39 | 'buffer': buffer.toList(), 40 | 'width': width, 41 | 'height': height, 42 | 'bitsPerPixel': bitsPerPixel, 43 | 'bytesPerPixel': bytesPerPixel, 44 | }; 45 | } 46 | 47 | image_lib.Image toImage() { 48 | return image_lib.Image.fromBytes( 49 | width: width, 50 | height: height, 51 | bytes: Uint8List.fromList(buffer).buffer, 52 | order: channelOrder, 53 | // format: imageFormat, 54 | ); 55 | } 56 | 57 | image_lib.ChannelOrder get channelOrder { 58 | if (Platform.isMacOS) return image_lib.ChannelOrder.bgra; 59 | return image_lib.ChannelOrder.rgba; 60 | } 61 | 62 | Uint8List toPngImage() { 63 | return Uint8List.fromList(image_lib.encodePng(toImage(), level: 0)); 64 | } 65 | 66 | Color getPixelColor(double x, double y) { 67 | if (x < 0 || x >= width || y < 0 || y >= height) { 68 | throw RangeError('Pixel coordinates out of range'); 69 | } 70 | final index = ((y * width + x) * bytesPerPixel).toInt(); 71 | final b = buffer[index]; 72 | final g = buffer[index + 1]; 73 | final r = buffer[index + 2]; 74 | final a = buffer[index + 3]; 75 | return Color.fromARGB(a, r, g, b); 76 | } 77 | 78 | CapturedScreenArea copyWith({ 79 | Uint8List? buffer, 80 | int? width, 81 | int? height, 82 | int? bitsPerPixel, 83 | int? bytesPerPixel, 84 | }) { 85 | return CapturedScreenArea( 86 | buffer: buffer ?? this.buffer, 87 | width: width ?? this.width, 88 | height: height ?? this.height, 89 | bitsPerPixel: bitsPerPixel ?? this.bitsPerPixel, 90 | bytesPerPixel: bytesPerPixel ?? this.bytesPerPixel, 91 | ); 92 | } 93 | 94 | @override 95 | bool operator ==(Object other) => 96 | identical(this, other) || 97 | other is CapturedScreenArea && 98 | runtimeType == other.runtimeType && 99 | buffer == other.buffer && 100 | width == other.width && 101 | height == other.height && 102 | bitsPerPixel == other.bitsPerPixel && 103 | bytesPerPixel == other.bytesPerPixel; 104 | 105 | @override 106 | int get hashCode => 107 | buffer.hashCode ^ // 108 | width.hashCode ^ 109 | height.hashCode ^ 110 | bitsPerPixel.hashCode ^ 111 | bytesPerPixel.hashCode; 112 | } 113 | -------------------------------------------------------------------------------- /lib/src/screen_capture.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_screen_capture/src/captured_screen_area.dart'; 3 | import 'package:image/image.dart' as image_lib; 4 | import 'package:screen_retriever/screen_retriever.dart'; 5 | 6 | class ScreenCapture { 7 | final _methodChannel = const MethodChannel('flutter_screen_capture'); 8 | 9 | /// Captures the entire screen area of the main display. 10 | Future captureEntireScreen() async { 11 | final primaryDisplay = await ScreenRetriever.instance.getPrimaryDisplay(); 12 | return captureScreenArea( 13 | Rect.fromLTWH( 14 | 0, 15 | 0, 16 | primaryDisplay.size.width, 17 | primaryDisplay.size.height, 18 | ), 19 | ); 20 | } 21 | 22 | /// Captures a screen area of the main display. 23 | Future captureScreenArea( 24 | Rect rect, 25 | ) async { 26 | if (rect.isEmpty) return null; 27 | 28 | final correctedRect = await _sanitizeRect(rect); 29 | if (correctedRect.isEmpty) return null; 30 | 31 | final result = await _methodChannel.invokeMethod>( 32 | 'captureScreenArea', 33 | { 34 | 'x': correctedRect.left.toInt(), 35 | 'y': correctedRect.top.toInt(), 36 | 'width': correctedRect.width.toInt(), 37 | 'height': correctedRect.height.toInt(), 38 | }, 39 | ); 40 | if (result == null) return null; 41 | 42 | final area = CapturedScreenArea.fromJson(result); 43 | return _sanitizeCapturedArea(area, rect, correctedRect); 44 | } 45 | 46 | /// Captures the color of a pixel on the screen. 47 | Future captureScreenColor(double x, double y) async { 48 | final area = await captureScreenArea( 49 | Rect.fromLTWH(x, y, 1, 1), 50 | ); 51 | return area?.getPixelColor(0, 0); 52 | } 53 | } 54 | 55 | Future _sanitizeRect(Rect rect) async { 56 | final primaryDisplay = await ScreenRetriever.instance.getPrimaryDisplay(); 57 | final displayRect = Offset.zero & primaryDisplay.size; 58 | return rect.intersect(displayRect); 59 | } 60 | 61 | Future _sanitizeCapturedArea( 62 | CapturedScreenArea area, 63 | Rect originalRect, 64 | Rect correctedRect, 65 | ) async { 66 | var correctedArea = area; 67 | 68 | if (correctedRect != originalRect) { 69 | // The intersection area (between the primary display area 70 | // and the requested area) is smaller than the requested area. 71 | // Usually this happens when requesting an area close to the screen border. 72 | // We need to fill the captured area with black pixels, 73 | // where the pixels are outside the requested area. 74 | 75 | final originalWidth = originalRect.width.toInt(); 76 | final originalHeight = originalRect.height.toInt(); 77 | // Create a black image of the size of the requested area 78 | final emptyImage = image_lib.Image.fromBytes( 79 | width: originalWidth, 80 | height: originalHeight, 81 | bytes: Uint8List.fromList( 82 | List.filled( 83 | originalWidth * originalHeight * 4, 84 | 0, 85 | ), 86 | ).buffer, 87 | ); 88 | // Draw the captured image on top of the black image 89 | final correctedImage = image_lib.compositeImage( 90 | emptyImage, 91 | area.toImage(), 92 | dstX: (correctedRect.left - originalRect.left).toInt(), 93 | dstY: (correctedRect.top - originalRect.top).toInt(), 94 | blend: image_lib.BlendMode.direct, 95 | ); 96 | // Update the captured area with the new image 97 | correctedArea = correctedArea.copyWith( 98 | buffer: correctedImage.getBytes( 99 | order: correctedArea.channelOrder, 100 | ), 101 | width: originalWidth, 102 | height: originalHeight, 103 | ); 104 | } 105 | 106 | return correctedArea; 107 | } 108 | -------------------------------------------------------------------------------- /lib/src/views/captured_screen_area_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_screen_capture/src/captured_screen_area.dart'; 3 | 4 | /// A widget that displays a captured screen area as an image. 5 | class CapturedScreenAreaView extends StatelessWidget { 6 | final CapturedScreenArea area; 7 | 8 | const CapturedScreenAreaView({ 9 | required this.area, 10 | super.key, 11 | }); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Image.memory( 16 | area.toPngImage(), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/src/views/screen_area_live_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/scheduler.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_screen_capture/src/captured_screen_area.dart'; 4 | import 'package:flutter_screen_capture/src/screen_capture.dart'; 5 | import 'package:screen_retriever/screen_retriever.dart'; 6 | 7 | /// A widget that displays the screen area at the cursor position. 8 | /// The area is updated every frame. 9 | /// 10 | /// Notes: 11 | /// - Make sure to wrap it into a [SizedBox] to give it a size. 12 | class ScreenAreaLiveView extends StatefulWidget { 13 | /// The size of the captured area in pixels. 14 | final double areaSize; 15 | 16 | const ScreenAreaLiveView({ 17 | required this.areaSize, 18 | super.key, 19 | }) : assert(areaSize > 0, 'areaSize must be greater than 0'); 20 | 21 | @override 22 | State createState() => _ScreenAreaLiveViewState(); 23 | } 24 | 25 | class _ScreenAreaLiveViewState extends State 26 | with SingleTickerProviderStateMixin { 27 | final _plugin = ScreenCapture(); 28 | CapturedScreenArea? _area; 29 | late Ticker _ticker; 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | _ticker = createTicker((duration) async { 35 | final cursorScreenPoint = 36 | await ScreenRetriever.instance.getCursorScreenPoint(); 37 | final rect = Rect.fromCircle( 38 | center: cursorScreenPoint, 39 | radius: widget.areaSize / 2, 40 | ); 41 | final area = await _plugin.captureScreenArea(rect); 42 | setState(() { 43 | _area = area; 44 | }); 45 | }); 46 | _ticker.start(); 47 | } 48 | 49 | @override 50 | void dispose() { 51 | _ticker.dispose(); 52 | super.dispose(); 53 | } 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | if (_area == null) { 58 | return const SizedBox(); 59 | } else { 60 | return CustomPaint( 61 | painter: CapturedScreenAreaPainter(area: _area!), 62 | ); 63 | } 64 | } 65 | } 66 | 67 | class CapturedScreenAreaPainter extends CustomPainter { 68 | final CapturedScreenArea area; 69 | 70 | const CapturedScreenAreaPainter({ 71 | required this.area, 72 | }); 73 | 74 | @override 75 | void paint(Canvas canvas, Size size) { 76 | final pixelWidth = size.width / area.width; 77 | final pixelHeight = size.height / area.height; 78 | for (var row = 0; row < area.height; row++) { 79 | for (var column = 0; column < area.width; column++) { 80 | final color = area.getPixelColor(column.toDouble(), row.toDouble()); 81 | canvas.drawRect( 82 | Rect.fromLTWH( 83 | column * pixelWidth, 84 | row * pixelHeight, 85 | pixelWidth, 86 | pixelHeight, 87 | ), 88 | Paint()..color = color, 89 | ); 90 | } 91 | } 92 | } 93 | 94 | @override 95 | bool shouldRepaint(CapturedScreenAreaPainter oldDelegate) { 96 | return oldDelegate.area != area; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lib/src/views/screen_color_live_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/scheduler.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_screen_capture/src/screen_capture.dart'; 4 | import 'package:screen_retriever/screen_retriever.dart'; 5 | 6 | /// A widget that displays the color of the screen pixel at the cursor position. 7 | /// The color is updated every frame. 8 | /// 9 | /// Notes: 10 | /// - Make sure to wrap it into a [SizedBox] to give it a size. 11 | class ScreenColorLiveView extends StatefulWidget { 12 | const ScreenColorLiveView({ 13 | super.key, 14 | }); 15 | 16 | @override 17 | State createState() => _ScreenColorLiveViewState(); 18 | } 19 | 20 | class _ScreenColorLiveViewState extends State 21 | with SingleTickerProviderStateMixin { 22 | final _plugin = ScreenCapture(); 23 | Color _color = const Color(0xFF000000); 24 | late Ticker _ticker; 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | _ticker = createTicker((duration) async { 30 | final cursorScreenPoint = 31 | await ScreenRetriever.instance.getCursorScreenPoint(); 32 | final color = await _plugin.captureScreenColor( 33 | cursorScreenPoint.dx, 34 | cursorScreenPoint.dy, 35 | ); 36 | if (color == null) return; 37 | 38 | if (!mounted) return; 39 | setState(() { 40 | _color = color; 41 | }); 42 | }); 43 | _ticker.start(); 44 | } 45 | 46 | @override 47 | void dispose() { 48 | _ticker.dispose(); 49 | super.dispose(); 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return ColoredBox(color: _color); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The Flutter tooling requires that developers have CMake 3.10 or later 2 | # installed. You should not increase this version, as doing so will cause 3 | # the plugin to fail to compile for some customers of the plugin. 4 | cmake_minimum_required(VERSION 3.10) 5 | 6 | # Project-level configuration. 7 | set(PROJECT_NAME "flutter_screen_capture") 8 | project(${PROJECT_NAME} LANGUAGES CXX) 9 | 10 | # This value is used when generating builds using this plugin, so it must 11 | # not be changed. 12 | set(PLUGIN_NAME "flutter_screen_capture_plugin") 13 | 14 | # Define the plugin library target. Its name must not be changed (see comment 15 | # on PLUGIN_NAME above). 16 | # 17 | # Any new source files that you add to the plugin should be added here. 18 | add_library(${PLUGIN_NAME} SHARED 19 | "flutter_screen_capture_plugin.cc" 20 | ) 21 | 22 | # Apply a standard set of build settings that are configured in the 23 | # application-level CMakeLists.txt. This can be removed for plugins that want 24 | # full control over build settings. 25 | apply_standard_settings(${PLUGIN_NAME}) 26 | 27 | # Symbols are hidden by default to reduce the chance of accidental conflicts 28 | # between plugins. This should not be removed; any symbols that should be 29 | # exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. 30 | set_target_properties(${PLUGIN_NAME} PROPERTIES 31 | CXX_VISIBILITY_PRESET hidden) 32 | target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) 33 | 34 | # Source include directories and library dependencies. Add any plugin-specific 35 | # dependencies here. 36 | target_include_directories(${PLUGIN_NAME} INTERFACE 37 | "${CMAKE_CURRENT_SOURCE_DIR}/include") 38 | target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) 39 | target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) 40 | 41 | # List of absolute paths to libraries that should be bundled with the plugin. 42 | # This list could contain prebuilt libraries, or libraries created by an 43 | # external build triggered from this build file. 44 | set(flutter_screen_capture_bundled_libraries 45 | "" 46 | PARENT_SCOPE 47 | ) 48 | -------------------------------------------------------------------------------- /linux/flutter_screen_capture_plugin.cc: -------------------------------------------------------------------------------- 1 | #include "include/flutter_screen_capture/flutter_screen_capture_plugin.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | GdkPixbuf *CaptureScreenArea(int64_t x, int64_t y, int64_t width, int64_t height) 9 | { 10 | // TODO 11 | // The passed width and height args, contains the resolution of Primary monitor 12 | // If user wants to capture the whole display, including the secondary monitors, 13 | // width and height can be calculated using 14 | 15 | // gdk_window_get_width(window) 16 | // gdk_window_get_height(window) 17 | GdkPixbuf *screenshot = nullptr; 18 | GdkPixbuf *screenShotWithAlpha = nullptr; 19 | GdkWindow *window = gdk_get_default_root_window(); 20 | screenshot = 21 | gdk_pixbuf_get_from_window(window, x, y, width, 22 | height); 23 | screenShotWithAlpha = gdk_pixbuf_add_alpha(screenshot, FALSE, 0, 0, 0); 24 | return screenShotWithAlpha; 25 | } 26 | 27 | struct _FlutterScreenCapturePlugin 28 | { 29 | GObject parent_instance; 30 | }; 31 | 32 | #define FLUTTER_SCREEN_CAPTURE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), flutter_screen_capture_plugin_get_type(), FlutterScreenCapturePlugin)) 33 | 34 | G_DEFINE_TYPE(FlutterScreenCapturePlugin, flutter_screen_capture_plugin, g_object_get_type()) 35 | 36 | static void flutter_screen_capture_plugin_dispose(GObject *object) 37 | { 38 | G_OBJECT_CLASS(flutter_screen_capture_plugin_parent_class)->dispose(object); 39 | } 40 | 41 | static void flutter_screen_capture_plugin_class_init(FlutterScreenCapturePluginClass *klass) 42 | { 43 | G_OBJECT_CLASS(klass)->dispose = flutter_screen_capture_plugin_dispose; 44 | } 45 | 46 | static void flutter_screen_capture_plugin_init(FlutterScreenCapturePlugin *self) {} 47 | 48 | // Called when a method call is received from Flutter. 49 | static void flutter_screen_capture_plugin_handle_method_call( 50 | FlutterScreenCapturePlugin *self, 51 | FlMethodCall *method_call) 52 | { 53 | const gchar *method = fl_method_call_get_name(method_call); 54 | FlValue *args = fl_method_call_get_args(method_call); 55 | 56 | g_autoptr(FlMethodResponse) response; 57 | if (strcmp(method, "captureScreenArea") == 0) 58 | { 59 | auto capturedScreenArea = CaptureScreenArea( 60 | fl_value_get_int(fl_value_lookup_string(args, "x")), 61 | fl_value_get_int(fl_value_lookup_string(args, "y")), 62 | fl_value_get_int(fl_value_lookup_string(args, "width")), 63 | fl_value_get_int(fl_value_lookup_string(args, "height"))); 64 | if (capturedScreenArea == nullptr) 65 | { 66 | response = FL_METHOD_RESPONSE(fl_method_error_response_new( 67 | "captureScreenArea failed", 68 | nullptr, 69 | nullptr)); 70 | } 71 | else 72 | { 73 | FlValue *dict = fl_value_new_map(); 74 | fl_value_set_string_take( 75 | dict, 76 | "buffer", 77 | fl_value_new_uint8_list( 78 | gdk_pixbuf_read_pixels(capturedScreenArea), 79 | gdk_pixbuf_get_byte_length(capturedScreenArea))); 80 | fl_value_set_string_take( 81 | dict, 82 | "width", 83 | fl_value_new_int(gdk_pixbuf_get_width(capturedScreenArea))); 84 | fl_value_set_string_take( 85 | dict, 86 | "height", 87 | fl_value_new_int(gdk_pixbuf_get_height(capturedScreenArea))); 88 | fl_value_set_string_take( 89 | dict, 90 | "bitsPerPixel", 91 | fl_value_new_int(gdk_pixbuf_get_bits_per_sample(capturedScreenArea))); 92 | fl_value_set_string_take( 93 | dict, 94 | "bytesPerPixel", 95 | fl_value_new_int(gdk_pixbuf_get_n_channels(capturedScreenArea))); 96 | 97 | g_object_unref(capturedScreenArea); 98 | 99 | response = FL_METHOD_RESPONSE(fl_method_success_response_new(dict)); 100 | } 101 | } 102 | else 103 | { 104 | response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new()); 105 | } 106 | fl_method_call_respond(method_call, response, nullptr); 107 | } 108 | 109 | static void method_call_cb( 110 | FlMethodChannel *channel, 111 | FlMethodCall *method_call, 112 | gpointer user_data) 113 | { 114 | FlutterScreenCapturePlugin *plugin = FLUTTER_SCREEN_CAPTURE_PLUGIN(user_data); 115 | flutter_screen_capture_plugin_handle_method_call(plugin, method_call); 116 | } 117 | 118 | void flutter_screen_capture_plugin_register_with_registrar(FlPluginRegistrar *registrar) 119 | { 120 | FlutterScreenCapturePlugin *plugin = FLUTTER_SCREEN_CAPTURE_PLUGIN( 121 | g_object_new( 122 | flutter_screen_capture_plugin_get_type(), 123 | nullptr)); 124 | 125 | g_autoptr(FlStandardMethodCodec) 126 | codec = fl_standard_method_codec_new(); 127 | g_autoptr(FlMethodChannel) 128 | channel = fl_method_channel_new( 129 | fl_plugin_registrar_get_messenger(registrar), 130 | "flutter_screen_capture", 131 | FL_METHOD_CODEC(codec)); 132 | fl_method_channel_set_method_call_handler( 133 | channel, 134 | method_call_cb, 135 | g_object_ref(plugin), 136 | g_object_unref); 137 | 138 | g_object_unref(plugin); 139 | } 140 | -------------------------------------------------------------------------------- /linux/include/flutter_screen_capture/flutter_screen_capture_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_H_ 2 | #define FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_H_ 3 | 4 | #include 5 | 6 | G_BEGIN_DECLS 7 | 8 | #ifdef FLUTTER_PLUGIN_IMPL 9 | #define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default"))) 10 | #else 11 | #define FLUTTER_PLUGIN_EXPORT 12 | #endif 13 | 14 | typedef struct _FlutterScreenCapturePlugin FlutterScreenCapturePlugin; 15 | typedef struct { 16 | GObjectClass parent_class; 17 | } FlutterScreenCapturePluginClass; 18 | 19 | FLUTTER_PLUGIN_EXPORT GType flutter_screen_capture_plugin_get_type(); 20 | 21 | FLUTTER_PLUGIN_EXPORT void flutter_screen_capture_plugin_register_with_registrar( 22 | FlPluginRegistrar* registrar 23 | ); 24 | 25 | G_END_DECLS 26 | 27 | #endif // FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_H_ 28 | -------------------------------------------------------------------------------- /macos/Classes/FlutterScreenCapturePlugin.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | func resize( 5 | image: CGImage, 6 | ratio: Float 7 | ) -> CGImage? { 8 | let newWidth = Int(Float(image.width) / ratio) 9 | let newHeight = Int(Float(image.height) / ratio) 10 | let bitsPerComponent = image.bitsPerComponent // usually 8 11 | let bytesPerPixel = image.bitsPerPixel / bitsPerComponent // usually 4 12 | let bytesPerRow = newWidth * bytesPerPixel 13 | guard let colorSpace = image.colorSpace else { return nil } 14 | guard let context = CGContext( 15 | data: nil, 16 | width: newWidth, 17 | height: newHeight, 18 | bitsPerComponent: bitsPerComponent, 19 | bytesPerRow: bytesPerRow, 20 | space: colorSpace, 21 | bitmapInfo: image.bitmapInfo.rawValue) 22 | else { return nil } 23 | // draw image to context (resizing it) 24 | context.interpolationQuality = .default 25 | context.draw( 26 | image, 27 | in: CGRect( 28 | x: 0, 29 | y: 0, 30 | width: newWidth, 31 | height: newHeight)) 32 | // extract resulting image from context 33 | return context.makeImage() 34 | } 35 | 36 | struct CapturedScreenArea { 37 | let buffer: Data 38 | let width: Int 39 | let height: Int 40 | let bitsPerPixel: Int 41 | let bytesPerPixel: Int 42 | } 43 | 44 | func captureScreenArea( 45 | x: Int, 46 | y: Int, 47 | width: Int, 48 | height: Int 49 | ) -> CapturedScreenArea? { 50 | let rect = CGRect( 51 | x: x, 52 | y: y, 53 | width: width, 54 | height: height) 55 | 56 | guard var image = CGWindowListCreateImage( 57 | rect, 58 | // CGWindowListOption.optionOnScreenOnly, 59 | CGWindowListOption.optionAll, 60 | kCGNullWindowID, 61 | CGWindowImageOption.bestResolution) 62 | else { 63 | return nil 64 | } 65 | 66 | // For example on retina displays, this value could be 2.0 or 3.0 67 | let screenPixelRatio = Float(image.width) / Float(width); 68 | if let resizedImage = resize(image: image, ratio: screenPixelRatio) { 69 | image = resizedImage 70 | } 71 | 72 | guard let imageData = image.dataProvider?.data else { 73 | return nil 74 | } 75 | guard let imageDataPtr = CFDataGetBytePtr(imageData) else { 76 | return nil 77 | } 78 | return CapturedScreenArea( 79 | buffer: Data( 80 | bytes: imageDataPtr, 81 | count: CFDataGetLength(imageData)), 82 | width: image.width, 83 | height: image.height, 84 | bitsPerPixel: image.bitsPerPixel, 85 | bytesPerPixel: image.bitsPerPixel / 8) 86 | } 87 | 88 | let invalidArgumentsError = FlutterError( 89 | code: "INVALID_ARGUMENTS", 90 | message: "Invalid arguments", 91 | details: nil 92 | ) 93 | 94 | public class FlutterScreenCapturePlugin: NSObject, FlutterPlugin { 95 | public static func register(with registrar: FlutterPluginRegistrar) { 96 | let channel = FlutterMethodChannel( 97 | name: "flutter_screen_capture", 98 | binaryMessenger: registrar.messenger) 99 | let instance = FlutterScreenCapturePlugin() 100 | registrar.addMethodCallDelegate(instance, channel: channel) 101 | } 102 | 103 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 104 | switch call.method { 105 | case "captureScreenArea": 106 | guard let args = call.arguments as? [String: Any] else { 107 | result(invalidArgumentsError) 108 | return 109 | } 110 | guard let x = args["x"] as? Int else { 111 | result(invalidArgumentsError) 112 | return 113 | } 114 | guard let y = args["y"] as? Int else { 115 | result(invalidArgumentsError) 116 | return 117 | } 118 | guard let width = args["width"] as? Int else { 119 | result(invalidArgumentsError) 120 | return 121 | } 122 | guard let height = args["height"] as? Int else { 123 | result(invalidArgumentsError) 124 | return 125 | } 126 | if let capturedScreenArea = captureScreenArea( 127 | x: x, 128 | y: y, 129 | width: width, 130 | height: height) { 131 | result([ 132 | "buffer": capturedScreenArea.buffer, 133 | "width": capturedScreenArea.width, 134 | "height": capturedScreenArea.height, 135 | "bitsPerPixel": capturedScreenArea.bitsPerPixel, 136 | "bytesPerPixel": capturedScreenArea.bytesPerPixel 137 | ]) 138 | } else { 139 | result(nil) 140 | } 141 | default: 142 | result(FlutterMethodNotImplemented) 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /macos/flutter_screen_capture.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint flutter_screen_capture.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'flutter_screen_capture' 7 | s.version = '0.0.1' 8 | s.summary = 'A new Flutter plugin project.' 9 | s.description = <<-DESC 10 | A new Flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | 16 | s.source = { :path => '.' } 17 | s.source_files = 'Classes/**/*' 18 | s.dependency 'FlutterMacOS' 19 | 20 | s.platform = :osx, '10.11' 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 22 | s.swift_version = '5.0' 23 | end 24 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_screen_capture 2 | description: A plugin to capture the entire screen or part of it on desktop platforms. 3 | version: 1.2.3 4 | repository: https://github.com/albemala/flutter_screen_capture 5 | 6 | funding: 7 | - https://github.com/sponsors/albemala 8 | - https://www.buymeacoffee.com/albemala 9 | 10 | environment: 11 | sdk: ">=3.2.0 <4.0.0" 12 | flutter: ">=3.16.0" 13 | 14 | dependencies: 15 | flutter: 16 | sdk: flutter 17 | 18 | image: ^4.3.0 19 | screen_retriever: ^0.2.0 20 | 21 | dev_dependencies: 22 | flutter_test: 23 | sdk: flutter 24 | 25 | very_good_analysis: ^6.0.0 26 | 27 | flutter: 28 | plugin: 29 | platforms: 30 | linux: 31 | pluginClass: FlutterScreenCapturePlugin 32 | macos: 33 | pluginClass: FlutterScreenCapturePlugin 34 | windows: 35 | pluginClass: FlutterScreenCapturePluginCApi 36 | -------------------------------------------------------------------------------- /scripts/publish.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # How to use: bash scripts/publish.bash 4 | 5 | flutter pub get 6 | dart format . 7 | dart pub publish 8 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The Flutter tooling requires that developers have a version of Visual Studio 2 | # installed that includes CMake 3.14 or later. You should not increase this 3 | # version, as doing so will cause the plugin to fail to compile for some 4 | # customers of the plugin. 5 | cmake_minimum_required(VERSION 3.14) 6 | 7 | # Project-level configuration. 8 | set(PROJECT_NAME "flutter_screen_capture") 9 | project(${PROJECT_NAME} LANGUAGES CXX) 10 | 11 | # This value is used when generating builds using this plugin, so it must 12 | # not be changed 13 | set(PLUGIN_NAME "flutter_screen_capture_plugin") 14 | 15 | # Any new source files that you add to the plugin should be added here. 16 | list(APPEND PLUGIN_SOURCES 17 | "flutter_screen_capture_plugin.cpp" 18 | "flutter_screen_capture_plugin.h" 19 | ) 20 | 21 | # Define the plugin library target. Its name must not be changed (see comment 22 | # on PLUGIN_NAME above). 23 | add_library(${PLUGIN_NAME} SHARED 24 | "include/flutter_screen_capture/flutter_screen_capture_plugin_c_api.h" 25 | "flutter_screen_capture_plugin_c_api.cpp" 26 | ${PLUGIN_SOURCES} 27 | ) 28 | 29 | # Apply a standard set of build settings that are configured in the 30 | # application-level CMakeLists.txt. This can be removed for plugins that want 31 | # full control over build settings. 32 | apply_standard_settings(${PLUGIN_NAME}) 33 | 34 | # Symbols are hidden by default to reduce the chance of accidental conflicts 35 | # between plugins. This should not be removed; any symbols that should be 36 | # exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. 37 | set_target_properties(${PLUGIN_NAME} PROPERTIES 38 | CXX_VISIBILITY_PRESET hidden) 39 | target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) 40 | 41 | # Source include directories and library dependencies. Add any plugin-specific 42 | # dependencies here. 43 | target_include_directories(${PLUGIN_NAME} INTERFACE 44 | "${CMAKE_CURRENT_SOURCE_DIR}/include") 45 | target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) 46 | 47 | # List of absolute paths to libraries that should be bundled with the plugin. 48 | # This list could contain prebuilt libraries, or libraries created by an 49 | # external build triggered from this build file. 50 | set(flutter_screen_capture_bundled_libraries 51 | "" 52 | PARENT_SCOPE 53 | ) 54 | -------------------------------------------------------------------------------- /windows/flutter_screen_capture_plugin.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_screen_capture_plugin.h" 2 | 3 | // This must be included before many other Windows headers. 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace flutter_screen_capture { 14 | 15 | // static 16 | void FlutterScreenCapturePlugin::RegisterWithRegistrar( 17 | flutter::PluginRegistrarWindows* registrar) 18 | { 19 | auto channel = std::make_unique>( 20 | registrar->messenger(), 21 | "flutter_screen_capture", 22 | &flutter::StandardMethodCodec::GetInstance() 23 | ); 24 | 25 | auto plugin = std::make_unique(); 26 | 27 | channel->SetMethodCallHandler( 28 | [plugin_pointer = plugin.get()](const auto& call, auto result) { 29 | HandleMethodCall(call, std::move(result)); 30 | } 31 | ); 32 | 33 | registrar->AddPlugin(std::move(plugin)); 34 | } 35 | 36 | FlutterScreenCapturePlugin::FlutterScreenCapturePlugin() = default; 37 | 38 | FlutterScreenCapturePlugin::~FlutterScreenCapturePlugin() = default; 39 | 40 | void FlutterScreenCapturePlugin::HandleMethodCall( 41 | const flutter::MethodCall& method_call, 42 | std::unique_ptr> result) 43 | { 44 | if (method_call.method_name()=="captureScreenArea") { 45 | const auto& args = std::get(*method_call.arguments()); 46 | auto x = std::get(args.at(flutter::EncodableValue("x"))); 47 | auto y = std::get(args.at(flutter::EncodableValue("y"))); 48 | auto width = std::get(args.at(flutter::EncodableValue("width"))); 49 | auto height = std::get(args.at(flutter::EncodableValue("height"))); 50 | 51 | auto capturedScreenArea = CaptureScreenArea(x, y, width, height); 52 | 53 | flutter::EncodableMap dict; 54 | dict[flutter::EncodableValue("buffer")] = flutter::EncodableValue(capturedScreenArea.buffer); 55 | dict[flutter::EncodableValue("width")] = flutter::EncodableValue(capturedScreenArea.width); 56 | dict[flutter::EncodableValue("height")] = flutter::EncodableValue(capturedScreenArea.height); 57 | dict[flutter::EncodableValue("bitsPerPixel")] = flutter::EncodableValue(capturedScreenArea.bitsPerPixel); 58 | dict[flutter::EncodableValue("bytesPerPixel")] = flutter::EncodableValue(capturedScreenArea.bytesPerPixel); 59 | result->Success(dict); 60 | } 61 | else { 62 | result->NotImplemented(); 63 | } 64 | } 65 | 66 | CapturedScreenArea FlutterScreenCapturePlugin::CaptureScreenArea( 67 | int x, 68 | int y, 69 | int width, 70 | int height) 71 | { 72 | // Get the device context of the screen 73 | HDC screen = GetDC(nullptr); 74 | // Create a device context to use 75 | HDC screenMem = CreateCompatibleDC(screen); 76 | // Create a bitmap compatible with the screen device context 77 | HBITMAP dib = CreateCompatibleBitmap(screen, width, height); 78 | // Select the bitmap into the device context 79 | SelectObject(screenMem, dib); 80 | // Copy the bits from the screen device context into the bitmap device context 81 | BitBlt(screenMem, 0, 0, width, height, screen, x, y, SRCCOPY); 82 | 83 | BITMAPINFO bi; 84 | bi.bmiHeader.biSize = sizeof(bi.bmiHeader); 85 | bi.bmiHeader.biWidth = width; 86 | bi.bmiHeader.biHeight = -height; // Non-cartesian 87 | bi.bmiHeader.biPlanes = 1; 88 | bi.bmiHeader.biBitCount = 32; 89 | bi.bmiHeader.biCompression = BI_RGB; 90 | bi.bmiHeader.biSizeImage = (4*width*height); 91 | bi.bmiHeader.biXPelsPerMeter = 0; 92 | bi.bmiHeader.biYPelsPerMeter = 0; 93 | bi.bmiHeader.biClrUsed = 0; 94 | bi.bmiHeader.biClrImportant = 0; 95 | 96 | CapturedScreenArea capturedScreenArea; 97 | capturedScreenArea.buffer = std::vector(4*width*height); 98 | capturedScreenArea.width = width; 99 | capturedScreenArea.height = height; 100 | capturedScreenArea.bitsPerPixel = 32; 101 | capturedScreenArea.bytesPerPixel = 4; 102 | 103 | // Get the bitmap bits 104 | GetDIBits(screenMem, dib, 0, height, capturedScreenArea.buffer.data(), &bi, DIB_RGB_COLORS); 105 | 106 | ReleaseDC(nullptr, screen); 107 | DeleteObject(dib); 108 | DeleteDC(screenMem); 109 | 110 | return capturedScreenArea; 111 | } 112 | 113 | } // namespace flutter_screen_capture 114 | -------------------------------------------------------------------------------- /windows/flutter_screen_capture_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_H_ 2 | #define FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include "flutter/encodable_value.h" 10 | 11 | namespace flutter_screen_capture { 12 | 13 | struct CapturedScreenArea { 14 | std::vector buffer; 15 | int width; 16 | int height; 17 | int bitsPerPixel; 18 | int bytesPerPixel; 19 | }; 20 | 21 | class FlutterScreenCapturePlugin : public flutter::Plugin { 22 | public: 23 | static void RegisterWithRegistrar(flutter::PluginRegistrarWindows* registrar); 24 | 25 | FlutterScreenCapturePlugin(); 26 | 27 | ~FlutterScreenCapturePlugin() override; 28 | 29 | // Disallow copy and assign. 30 | FlutterScreenCapturePlugin(const FlutterScreenCapturePlugin&) = delete; 31 | FlutterScreenCapturePlugin& operator=(const FlutterScreenCapturePlugin&) = delete; 32 | 33 | private: 34 | // Called when a method is called on this plugin's channel from Dart. 35 | static void HandleMethodCall( 36 | const flutter::MethodCall& method_call, 37 | std::unique_ptr> result 38 | ); 39 | 40 | static CapturedScreenArea CaptureScreenArea( 41 | int x, 42 | int y, 43 | int width, 44 | int height 45 | ); 46 | }; 47 | 48 | } // namespace flutter_screen_capture 49 | 50 | #endif // FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_H_ 51 | -------------------------------------------------------------------------------- /windows/flutter_screen_capture_plugin_c_api.cpp: -------------------------------------------------------------------------------- 1 | #include "include/flutter_screen_capture/flutter_screen_capture_plugin_c_api.h" 2 | 3 | #include 4 | 5 | #include "flutter_screen_capture_plugin.h" 6 | 7 | void FlutterScreenCapturePluginCApiRegisterWithRegistrar(FlutterDesktopPluginRegistrarRef registrar) 8 | { 9 | flutter_screen_capture::FlutterScreenCapturePlugin::RegisterWithRegistrar( 10 | flutter::PluginRegistrarManager::GetInstance()->GetRegistrar(registrar) 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /windows/include/flutter_screen_capture/flutter_screen_capture_plugin_c_api.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_C_API_H_ 2 | #define FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_C_API_H_ 3 | 4 | #include 5 | 6 | #ifdef FLUTTER_PLUGIN_IMPL 7 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) 8 | #else 9 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) 10 | #endif 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | FLUTTER_PLUGIN_EXPORT void FlutterScreenCapturePluginCApiRegisterWithRegistrar( 17 | FlutterDesktopPluginRegistrarRef registrar); 18 | 19 | #if defined(__cplusplus) 20 | } // extern "C" 21 | #endif 22 | 23 | #endif // FLUTTER_PLUGIN_FLUTTER_SCREEN_CAPTURE_PLUGIN_C_API_H_ 24 | --------------------------------------------------------------------------------