* \ingroup ilmClient
* \param[in] layerId Id of layer.
* \param[in] pColor array of the color value which is defined in red,green, blue
- * \todo This method is currently not implemented.
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
ilmOrientation orientation; /*!< orientation value of the layer */
t_ilm_bool visibility; /*!< visibility value of the layer */
t_ilm_uint type; /*!< type of layer */
+ t_ilm_bool chromaKeyEnabled; /*!< chromakey validness of the layer */
+ t_ilm_uint chromaKeyRed; /*!< chromakey's red value of the layer */
+ t_ilm_uint chromaKeyGreen; /*!< chromakey's green value of the layer */
+ t_ilm_uint chromaKeyBlue; /*!< chromakey's blue value of the layer */
};
&& gIpcModule.getUint(&pLayerProperties->destHeight)
&& gIpcModule.getUint(&pLayerProperties->orientation)
&& gIpcModule.getBool(&pLayerProperties->visibility)
- && gIpcModule.getUint(&pLayerProperties->type))
+ && gIpcModule.getUint(&pLayerProperties->type)
+ && gIpcModule.getBool(&pLayerProperties->chromaKeyEnabled)
+ && gIpcModule.getUint(&pLayerProperties->chromaKeyRed)
+ && gIpcModule.getUint(&pLayerProperties->chromaKeyGreen)
+ && gIpcModule.getUint(&pLayerProperties->chromaKeyBlue)
+ && gIpcModule.destroyMessage())
{
returnValue = ILM_SUCCESS;
}
return returnValue;
}
-ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* color)
+ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* pColor)
{
LOG_ENTER_FUNCTION;
- ilmErrorTypes error = ILM_FAILED;
- // TODO: Implement this on both server and client
- return error;
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ do
+ {
+ if (!gIpcModule.createMessage("SetLayerChromaKey\0")
+ || !gIpcModule.appendUint(layerId))
+ {
+ break;
+ }
+
+ if (pColor != NULL)
+ {
+ const t_ilm_uint n = 3;
+ if (!gIpcModule.appendUintArray(pColor, n))
+ {
+ break;
+ }
+ }
+
+ if (!gIpcModule.sendMessage()
+ || !gIpcModule.receiveMessage(gReceiveTimeout)
+ || gIpcModule.isErrorMessage())
+ {
+ break;
+ }
+
+ returnValue = ILM_SUCCESS;
+
+ } while (0);
+
+ return returnValue;
}
ilmErrorTypes ilm_layerSetRenderOrder(t_ilm_layer layerId, t_ilm_layer *pSurfaceId, t_ilm_int number)
--- /dev/null
+/***************************************************************************
+*
+* Copyright 2010,2011 BMW Car IT GmbH
+* Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+*
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+****************************************************************************/
+
+#ifndef _LAYERSETCHROMAKEYCOMMAND_H_
+#define _LAYERSETCHROMAKEYCOMMAND_H_
+
+#include "BaseCommandAsynchronous.h"
+
+class LayerSetChromaKeyCommand : public BaseCommandAsynchronous
+{
+public:
+ /*!
+ * \action This command sets the chroma key of a layer within the GENIVI LayerManagement
+ * \frequency Called in order to rearrange graphical output.
+ * \param[in] layer Id of the layer to set the chromakey of.
+ * \param[in] array array of color value which is defined in red, green, blue
+ * \param[in] length length of array provided as argument array
+ * \ingroup Commands
+ */
+ LayerSetChromaKeyCommand(unsigned int layerid, unsigned int* array, unsigned int length);
+
+ /**
+ * \brief default destructor
+ */
+ virtual ~LayerSetChromaKeyCommand() {}
+
+ /**
+ * \brief Execute this command.
+ * \param[in] executor Pointer to instance executing the LayerManagement Commands
+ * \return ExecutionSuccess: execution successful
+ * \return ExecutionSuccessRedraw: execution successful and screen needs to be redrawn
+ * \return ExecutionFailed: execution failed
+ * \return ExecutionFailedRedraw: execution unsuccessful and screen needs to be redrawn
+ */
+ virtual ExecutionResult execute(ICommandExecutor* executor);
+
+ /**
+ * \brief Get description string for this command.
+ * \return String object with description of this command object
+ */
+ virtual const std::string getString();
+
+private:
+ const unsigned int m_layerid;
+ unsigned int* m_array;
+ unsigned int m_length;
+};
+
+
+#endif /* _LAYERSETCHROMAKEYCOMMAND_H_ */
--- /dev/null
+/***************************************************************************
+*
+* Copyright 2010,2011 BMW Car IT GmbH
+* Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+*
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+****************************************************************************/
+#include "LayerSetChromaKeyCommand.h"
+#include "ICommandExecutor.h"
+#include "Scene.h"
+#include "Log.h"
+
+LayerSetChromaKeyCommand::LayerSetChromaKeyCommand(unsigned int layerid,unsigned int* array,unsigned int length)
+: m_layerid(layerid)
+, m_array(array)
+, m_length(length)
+{
+}
+
+ExecutionResult LayerSetChromaKeyCommand::execute(ICommandExecutor* executor)
+{
+ Scene& scene = *(executor->getScene());
+
+ ExecutionResult result = ExecutionFailed;
+
+ Layer* layer = scene.getLayer(m_layerid);
+
+ if (NULL == m_array)
+ {
+ if (layer)
+ {
+ LOG_DEBUG("LayerSetChromaKeyCommand","new chromakey disable for id: " << m_layerid);
+ result = layer->setChromaKeyEnabled(false) ? ExecutionSuccessRedraw : ExecutionSuccess;
+ }
+ }
+ else
+ {
+ if (layer)
+ {
+ LOG_DEBUG("LayerSetChromaKeyCommand","new chromakey ("
+ << m_array[0] << ", " << m_array[1] << ", " << m_array[2] << ") for id: " << m_layerid);
+ bool ansSetEnabled = layer->setChromaKeyEnabled(true);
+ bool ansSetValues = layer->setChromaKey((unsigned char)m_array[0], (unsigned char)m_array[1], (unsigned char)m_array[2]);
+ if ((true == ansSetEnabled) | (true == ansSetValues))
+ {
+ result = ExecutionSuccessRedraw;
+ }
+ else
+ {
+ result = ExecutionSuccess;
+ }
+ }
+ delete[] m_array;
+ }
+
+ return result;
+}
+
+const std::string LayerSetChromaKeyCommand::getString()
+{
+ std::stringstream description;
+ description << "LayerSetChromaKeyCommand("
+ << "layerid=" << m_layerid
+ << ", m_array=[";
+
+ for (unsigned int i = 0; i < m_length; ++i)
+ {
+ description << m_array[i] << ",";
+ }
+ description << "], m_length=" << m_length
+ << ")";
+ return description.str();
+}
void GetKeyboardFocusSurfaceId();
void UpdateInputEventAcceptanceOn();
void SetSurfaceChromaKey();
+ void SetLayerChromaKey();
private:
void RemoveApplicationReference(char* owner);
#include "SurfaceGetKeyboardFocusCommand.h"
#include "SurfaceUpdateInputEventAcceptance.h"
#include "SurfaceSetChromaKeyCommand.h"
+#include "LayerSetChromaKeyCommand.h"
#include <stdbool.h>
#include <unistd.h>
{ "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
{ "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
{ "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
+ { "SetLayerChromaKey", &GenericCommunicator::SetLayerChromaKey },
};
int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
Rectangle dest = layer->getDestinationRegion();
Rectangle src = layer->getSourceRegion();
OrientationType orientation = layer->getOrientation();
+ unsigned char chromaKeyRed = 0;
+ unsigned char chromaKeyGreen = 0;
+ unsigned char chromaKeyBlue = 0;
+ layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
m_ipcModule.createMessage((char*)__FUNCTION__);
m_ipcModule.appendDouble(layer->getOpacity());
m_ipcModule.appendUint(orientation);
m_ipcModule.appendBool(layer->getVisibility());
m_ipcModule.appendUint(layer->getLayerType());
+ m_ipcModule.appendBool(layer->getChromaKeyEnabled());
+ m_ipcModule.appendUint(chromaKeyRed);
+ m_ipcModule.appendUint(chromaKeyGreen);
+ m_ipcModule.appendUint(chromaKeyBlue);
m_ipcModule.sendMessage();
}
else
}
}
+void GenericCommunicator::SetLayerChromaKey()
+{
+ uint* array = NULL;
+ int length = 0;
+ uint layerid = 0;
+
+ m_ipcModule.getUint(&layerid);
+ m_ipcModule.getUintArray(&array, &length);
+
+ t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(layerid, array, length));
+ if (status)
+ {
+ m_ipcModule.createMessage((char*)__FUNCTION__);
+ m_ipcModule.sendMessage();
+ }
+ else
+ {
+ m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
+ }
+}
+
extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
{
return new GenericCommunicator(executor);