Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
32 bit color map
#1
Code:
screen 20,32,,1

for x=0 to 255:for y = 0 to 255
r=r+1
if r=256 then g=g+1:r=0
if g=256 then b=b+1:g=0
pset (x,y),rgb(r,g,b)
next:next

This doesnt work because there are 3 rgb values and only 2 coordinates that only equal 65536 total colors, there should be a total of 16777216 colors available. but if i simply increase the x and y max values to allow more room for more colors than the colors loop themselves. So how can i get all of the colors in here...i assume i still need higher x and y coordinates, otherwise there wont be enough room.
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply
#2
256 total possible red * 256 total possible green * 256 total possible blue = 16777216 possible color variations.

You are going to run out of screen pixels before you run out of colors.

But, to loop through all color variations try something like this:

Code:
for myRED = 0 to 255
  for myGREEN = 0 to 255
    for myBLUE = 0 to 255
      rgb(myRED, myGREEN, myBLUE)
    next myBLUE
  next myGREEN
next myRED
ature has its way of warning a person away from danger: The distinct black and white coloration on a skunk, the chilling buzz of a rattlesanke, a redneck handing you his beer and saying "Watch this!"
Reply
#3
yeah I know i will run out of space, but still how would i display them all, i could use a step to remove some of the colors to make them all fit. but when i try to use all the colors it still loops itself at pixel 256 on the screen. here is what i just tried:

Code:
screen 20,32,,1
for r=0 to 255
  for g=0 to 255
    for b=0 to 255
      x=x+1
      if x>1024 then x=0:y=y+1
      pset (x,y),rgb(r,g,b)
    next
  next
next
sleep
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply
#4
Change to this to see what is not being dispalyed on the screen:

Code:
screen 20,32
for r=0 to 255
  for g=0 to 255
    for b=0 to 255
      x=x+1
      if x>1024 then
        x=0
        y=y+1
        if y>768 then y = 0
      end if
      pset (x,y),rgb(r,g,b)
    next
  next
next
sleep

Your "Y" was dropping off the bottom of the screen.

Like I said, you were running out of screen before you ran out of colors.
ature has its way of warning a person away from danger: The distinct black and white coloration on a skunk, the chilling buzz of a rattlesanke, a redneck handing you his beer and saying "Watch this!"
Reply
#5
Yeah it looks like that may be displaying all the colors but it is looping itself like this:

http://www-scf.usc.edu/~gossman/Image2.jpg

it loops every 256 pixels on x, i want it to display every color once with one pixel each , but it puts them into boxes
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply
#6
Well, think about what you are doing...

You are looping through 256 shades of blue then resetting the blue and increasing the green by a single shade and looping through 256 shades of blue, etc.

It appears that you are repeating the same colors over and over, but they do have a minor difference at each "block" of color.
ature has its way of warning a person away from danger: The distinct black and white coloration on a skunk, the chilling buzz of a rattlesanke, a redneck handing you his beer and saying "Watch this!"
Reply
#7
I want to do something like when Paint Sop Pro lets you select colors...i want to be able to show all the colors...each pixel representing one color, how would i do that?
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply
#8
It doesn't let you select every color anyways...it's a scaled down approximation. You'd use hue from top to bottom and lightness from left to right. It's difficult for me to explain so you're better off googling it but basically, you cover a range of colors at certain increments rather than one at a time as you're trying to do here. PSP's color picker is arranged by the order of colors in the light spectrum (the hue is represented by this). At a glance, it looks like it could contain every color possible but in fact, it only contains about 6500 unique colors. The advanced color picker dialog uses a hue wheel and a lightness/saturation matrix...top to bottom is lightness and left to right is saturation.

What you need to be working with is HSL, not RGB. Look for a conversion algorithm. Smile

EDIT: This might help ya...
http://130.113.54.154/~monger/hsl-rgb.html
http://www.easyrgb.com/math.php?MATH=M18#text18
I'd knock on wood, but my desk is particle board.
Reply
#9
Yeah, if you were not using SCREEN, but using win32 gui, you could use the CHOOSECOLOR API call in commdlg32.bi to use windows color choosing dialog.
ature has its way of warning a person away from danger: The distinct black and white coloration on a skunk, the chilling buzz of a rattlesanke, a redneck handing you his beer and saying "Watch this!"
Reply
#10
Quote:Yeah, if you were not using SCREEN, but using win32 gui, you could use the CHOOSECOLOR API call in commdlg32.bi to use windows color choosing dialog.

well i dont want some function to do it for me...I will check out those links though

even still i should be able to display all the combinations of R G B values even if they dont all fit on the screen

**Edit**

the color selector thing was just to give you an idea of what i wanted it to look like
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)