Click here to Skip to main content
15,888,113 members
Home / Discussions / C#
   

C#

 
GeneralRe: Picture/Texture project Pin
fly9048-May-09 23:08
fly9048-May-09 23:08 
GeneralRe: Picture/Texture project Pin
Gabriel Hodgens8-May-09 23:14
Gabriel Hodgens8-May-09 23:14 
GeneralRe: Picture/Texture project Pin
MumbleB8-May-09 22:40
MumbleB8-May-09 22:40 
Questionprint button to print a control Pin
student19888-May-09 10:42
student19888-May-09 10:42 
AnswerRe: print button to print a control Pin
fly9048-May-09 10:47
fly9048-May-09 10:47 
GeneralRe: print button to print a control Pin
student19888-May-09 11:03
student19888-May-09 11:03 
GeneralRe: print button to print a control Pin
fly9048-May-09 11:11
fly9048-May-09 11:11 
Questionautomatic byte conversion? Pin
terradtc8-May-09 10:39
terradtc8-May-09 10:39 
I was working on some image filtering when I saw a problem in my output. After a little while I noticed two possible problems with the code after fixing one of them the output was, strangely enough, correct.

Here's a part of the code:

public struct Pixel
{
public byte r;
public byte g;
public byte b;

public static bool operator >(Pixel p1,Pixel p2)
{
return p1.r + p1.g + p1.b > p2.r + p2.g + p2.b;
}
}

Now my thought here was that since the r,g and b values are bytes, adding them could cause an overflow of the byte. For example: 128,128,128 would add up to 128 and would cause 64+64+64 to be greater then the second example since it adds up to 192 (192>128). However this does not seem to be the case, 128,128,128 seems to add up to 384 which would be impossible with a byte, so is the + operator actually changing my byte to a (u)long, (u)int or (u)short internally. Has anyone found any documentation on this issue, and can I expect this to work on any implementation of c#?
AnswerRe: automatic byte conversion? Pin
Luc Pattyn8-May-09 12:06
sitebuilderLuc Pattyn8-May-09 12:06 
GeneralRe: automatic byte conversion? Pin
terradtc8-May-09 12:31
terradtc8-May-09 12:31 
GeneralRe: automatic byte conversion? Pin
Luc Pattyn8-May-09 12:44
sitebuilderLuc Pattyn8-May-09 12:44 
GeneralRe: automatic byte conversion? Pin
terradtc8-May-09 13:05
terradtc8-May-09 13:05 
GeneralRe: automatic byte conversion? Pin
Luc Pattyn8-May-09 13:25
sitebuilderLuc Pattyn8-May-09 13:25 
Questionreading pixel's value in an image Pin
wasifmuneer8-May-09 8:53
wasifmuneer8-May-09 8:53 
AnswerRe: reading pixel's value in an image Pin
molesworth8-May-09 9:05
molesworth8-May-09 9:05 
GeneralRe: reading pixel's value in an image Pin
Dan Neely8-May-09 9:27
Dan Neely8-May-09 9:27 
AnswerRe: reading pixel's value in an image Pin
Dave Kreskowiak8-May-09 9:14
mveDave Kreskowiak8-May-09 9:14 
AnswerRe: reading pixel's value in an image Pin
terradtc8-May-09 10:50
terradtc8-May-09 10:50 
GeneralRe: reading pixel's value in an image Pin
wasifmuneer8-May-09 12:28
wasifmuneer8-May-09 12:28 
GeneralRe: reading pixel's value in an image Pin
Christian Graus8-May-09 14:53
protectorChristian Graus8-May-09 14:53 
GeneralRe: reading pixel's value in an image [modified] Pin
terradtc9-May-09 0:40
terradtc9-May-09 0:40 
Questionmsgbox show for a set time Pin
Sokka938-May-09 8:48
Sokka938-May-09 8:48 
AnswerRe: msgbox show for a set time Pin
Dave Kreskowiak8-May-09 9:00
mveDave Kreskowiak8-May-09 9:00 
AnswerRe: msgbox show for a set time Pin
Ravi Bhavnani8-May-09 11:31
professionalRavi Bhavnani8-May-09 11:31 
AnswerRe: msgbox show for a set time Pin
Atif Shahbaz8-May-09 21:05
Atif Shahbaz8-May-09 21:05 

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.