Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] Offset calculation in AddText is incorrect #144

Open
Curstantine opened this issue Jan 20, 2025 · 0 comments
Open

[Bug report] Offset calculation in AddText is incorrect #144

Curstantine opened this issue Jan 20, 2025 · 0 comments

Comments

@Curstantine
Copy link

Curstantine commented Jan 20, 2025

Version

1.6.0

Platforms

Android

Device Model

Google Pixel 8 (A15), Xiaomi Redmi 12 (A15)

flutter info

[✓] Flutter (Channel stable, 3.27.2, on Microsoft Windows [Version 10.0.22631.4751], locale en-US)
    • Flutter version 3.27.2 on channel stable at C:\SDKs\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 68415ad1d9 (7 days ago), 2025-01-13 10:22:03 -0800
    • Engine revision e672b006cb
    • Dart version 3.6.1
    • DevTools version 2.40.2

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    • Android SDK at C:\Users\Curstantine\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.12.35527.113
    • Windows 10 SDK version 10.0.22000.0
    ✗ Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[✓] Android Studio (version 2024.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2024.3.1.1
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 243.23177

[✓] VS Code (version 1.96.4)
    • VS Code at C:\Users\Curstantine\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.102.0

[✓] Connected device (3 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22631.4751]
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 132.0.2957.115

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 3 categories.

How to reproduce?

  1. Install flutter_image_editor any version after 1.1.0.
  2. Add a text through the AddTextOption..addText, and set an offset of more than 0 (either of one dx, dy)
  3. Set the image below as the source image and match the offsets (each black text in the source counts the px from left, red calculates from top.

Source image

What happens:
Image

Example code (optional)

const int size = 48;
final ImageEditorOption option = ImageEditorOption();
final AddTextOption textOption = AddTextOption();

textOption.addText(
    EditorText(
        offset: const Offset(300, 0),
        text: "Hi",
        fontSizePx: size,
        textColor: const Color(0xFF995555),
        fontName: "Rubik Medium",
      ),
);

option.outputFormat = const OutputFormat.png();
option.addOption(textOption);

final Uint8List u = image ?? await loadFromAsset("assets/images/test.png");
final Uint8List? tempImage = await ImageEditor.editImage(
    image: u,
    imageEditorOption: option,
);
@Curstantine Curstantine changed the title [Bug report] Offset calculation is incorrect [Bug report] Offset calculation in AddText is incorrect Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant