⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mycolorselect.asv

📁 前向链路的信道路径仿真 为通信事业做出点小小事情
💻 ASV
📖 第 1 页 / 共 2 页
字号:
function varargout = mycolorselect(varargin)
% MYCOLORSELECT M-file for mycolorselect.fig
%      MYCOLORSELECT, by itself, creates a new MYCOLORSELECT or raises the existing
%      singleton*.
%
%      H = MYCOLORSELECT returns the handle to a new MYCOLORSELECT or the handle to
%      the existing singleton*.
%
%      MYCOLORSELECT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MYCOLORSELECT.M with the given input arguments.
%
%      MYCOLORSELECT('Property','Value',...) creates a new MYCOLORSELECT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before mycolorselect_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to mycolorselect_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help mycolorselect

% Last Modified by GUIDE v2.5 27-Mar-2006 16:53:48

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @mycolorselect_OpeningFcn, ...
                   'gui_OutputFcn',  @mycolorselect_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before mycolorselect is made visible.
function mycolorselect_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to mycolorselect (see VARARGIN)
    %initial the slider value
    handles.textred_handle=findobj('tag','editred');
    handles.textgreen_handle=findobj('tag','editgreen');
    handles.textblue_handle=findobj('tag','editblue');
    handles.edithue_handle=findobj('tag','edithue');
    handles.editsaturation_handle=findobj('tag','editsaturation');
    handles.editvalue_handle=findobj('tag','editvalue');
    set(handles.textred_handle,'backgroundcolor',get(gcf,'color'));
    set(handles.textgreen_handle,'backgroundcolor',get(gcf,'color'));
    set(handles.textblue_handle,'backgroundcolor',get(gcf,'color'));
    set(handles.edithue_handle,'backgroundcolor',get(gcf,'color'));
    set(handles.editsaturation_handle,'backgroundcolor',get(gcf,'color'));
    set(handles.editvalue_handle,'backgroundcolor',get(gcf,'color'));
    %initial the new color edit text 
    handles.textcolorright_handle=findobj('tag','textcolorright');
    handles.textright_handle=findobj('tag','textright');
    set(handles.textcolorright_handle,'backgroundcolor',get(gcf,'color'));
    set(handles.textcolorright_handle,'string',sprintf('[%.2f %.2f %.2f]',[0 0 0]));
    set(handles.textright_handle,'backgroundcolor',[0 0 0]);
    %initial the initial color edit
    handles.textcolorleft_handle=findobj('tag','textcolorleft');
    handles.textleft_handle=findobj('tag','textleft');
    set(handles.textcolorleft_handle,'backgroundcolor',get(gcf,'color'));
    set(handles.textcolorleft_handle,'string',sprintf('[%.2f %.2f %.2f]',[0 0 0]));
    set(handles.textleft_handle,'backgroundcolor',[0 0 0]);
    %get the handles of the slider
    handles.sliderred_handle=findobj('tag','sliderred');
    handles.slidergreen_handle=findobj('tag','slidergreen');
    handles.sliderblue_handle=findobj('tag','sliderblue');
    handles.sliderhue_handle=findobj('tag','sliderhue');
    handles.slidersaturation_handle=findobj('tag','slidersaturation');
    handles.slidervalue_handle=findobj('tag','slidervalue');
% Choose default command line output for mycolorselect

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes mycolorselect wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = mycolorselect_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure

%varargout{1} = handles.output;


