コード例 #1
0
ファイル: Pixel.cs プロジェクト: MisterMarty/bahn-gz-editor
        public static void SetProperty(ref uint pixel, PixelProperty property)
        {
            uint prop = (uint)property;

            // ((prop & Constants.ColorLogic) == Constants.ColorLogic) => If prop uses RGB dataspace...
            //                                                            ...then return the property alone as data. (E.g. PixelProperty.Transparent always has the same value)

            // (pixel & 0x00FFFFFF) | prop                             => Else, take the right 3 byte (RGB data) and add the property data in.
            //                                                            In this case, prop only uses the left-most byte
            pixel = (((prop & Constants.ColorLogic) == Constants.ColorLogic) ? prop : (pixel & 0x00FFFFFF) | prop);
        }
コード例 #2
0
ファイル: Pixel.cs プロジェクト: MisterMarty/bahn-gz-editor
        public static uint Create(byte red, byte green, byte blue, PixelProperty property = PixelProperty.None)
        {
            uint result = (uint)property;

            if (UsesRgb(result))
            {
                result |= ((uint)blue);
                result |= ((uint)green << 8);
                result |= ((uint)red << 16);
            }
            return(result);
        }