![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I thought this would be the case, but within the ArrayList the stored value is in the form of Red,Green,Blue and so I was hoping on not having to split it into each separate entity, saving me an extra 3 lines of code
![]() Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
I don't fully understand the problem you are having however a bit of a bit of clarification of what a colour is might help.
A colour is a single numeric value and can be stored as such in your ArrayList and passed to the Line method as a single value so you could use RGB() to transform the individual R,G & B values you read from your file before storing them. The formula that the RGB function uses to calculate a colour is colour = -1 -(255-red)*65536 -(255-green)*256 -(255-blue) Actually this is the arithmetic equivalent of a much simpler logical operation involving shifts and logical ANDs. The -1 is there because a colour in .NET actually comprises 4 channels. The extra channel is termed the Alpha channel and determines the transparency of the colour. In B4PPC colours are fully opaque which is determined by the -1 value |
|
||||
|
@Agraham, Nice insight into how colour is calculated from RGB.
My ArrayList contains values like... 205,92,92 240,128,128 250,128,114 233,150,122 255,160,122 220,20,60 255,0,0 178,34,34 139,0,0 255,192,203 255,182,193 255,105,180 255,20,147 And so on. These are the X11 standard colours. I planned on using different files for different palettes, each loaded using the PalletColour ArrayList. My initial idea was to clear out the array and reload the desired colours into the array then create the palette on my form. Therefore I was quite surprised when I couldn't do Designer.Line(X1,Y1,X1+10,Y1+10,RGB(PaletteColour.Item(Index)),BF) and yet the item in the array list is formatted correctly with three comma separated values to form an RGB colour. Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
Quote:
Generally it seems that a number converts to a string and a string representing a SINGLE value converts to a number. A string like yours with separated values stays a string. Actually I don't like this - I prefer a strongly typed language where you do the conversion yourself with functions like Format(). So as dzt points out RGB() requires 3 numbers as arguments while Line() requires a single number argument to represent a colour. |
|
||||
|
Thanks for the replies guys, I already understood this from Erel's response earlier.
I was just attempting to clarify to Agraham my reasoning for trying to do this. Regards, RandomCoder.
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem With Form Size | RandomCoder | Questions & Help Needed | 15 | 09-05-2008 03:03 PM |
| simple code: Draw line on the form | xiaoye.org | Code Samples & Tips | 3 | 09-04-2008 01:54 PM |
| Form color in landscape mode | HARRY | Questions & Help Needed | 8 | 03-07-2008 03:21 PM |
| Problem with VGA form.Height | willisgt | Questions & Help Needed | 2 | 03-01-2008 07:57 AM |
| Form size problem on PC? | agraham | Bug Reports | 12 | 07-05-2007 01:00 PM |