openframeworks / openframeworks/openFrameworks

ofPixelsRef no longer can be used with const methods.

Open
#3,241 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core development-strategy prelim-analysis section-2D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

It looks like we can't have const ofPixelsRef getPixelsRef() since we merged the const PR into OF.

I got compile errors forcing me to change my methods to

        const ofPixels& getPixelsRef() const;

see:
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/video/ofVideoGrabber.h#L67

The issue I guess with this is that ofPixelsRef encouraged users to use the typedef ofPixelsRef type so it helped encouraged copy by reference instead of a full copy.

Curious what a good solution to this is.

I guess since there is a const and non-const version of that function we could do.

        ofPixelsRef getPixelsRef();
        const ofPixels& getPixelsRef() const;

ping @bakercp @arturoc

Contributor guide

Open the contributing guide

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 with the getPixelsRef declaration in libs/openFrameworks/video/ofVideoGrabber.h at the referenced line, and compare the const and non-const forms introduced by the const change. Check how ofPixelsRef is used in nearby video APIs; done means establishing a consistent const-compatible return type without breaking the reference-oriented usage described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.