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 "SurfaceSetChromaKeyCommand.h"
21 #include "ICommandExecutor.h"
25 SurfaceSetChromaKeyCommand::~SurfaceSetChromaKeyCommand()
30 ExecutionResult SurfaceSetChromaKeyCommand::execute(ICommandExecutor* executor)
32 Scene& scene = *(executor->getScene());
34 ExecutionResult result = ExecutionFailed;
36 Surface* surface = scene.getSurface(m_surfaceid);
42 LOG_DEBUG("SurfaceSetChromaKeyCommand","new chromakey disable for id: " << m_surfaceid);
43 result = surface->setChromaKeyEnabled(false) ? ExecutionSuccessRedraw : ExecutionSuccess;
50 LOG_DEBUG("SurfaceSetChromaKeyCommand","new chromakey (" << m_array[0] << ", " << m_array[1] << ", " << m_array[2] << ") for id: " << m_surfaceid);
51 bool ansSetEnabled = surface->setChromaKeyEnabled(true);
52 bool ansSetValues = surface->setChromaKey((unsigned char)m_array[0], (unsigned char)m_array[1], (unsigned char)m_array[2]);
53 if ((true == ansSetEnabled) | (true == ansSetValues))
55 result = ExecutionSuccessRedraw;
59 result = ExecutionSuccess;
67 const std::string SurfaceSetChromaKeyCommand::getString()
69 std::stringstream description;
70 description << "SurfaceSetChromaKeyCommand("
71 << "surfaceid=" << m_surfaceid << "(0x" << std::hex << m_surfaceid << ")" << std::dec
74 for (unsigned int i = 0; i < m_length; ++i)
76 description << m_array[i] << ",";
78 description << "], m_length=" << m_length
80 return description.str();