1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
4 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ****************************************************************************/
20 #include "LayerSetChromaKeyCommand.h"
21 #include "ICommandExecutor.h"
25 LayerSetChromaKeyCommand::~LayerSetChromaKeyCommand()
30 ExecutionResult LayerSetChromaKeyCommand::execute(ICommandExecutor* executor)
32 Scene& scene = *(executor->getScene());
34 ExecutionResult result = ExecutionFailed;
36 Layer* layer = scene.getLayer(m_layerid);
42 LOG_DEBUG("LayerSetChromaKeyCommand","new chromakey disable for id: " << m_layerid);
43 result = layer->setChromaKeyEnabled(false) ? ExecutionSuccessRedraw : ExecutionSuccess;
50 LOG_DEBUG("LayerSetChromaKeyCommand","new chromakey ("
51 << m_array[0] << ", " << m_array[1] << ", " << m_array[2] << ") for id: " << m_layerid);
52 bool ansSetEnabled = layer->setChromaKeyEnabled(true);
53 bool ansSetValues = layer->setChromaKey((unsigned char)m_array[0], (unsigned char)m_array[1], (unsigned char)m_array[2]);
54 if ((true == ansSetEnabled) | (true == ansSetValues))
56 result = ExecutionSuccessRedraw;
60 result = ExecutionSuccess;
68 const std::string LayerSetChromaKeyCommand::getString()
70 std::stringstream description;
71 description << "LayerSetChromaKeyCommand("
72 << "layerid=" << m_layerid << "(0x" << std::hex << m_layerid << ")" << std::dec
75 for (unsigned int i = 0; i < m_length; ++i)
77 description << m_array[i] << ",";
79 description << "], m_length=" << m_length
81 return description.str();