JuliaImages / JuliaImages/ImageDraw.jl

[RFC] Redesign the Drawable type

Open
#42 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

breaking
Dominant language
Julia
Stars
27
Forks
16
PR merge metrics
No merged PRs in 30d

Description

The current ImageDraw design has significantly restricted its possibility to the 2D case, and that's not good in general (even though it's the most common case).

What I have in mind is:

abstract type Drawable end

struct Point{C<:Colorant, N} <: Drawable
    pos::CartesianIndex{N}
    color::C
    thickness::Int
end

struct Polygon{C<:Colorant, N, T<:CartesianIndex} <: Drawable
    vertices::NTuple{N, T}
    border_color::C
    border_width::Int
    fill_color::C
    fill::Bool # whether we need to fill the region with color C
end

struct Layers{A:: PriorityQueue} <: Drawable
    objects::A
end

Basically, each drawable type consists of the whole information on how it can be drawn.

Layers is a simple wrapper on DataStructures.PriortyQueue that controls how individual objects are drawn in one draw call.

Point is not serving as the index, but instead as a real physical "point" with color and thickness information.

This is a draft type design, we could definitely add more information into each drawable struct.

cc: @jiviteshjain @mgautam98

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the current ImageDraw design and the existing drawing entry points, then compare them with the proposed Drawable, Point, Polygon, and Layers types. The issue is still a draft, so the scope, compatibility expectations, and completion criteria need to be agreed before implementation can begin.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-graphics
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.