Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: user5 on June 13, 2021, 12:20:18 pm

Title: [SOLVED] clNone etc.
Post by: user5 on June 13, 2021, 12:20:18 pm
    This concerns my recent post "clNone etc." about needing some temporary work colors as described in that post.
    The system 'color' clNone stopped working the way it used to so I can't use it anymore. In the past, an image
changed to clNone would appear to be black and a sampling of it would show up as "clNone" but later on an image
changed to clNone would appear to be white and a sampling of it would show up as clWhite.
    The solution was to create my own 'noncolors' to be used as the work colors as shown below. I simply went
outside the range of normal colors.

    nocolor1 := RGBToColor(257,257,257); 
    nocolor2 := RGBToColor(258,258,258); 
    nocolor3 := RGBToColor(259,259,259); 

    This is an odd way to do it but it works just fine and it means that the user will not have to choose work colors.
    The compiler accepts these noncolors (though it puts out a warning) and an extra benefit is the fact that no new
edging colors made by the program will ever equal any of the noncolor work colors.
    The hex value of nocolor1 is $00010101. Best regards.
Title: Re: [SOLVED] clNone etc.
Post by: winni on June 13, 2021, 12:49:51 pm
Hi!

Your  nocolors are not outside the range of colors.

The overflow bytes are wrapped.
256 is wapped to 1.

So your nocolor1 = $00010101 is just RGB 1/1/1 which is very near to clBlack.

Winni
Title: Re: [SOLVED] clNone etc.
Post by: circular on June 19, 2021, 05:19:35 pm
The most generic is probably to create a 2d array of booleans / bits that says what pixel is masked
TinyPortal © 2005-2018