Skip to content

How to use images? #1

Open
Open

Description

@sirlan-ff00ff

The README contains:

Use the image package.

But this library doesn't seem to use any functions that take an Image from the image library, nor explains how to use them with raylib functions.

While the raylib image functions themselves have not been wrapped to Dart (i.e. LoadImage taking a Pointer<Char>, and others like IsImageValid which could be made as a method), so I assume that the goal is to try using raylib's image functions the least as possible?

Mainly asking as I'm willing to contribute to this library

Activity

  1. dzylikecode commented on Jan 4, 2026

    @dzylikecode
    Owner

    Sorry, GitHub didn’t notify me about your issue, so I didn’t see it. I’ve been busy with my graduation recently, so I haven’t continued working on this library. If you’d like to contribute, I’d be very happy to welcome it.

  2. dzylikecode commented on Jan 4, 2026

    @dzylikecode
    Owner

    Image

    This is my plan:

    • cdart is a pure Dart package specifically designed to handle C APIs, such as C functions like cosf, fprintf, and similar.
    • Subsequent support will include a web interface, with WebAssembly (Wasm) integrated into it.
    • Provide a better, higher-level API—for example, use vector_math for algebraic operations and the image package for image processing.
  3. dzylikecode commented on Jan 4, 2026

    @dzylikecode
    Owner
    flowchart TB
        raylib["raylib api"]
    
        raylib --> cdart
        raylib --> bindings
        raylib --> image
        raylib --> vector_math
    
        cdart --> sprintf
        cdart --> cosf
        cdart --> others["..."]
    
        bindings --> wasm
        bindings --> dll
    
    Loading
  4. dzylikecode commented on Jan 4, 2026

    @dzylikecode
    Owner

    If you’re willing to collaborate, I’d be very happy to work together to make this project successful.

  5. sirlan-ff00ff commented on Jan 4, 2026

    @sirlan-ff00ff
    Author

    Alright, so in this case the plan is to when defining the bindings, providing the same interface but using the vector_math and image library types? Something kinda like (very roughly)?

    import 'package:raylib_dart/raylib_dart.dart' as ray;
    import 'package:image/image.dart' as img;
    //...
    img.Image image = img.decodeJpg(File('test.jpg').readAsBytesSync())!;
    ray.Texture texture = ray.LoadTextureFromImage(image);

    trying to understand how they'd behave together

  6. dzylikecode commented on Jan 4, 2026

    @dzylikecode
    Owner

    Yes, use img.Image to replace ray.Image. The core idea is to create a converter between them that is invisible to the user.

    ray.Texture LoadTextureFromImage(img.Image image) {
      return ray.LoadTextureFromImage(image.toRayImage());
    }

    Then expose LoadTextureFromImage for user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions