/// <summary>
        /// Возвращает изображение по цветовым каналам.
        /// Параметр "color" - необходимый канал.
        /// </summary>
        /// <param name="color"></param>
        public void ChangeColorChannel(ColorChannelType color)
        {
            if (color == ColorChannelType.R || color == ColorChannelType.G || color == ColorChannelType.B)
            {
                for (i = 0; i < PixelsCount; i++)
                {
                    Pixels[0] = PixelsBuffer[(int)color];
                    Pixels[1] = PixelsBuffer[(int)color];
                    Pixels[2] = PixelsBuffer[(int)color];

                    Pixels += Channels;
                    PixelsBuffer += Channels;
                }
                Pixels -= PixelsCountWithChannels;
                PixelsBuffer -= PixelsCountWithChannels;
            }
            if (color == ColorChannelType.RGB)
            {
                for (i = 0; i < PixelsCount; i++)
                {
                    Pixels[0] = PixelsBuffer[0];
                    Pixels[1] = PixelsBuffer[1];
                    Pixels[2] = PixelsBuffer[2];

                    Pixels += Channels;
                    PixelsBuffer += Channels;
                }

                Pixels -= PixelsCountWithChannels;
                PixelsBuffer -= PixelsCountWithChannels;
            }
            Layers.CurrentLayer.Foreground.ApplyChanges();
        }
示例#2
0
 /// <summary>
 ///   Set the color channel of oObject to the color specified.
 ///   - oObject: the object for which you are changing the color.
 ///   Can be a creature that has color information (i.e. the playable races).
 ///   - nColorChannel: The color channel that you want to set the color value of.
 ///   COLOR_CHANNEL_SKIN
 ///   COLOR_CHANNEL_HAIR
 ///   COLOR_CHANNEL_TATTOO_1
 ///   COLOR_CHANNEL_TATTOO_2
 ///   - nColorValue: The color you want to set (0-175).
 /// </summary>
 public static void SetColor(uint oObject, ColorChannelType nColorChannel, int nColorValue)
 {
     Internal.NativeFunctions.StackPushInteger(nColorValue);
     Internal.NativeFunctions.StackPushInteger(nColorChannel.InternalValue);
     Internal.NativeFunctions.StackPushObject(oObject);
     Internal.NativeFunctions.CallBuiltIn(844);
 }
示例#3
0
 /// <summary>
 ///   Get the Color of oObject from the color channel specified.
 ///   - oObject: the object from which you are obtaining the color.
 ///   Can be a creature that has color information (i.e. the playable races).
 ///   - nColorChannel: The color channel that you want to get the color value of.
 ///   COLOR_CHANNEL_SKIN
 ///   COLOR_CHANNEL_HAIR
 ///   COLOR_CHANNEL_TATTOO_1
 ///   COLOR_CHANNEL_TATTOO_2
 ///   * Returns -1 on error.
 /// </summary>
 public static int GetColor(uint oObject, ColorChannelType nColorChannel)
 {
     Internal.NativeFunctions.StackPushInteger(nColorChannel.InternalValue);
     Internal.NativeFunctions.StackPushObject(oObject);
     Internal.NativeFunctions.CallBuiltIn(843);
     return(Internal.NativeFunctions.StackPopInteger());
 }
示例#4
0
        private void colors_listView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Layers.CurrentLayer != null)
            {
                if (colors_listView.SelectedItems.Count != 0)
                {
                    Layers.CurrentLayer.Foreground = new Picture(Layers.CurrentLayer.Foreground.OriginalImage);
                    effects = new Effects();

                    switch (colors_listView.SelectedIndices[0])
                    {
                    case 0:
                        selectedColor = ColorChannelType.RGB;
                        break;

                    case 1:
                        selectedColor = ColorChannelType.R;
                        break;

                    case 2:
                        selectedColor = ColorChannelType.G;
                        break;

                    case 3:
                        selectedColor = ColorChannelType.B;
                        break;
                    }
                    effects.ChangeColorChannel(selectedColor);

                    effects          = new Effects();
                    pictureBox.Image = Layers.CurrentLayer.Foreground.EditImage;
                }
            }
        }
示例#5
0
 private void ColorChannelChange()
 {
     if (selectedColor != ColorChannelType.RGB)
     {
         effects.MergeColorChannel(selectedColor);
         selectedColor = ColorChannelType.RGB;
     }
     effects = new Effects();
     Layers.CurrentLayer.Foreground = new Picture(Layers.CurrentLayer.Foreground.EditImage);
     pictureBox.Image = Layers.CurrentLayer.Foreground.EditImage;
     pictureBox.Refresh();
 }
        /// <summary>
        /// Слияние редактируемого канала в RGB
        /// </summary>
        /// <param name="color"></param>
        public void MergeColorChannel(ColorChannelType color)
        {
            var pic = new Picture(Layers.CurrentLayer.Foreground.OriginalImage);
            byte* pixels = pic.Pixels;

            for (i = 0; i < PixelsCount; i++)
            {
                pixels[(int)color] = Pixels[(int)color];

                pixels += Channels;
                Pixels += Channels;
            }

            pixels -= PixelsCountWithChannels;
            Pixels -= PixelsCountWithChannels;

            Layers.CurrentLayer.Foreground = pic;
        }