Blame libfreerdp/gdi/drawing.c

Packit Service fa4841
/**
Packit Service fa4841
 * FreeRDP: A Remote Desktop Protocol Implementation
Packit Service fa4841
 * GDI Drawing Functions
Packit Service fa4841
 *
Packit Service fa4841
 * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit Service fa4841
 * Copyright 2016 Armin Novak <armin.novak@thincast.com>
Packit Service fa4841
 * Copyright 2016 Thincast Technologies GmbH
Packit Service fa4841
 *
Packit Service fa4841
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit Service fa4841
 * you may not use this file except in compliance with the License.
Packit Service fa4841
 * You may obtain a copy of the License at
Packit Service fa4841
 *
Packit Service fa4841
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit Service fa4841
 *
Packit Service fa4841
 * Unless required by applicable law or agreed to in writing, software
Packit Service fa4841
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit Service fa4841
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit Service fa4841
 * See the License for the specific language governing permissions and
Packit Service fa4841
 * limitations under the License.
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
/* GDI Drawing Functions: http://msdn.microsoft.com/en-us/library/dd162760/ */
Packit Service fa4841
Packit Service fa4841
#ifdef HAVE_CONFIG_H
Packit Service fa4841
#include "config.h"
Packit Service fa4841
#endif
Packit Service fa4841
Packit Service fa4841
#include <stdio.h>
Packit Service fa4841
#include <string.h>
Packit Service fa4841
#include <stdlib.h>
Packit Service fa4841
Packit Service fa4841
#include <freerdp/freerdp.h>
Packit Service fa4841
#include <freerdp/gdi/gdi.h>
Packit Service fa4841
Packit Service fa4841
#include <freerdp/gdi/dc.h>
Packit Service fa4841
#include "drawing.h"
Packit Service fa4841
Packit Service fa4841
/**
Packit Service fa4841
 * Set current foreground draw mode.\n
Packit Service fa4841
 * @msdn{dd144922}
Packit Service fa4841
 * @param hdc device context
Packit Service fa4841
 * @return draw mode
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
INT32 gdi_GetROP2(HGDI_DC hdc)
Packit Service fa4841
{
Packit Service fa4841
	return hdc->drawMode;
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
/**
Packit Service fa4841
 * Set current foreground draw mode.\n
Packit Service fa4841
 * @msdn{dd145088}
Packit Service fa4841
 * @param hdc device context
Packit Service fa4841
 * @param fnDrawMode draw mode
Packit Service fa4841
 * @return previous draw mode
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
INT32 gdi_SetROP2(HGDI_DC hdc, INT32 fnDrawMode)
Packit Service fa4841
{
Packit Service fa4841
	INT32 prevDrawMode = hdc->drawMode;
Packit Service fa4841
Packit Service fa4841
	if (fnDrawMode > 0 && fnDrawMode <= 16)
Packit Service fa4841
		hdc->drawMode = fnDrawMode;
Packit Service fa4841
Packit Service fa4841
	return prevDrawMode;
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
/**
Packit Service fa4841
 * Get the current background color.\n
Packit Service fa4841
 * @msdn{dd144852}
Packit Service fa4841
 * @param hdc device context
Packit Service fa4841
 * @return background color
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
UINT32 gdi_GetBkColor(HGDI_DC hdc)
Packit Service fa4841
{
Packit Service fa4841
	return hdc->bkColor;
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
/**
Packit Service fa4841
 * Set the current background color.\n
Packit Service fa4841
 * @msdn{dd162964}
Packit Service fa4841
 * @param hdc device color
Packit Service fa4841
 * @param crColor new background color
Packit Service fa4841
 * @return previous background color
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
UINT32 gdi_SetBkColor(HGDI_DC hdc, UINT32 crColor)
Packit Service fa4841
{
Packit Service fa4841
	UINT32 previousBkColor = hdc->bkColor;
Packit Service fa4841
	hdc->bkColor = crColor;
Packit Service fa4841
	return previousBkColor;
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
/**
Packit Service fa4841
 * Get the current background mode.\n
Packit Service fa4841
 * @msdn{dd144853}
Packit Service fa4841
 * @param hdc device context
Packit Service fa4841
 * @return background mode
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
UINT32 gdi_GetBkMode(HGDI_DC hdc)
Packit Service fa4841
{
Packit Service fa4841
	return hdc->bkMode;
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
/**
Packit Service fa4841
 * Set the current background mode.\n
Packit Service fa4841
 * @msdn{dd162965}
Packit Service fa4841
 * @param hdc device context
Packit Service fa4841
 * @param iBkMode background mode
Packit Service fa4841
 * @return previous background mode on success, 0 on failure
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
INT32 gdi_SetBkMode(HGDI_DC hdc, INT32 iBkMode)
Packit Service fa4841
{
Packit Service fa4841
	if (iBkMode == GDI_OPAQUE || iBkMode == GDI_TRANSPARENT)
Packit Service fa4841
	{
Packit Service fa4841
		INT32 previousBkMode = hdc->bkMode;
Packit Service fa4841
		hdc->bkMode = iBkMode;
Packit Service fa4841
		return previousBkMode;
Packit Service fa4841
	}
Packit Service fa4841
Packit Service fa4841
	return TRUE;
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
/**
Packit Service fa4841
 * Set the current text color.\n
Packit Service fa4841
 * @msdn{dd145093}
Packit Service fa4841
 * @param hdc device context
Packit Service fa4841
 * @param crColor new text color
Packit Service fa4841
 * @return previous text color
Packit Service fa4841
 */
Packit Service fa4841
Packit Service fa4841
UINT32 gdi_SetTextColor(HGDI_DC hdc, UINT32 crColor)
Packit Service fa4841
{
Packit Service fa4841
	UINT32 previousTextColor = hdc->textColor;
Packit Service fa4841
	hdc->textColor = crColor;
Packit Service fa4841
	return previousTextColor;
Packit Service fa4841
}