Click here to Skip to main content
14,976,940 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Thought of the Day Pin
megaadam22-Jun-21 7:11
professionalmegaadam22-Jun-21 7:11 
GeneralRe: Thought of the Day Pin
jeron122-Jun-21 7:25
Memberjeron122-Jun-21 7:25 
GeneralBrave Browser & ZDNet Pin
raddevus22-Jun-21 4:59
mvaraddevus22-Jun-21 4:59 
GeneralRe: Brave Browser & ZDNet Pin
OriginalGriff22-Jun-21 5:02
mveOriginalGriff22-Jun-21 5:02 
GeneralRe: Brave Browser & ZDNet Pin
Richard Deeming22-Jun-21 5:08
mveRichard Deeming22-Jun-21 5:08 
GeneralRe: Brave Browser & ZDNet Pin
raddevus22-Jun-21 5:46
mvaraddevus22-Jun-21 5:46 
GeneralRe: Brave Browser & ZDNet Pin
DRHuff22-Jun-21 7:30
MemberDRHuff22-Jun-21 7:30 
GeneralAnalysis paralysis: Painting myself into a corner with generic programming Pin
honey the codewitch22-Jun-21 2:08
mvahoney the codewitch22-Jun-21 2:08 
Frustration.

I have an e-paper display that supports either monochrome mode with partial display updates (important for doing things like being able to show a clock on e-paper without atrocious refresh rates), or full screen only updates with 4 color grayscale.

So I need a way to switch screen modes. The problem is that different pixel types yield a different type of draw target, so my monochrome draw target must be an actual different class than my gray scale draw target.

That means:

I can't have one single function to switch screen modes, because each mode returns a different type. (not a show stopper though)

If I switch screen modes by returning a new drawing target what happens to the old one? What if you try to draw to it? I can make it error, but my concern is usability.

C++
auto target1 = e_paper.mode<1>(); // get a mode with a 1-bit grayscale pixel
// target1 is invalidated after this:
auto target2 = e_paper.mode<2>(); // get a mode with a 2-bit grayscale pixel

draw::filled_rectangle(target1,(srect16)target1.bounds(),color_max::black); // error

draw::filled_rectangle(target2,(srect16)target2.bounds(),color_max::gray); // okay


I can't figure out if that's too confusing or not.

Such is the hazard of trying to user test one's own code.

*headdesk*
Real programmers use butterflies

GeneralRe: Analysis paralysis: Painting myself into a corner with generic programming Pin
Rage22-Jun-21 2:23
professionalRage22-Jun-21 2:23 
GeneralRe: Analysis paralysis: Painting myself into a corner with generic programming Pin
Mircea Neacsu22-Jun-21 2:57
mvaMircea Neacsu22-Jun-21 2:57 
GeneralRe: Analysis paralysis: Painting myself into a corner with generic programming Pin
honey the codewitch22-Jun-21 4:40
mvahoney the codewitch22-Jun-21 4:40 
GeneralRe: Analysis paralysis: Painting myself into a corner with generic programming Pin
englebart25-Jun-21 4:49
professionalenglebart25-Jun-21 4:49 
GeneralRe: Analysis paralysis: Painting myself into a corner with generic programming Pin
honey the codewitch25-Jun-21 4:51
mvahoney the codewitch25-Jun-21 4:51 
GeneralCCC Pin
pkfox21-Jun-21 21:31
professionalpkfox21-Jun-21 21:31 
GeneralRe: CCC Pin
OriginalGriff21-Jun-21 22:12
mveOriginalGriff21-Jun-21 22:12 
GeneralRe: CCC Pin
pkfox21-Jun-21 22:19
professionalpkfox21-Jun-21 22:19 
GeneralRe: CCC Pin
OriginalGriff21-Jun-21 22:41
mveOriginalGriff21-Jun-21 22:41 
GeneralRe: CCC Pin
pkfox21-Jun-21 22:53
professionalpkfox21-Jun-21 22:53 
GeneralRe: CCC Pin
OriginalGriff21-Jun-21 23:34
mveOriginalGriff21-Jun-21 23:34 
GeneralRe: CCC Pin
musefan21-Jun-21 23:31
Membermusefan21-Jun-21 23:31 
GeneralRe: CCC Pin
pkfox22-Jun-21 0:40
professionalpkfox22-Jun-21 0:40 
GeneralRe: CCC Pin
Richard MacCutchan22-Jun-21 0:57
mveRichard MacCutchan22-Jun-21 0:57 
GeneralRe: CCC Pin
pkfox22-Jun-21 1:43
professionalpkfox22-Jun-21 1:43 
GeneralRe: CCC Pin
Richard MacCutchan22-Jun-21 1:48
mveRichard MacCutchan22-Jun-21 1:48 
GeneralRe: CCC Pin
pkfox22-Jun-21 2:51
professionalpkfox22-Jun-21 2:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.