* \ingroup ilmClient
* \param[in] surfaceId Id of the surface to set the chromakey of.
* \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.
*/
/***************************************************************************
*
* 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");
t_ilm_uint pixelformat; /*!< pixel format of surface */
t_ilm_uint nativeSurface; /*!< native surface handle of surface */
ilmInputDevice inputDevicesAcceptance; /*!< bitmask of ilmInputDevice from which the surface can accept input events */
+ t_ilm_bool chromaKeyEnabled; /*!< chromakey validness of the surface */
+ t_ilm_uint chromaKeyRed; /*!< chromakey's red value of the surface */
+ t_ilm_uint chromaKeyGreen; /*!< chromakey's green value of the surface */
+ t_ilm_uint chromaKeyBlue; /*!< chromakey's blue value of the surface */
};
/**
/**************************************************************************
*
* Copyright 2012 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\0");
* you may not use this file except in compliance with the License.
&& gIpcModule.getUint(&pSurfaceProperties->updateCounter)
&& gIpcModule.getUint(&pSurfaceProperties->pixelformat)
&& gIpcModule.getUint(&pSurfaceProperties->nativeSurface)
- && gIpcModule.getUint(&pSurfaceProperties->inputDevicesAcceptance))
+ && gIpcModule.getUint(&pSurfaceProperties->inputDevicesAcceptance)
+ && gIpcModule.getBool(&pSurfaceProperties->chromaKeyEnabled)
+ && gIpcModule.getUint(&pSurfaceProperties->chromaKeyRed)
+ && gIpcModule.getUint(&pSurfaceProperties->chromaKeyGreen)
+ && gIpcModule.getUint(&pSurfaceProperties->chromaKeyBlue))
{
returnValue = ILM_SUCCESS;
}
ilmErrorTypes ilm_surfaceSetChromaKey(t_ilm_surface surfaceId, t_ilm_int* pColor)
{
LOG_ENTER_FUNCTION;
- ilmErrorTypes error = ILM_FAILED;
+ ilmErrorTypes returnValue = ILM_FAILED;
+ do
+ {
+ if (!gIpcModule.createMessage("SetSurfaceChromaKey\0")
+ || !gIpcModule.appendUint(surfaceId))
+ {
+ break;
+ }
- // TODO: Implement this on both server and client
+ if (NULL != pColor)
+ {
+ const t_ilm_uint number = 3;
+ if (!gIpcModule.appendUintArray(pColor, number))
+ {
+ break;
+ }
+ }
- return error;
+ if (!gIpcModule.sendMessage()
+ || !gIpcModule.receiveMessage(gReceiveTimeout)
+ || gIpcModule.isErrorMessage())
+ {
+ break;
+ }
+
+ returnValue = ILM_SUCCESS;
+
+ } while(0);
+
+ return returnValue;
}
ilmErrorTypes ilm_surfaceInvalidateRectangle(t_ilm_surface surfaceId)
--- /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 _SURFACESETCHROMAKEYCOMMAND_H_
+#define _SURFACESETCHROMAKEYCOMMAND_H_
+
+#include "BaseCommandAsynchronous.h"
+
+class SurfaceSetChromaKeyCommand : public BaseCommandAsynchronous
+{
+public:
+ /*!
+ * \action This command sets the chroma key of a surface within the GENIVI LayerManagement
+ * \frequency Called in order to rearrange graphical output.
+ * \param[in] surfaceId Id of the surface 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
+ */
+ SurfaceSetChromaKeyCommand(unsigned int surfaceid, unsigned int* array, unsigned int length);
+
+ /**
+ * \brief default destructor
+ */
+ virtual ~SurfaceSetChromaKeyCommand() {}
+
+ /**
+ * \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_surfaceid;
+ unsigned int* m_array;
+ unsigned int m_length;
+};
+
+
+#endif /* _SURFACESETCHROMAKEYCOMMAND_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 "SurfaceSetChromaKeyCommand.h"
+#include "ICommandExecutor.h"
+#include "Scene.h"
+#include "Log.h"
+
+SurfaceSetChromaKeyCommand::SurfaceSetChromaKeyCommand(unsigned int surfaceid,unsigned int* array,unsigned int length)
+: m_surfaceid(surfaceid)
+, m_array(array)
+, m_length(length)
+{
+}
+
+ExecutionResult SurfaceSetChromaKeyCommand::execute(ICommandExecutor* executor)
+{
+ Scene& scene = *(executor->getScene());
+
+ ExecutionResult result = ExecutionFailed;
+
+ Surface* surface = scene.getSurface(m_surfaceid);
+
+ if (NULL == m_array)
+ {
+ if (surface)
+ {
+ LOG_DEBUG("SurfaceSetChromaKeyCommand","new chromakey disable for id: " << m_surfaceid);
+ result = surface->setChromaKeyEnabled(false) ? ExecutionSuccessRedraw : ExecutionSuccess;
+ }
+ }
+ else
+ {
+ if (surface)
+ {
+ LOG_DEBUG("SurfaceSetChromaKeyCommand","new chromakey (" << m_array[0] << ", " << m_array[1] << ", " << m_array[2] << ") for id: " << m_surfaceid);
+ bool ansSetEnabled = surface->setChromaKeyEnabled(true);
+ bool ansSetValues = surface->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 SurfaceSetChromaKeyCommand::getString()
+{
+ std::stringstream description;
+ description << "SurfaceSetChromaKeyCommand("
+ << "surfaceid=" << m_surfaceid
+ << ", m_array=[";
+
+ for (unsigned int i = 0; i < m_length; ++i)
+ {
+ description << m_array[i] << ",";
+ }
+ description << "], m_length=" << m_length
+ << ")";
+ return description.str();
+}
/***************************************************************************
*
* Copyright 2012 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");
void SetKeyboardFocusOn();
void GetKeyboardFocusSurfaceId();
void UpdateInputEventAcceptanceOn();
+ void SetSurfaceChromaKey();
private:
void RemoveApplicationReference(char* owner);
/***************************************************************************
* Copyright 2012 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");
#include "SurfaceSetKeyboardFocusCommand.h"
#include "SurfaceGetKeyboardFocusCommand.h"
#include "SurfaceUpdateInputEventAcceptance.h"
+#include "SurfaceSetChromaKeyCommand.h"
#include <stdbool.h>
#include <unistd.h>
{ "SetUniforms", &GenericCommunicator::SetUniforms },
{ "SetKeyboardFocusOn", &GenericCommunicator::SetKeyboardFocusOn },
{ "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
- { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn }
+ { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
+ { "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
};
int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
Rectangle dest = surface->getDestinationRegion();
Rectangle src = surface->getSourceRegion();
OrientationType orientation = surface->getOrientation();
+ unsigned char chromaKeyRed = 0;
+ unsigned char chromaKeyGreen = 0;
+ unsigned char chromaKeyBlue = 0;
+ surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
m_ipcModule.createMessage((char*)__FUNCTION__);
m_ipcModule.appendDouble(surface->getOpacity());
m_ipcModule.appendUint(surface->getPixelFormat());
m_ipcModule.appendUint(surface->getNativeContent());
m_ipcModule.appendUint(surface->getInputEventAcceptanceOnDevices());
+ m_ipcModule.appendBool(surface->getChromaKeyEnabled());
+ m_ipcModule.appendUint(chromaKeyRed);
+ m_ipcModule.appendUint(chromaKeyGreen);
+ m_ipcModule.appendUint(chromaKeyBlue);
m_ipcModule.sendMessage();
}
else
}
}
+void GenericCommunicator::SetSurfaceChromaKey()
+{
+ uint* array = NULL;
+ int length = 0;
+ uint surfaceid = 0;
+
+ m_ipcModule.getUint(&surfaceid);
+ m_ipcModule.getUintArray(&array, &length);
+
+ t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(surfaceid, 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);
/***************************************************************************
*
* 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");
double getOpacity() const;
/**
+ * @brief Set chroma key enabled value
+ * @param[in] newEnabled The new ChromaKey enable (true) or disable (false)
+ * @return TRUE if the new ChromaKey Enabled Value are not equal to the current Value
+ * FALSE if they are equal
+ */
+ virtual bool setChromaKeyEnabled(bool newEnabled);
+
+ /**
+ * @brief Get chroma key enabled value
+ * @return The current chromakey enable (true) or disable (false)
+ */
+ bool getChromaKeyEnabled() const;
+
+ /**
+ * @brief Set chroma key
+ * @param[in] newRed The new Red Value between 0 and 255
+ * @param[in] newGreen The new Green Value between 0 and 255
+ * @param[in] newBlue The new Blue Value between 0 and 255
+ * @return TRUE if the new ChromaKey Values are not equal to the current ChromaKey Values
+ * FALSE if they are equal
+ */
+ virtual bool setChromaKey(unsigned char newRed, unsigned char newGreen, unsigned char newBlue);
+
+ /**
+ * @brief Get chroma key values
+ * @param[out] The current Red Value between 0 and 255
+ * @param[out] The current Green Value between 0 and 255
+ * @param[out] The current Blue Value between 0 and 255
+ */
+ void getChromaKey(unsigned char& red, unsigned char& green, unsigned char& blue) const;
+
+ /**
* Set the visibility
* @param[in] newVisibility set this object visible (true) or invisible (false)
* @return TRUE if the new visiblity value is not equal to the current visibility value
Shader* shader;
double opacity;
bool visibility;
+ bool chromaKeyEnabled;
+ unsigned char chromaKeyRed;
+ unsigned char chromaKeyGreen;
+ unsigned char chromaKeyBlue;
protected:
unsigned int graphicInternalId;
, shader(0)
, opacity(opacity)
, visibility(visibility)
+, chromaKeyEnabled(false)
+, chromaKeyRed(0)
+, chromaKeyGreen(0)
+, chromaKeyBlue(0)
, graphicInternalId(nextGraphicId[type]++)
{
graphicExternalId = graphicInternalId;
, shader(0)
, opacity(opacity)
, visibility(visibility)
+, chromaKeyEnabled(false)
+, chromaKeyRed(0)
+, chromaKeyGreen(0)
+, chromaKeyBlue(0)
, graphicInternalId(nextGraphicId[type]++)
, graphicExternalId(externalId)
{
return visibility;
}
+inline bool GraphicalObject::setChromaKeyEnabled(bool newEnabled)
+{
+ if (chromaKeyEnabled != newEnabled)
+ {
+ chromaKeyEnabled = newEnabled;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
+}
+
+inline bool GraphicalObject::getChromaKeyEnabled() const
+{
+ return chromaKeyEnabled;
+}
+
+inline bool GraphicalObject::setChromaKey(unsigned char newRed, unsigned char newGreen, unsigned char newBlue)
+{
+ if ((chromaKeyRed != newRed) || (chromaKeyGreen != newGreen) || (chromaKeyBlue != newBlue))
+ {
+ chromaKeyRed = newRed;
+ chromaKeyGreen = newGreen;
+ chromaKeyBlue = newBlue;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
+}
+
+inline void GraphicalObject::getChromaKey(unsigned char& red, unsigned char& green, unsigned char& blue) const
+{
+ red = chromaKeyRed;
+ green = chromaKeyGreen;
+ blue = chromaKeyBlue;
+}
+
inline unsigned int GraphicalObject::getID()
{
return graphicExternalId;