% --- Executes on slider movement.
function sliderred_Callback(hObject, eventdata, handles)
% hObject    handle to sliderred (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    redvalue=get(hObject,'Value');
    set(handles.textred_handle,'string',sprintf('%.2f',redvalue));
    set(handles.textright_handle,'backgroundcolor',[get(hObject,'val'),get(handles.slidergreen_handle,'val'),get(handles.sliderblue_handle,'val')])
    %set the new color value
    set(handles.textcolorright_handle,'string',sprintf('[%.2f %.2f %.2f]',[get(hObject,'val'),get(handles.slidergreen_handle,'val'),get(handles.sliderblue_handle,'val')]))
    %set the hsv
    rb=(get(handles.textright_handle,'backgroundcolor'));
    hv=rgb2hsv(rb);
    set(handles.sliderhue_handle,'val',hv(1))
    set(handles.edithue_handle,'string',sprintf('%.2f',hv(1)))
    set(handles.slidersaturation_handle,'val',hv(2))
    set(handles.editsaturation_handle,'string',sprintf('%.2f',hv(2)))
    set(handles.slidervalue_handle,'val',hv(3))
    set(handles.editvalue_handle,'string',sprintf('%.2f',hv(3)))
% --- Executes during object creation, after setting all properties.
function sliderred_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderred (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



function editred_Callback(hObject, eventdata, handles)
% hObject    handle to editred (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editred as text
%        str2double(get(hObject,'String')) returns contents of editred as a double


% --- Executes during object creation, after setting all properties.
function editred_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editred (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on slider movement.
function slidergreen_Callback(hObject, eventdata, handles)
% hObject    handle to slidergreen (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    greenvalue=get(hObject,'Value');
    set(handles.textgreen_handle,'string',sprintf('%.2f',greenvalue));
    set(handles.textright_handle,'backgroundcolor',[get(handles.sliderred_handle,'val'),get(hObject,'val'),get(handles.sliderblue_handle,'val')]);
    %set the new color value
    set(handles.textcolorright_handle,'string',sprintf('[%.2f %.2f %.2f]',[get(handles.sliderred_handle,'val'),get(hObject,'val'),get(handles.sliderblue_handle,'val')]));
     %set the hsv
    rb=(get(handles.textright_handle,'backgroundcolor'));
    hv=rgb2hsv(rb);
    set(handles.sliderhue_handle,'val',hv(1));
    set(handles.edithue_handle,'string',sprintf('%.2f',hv(1)));
    set(handles.slidersaturation_handle,'val',hv(2));
    set(handles.editsaturation_handle,'string',sprintf('%.2f',hv(2)));
    set(handles.slidervalue_handle,'val',hv(3));
    set(handles.editvalue_handle,'string',sprintf('%.2f',hv(3)));
% --- Executes during object creation, after setting all properties.
function slidergreen_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slidergreen (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function sliderblue_Callback(hObject, eventdata, handles)
% hObject    handle to sliderblue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    bluevalue=get(hObject,'Value');
    set(handles.textblue_handle,'string',sprintf('%.2f',bluevalue));
    set(handles.textright_handle,'backgroundcolor',[get(handles.sliderred_handle,'val'),get(handles.slidergreen_handle,'val'),get(hObject,'val')]);
    %set the new color value
    set(handles.textcolorright_handle,'string',sprintf('[%.2f %.2f %.2f]',[get(handles.sliderred_handle,'val'),get(handles.slidergreen_handle,'val'),get(hObject,'val')]));
     %set the hsv
    rb=(get(handles.textright_handle,'backgroundcolor'));
    hv=rgb2hsv(rb);
    set(handles.sliderhue_handle,'val',hv(1));
    set(handles.edithue_handle,'string',sprintf('%.2f',hv(1)));
    set(handles.slidersaturation_handle,'val',hv(2));
    set(handles.editsaturation_handle,'string',sprintf('%.2f',hv(2)));
    set(handles.slidervalue_handle,'val',hv(3));
    set(handles.editvalue_handle,'string',sprintf('%.2f',hv(3)));
% --- Executes during object creation, after setting all properties.
function sliderblue_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderblue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function sliderhue_Callback(hObject, eventdata, handles)
% hObject    handle to sliderhue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function sliderhue_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderhue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slidersaturation_Callback(hObject, eventdata, handles)
% hObject    handle to slidersaturation (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function slidersaturation_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slidersaturation (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slidervalue_Callback(hObject, eventdata, handles)
% hObject    handle to slidervalue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function slidervalue_CreateFcn(hObject, eventdata, handles)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -