Beispiel #1
0
static void
l_ui_line(struct rdp_inst * inst, uint8 opcode, int startx, int starty, int endx, int endy, RD_PEN * pen)
{
	HPEN hpen;
	HPEN org_hpen;
	uint32 color;
	int org_rop2;
	wfInfo * wfi = GET_WFI(inst);
	
	//printf("ui_line opcode %d startx %d starty %d endx %d endy %d\n", opcode, startx, starty, endx, endy);
	color = gdi_color_convert(pen->color, inst->settings->server_depth, 24, wfi->clrconv);
	hpen = CreatePen(pen->style, pen->width, color);
	org_rop2 = wf_set_rop2(wfi->drw->hdc, opcode);
	org_hpen = (HPEN)SelectObject(wfi->drw->hdc, hpen);
	MoveToEx(wfi->drw->hdc, startx, starty, NULL);
	LineTo(wfi->drw->hdc, endx, endy);
	SelectObject(wfi->drw->hdc, org_hpen);
	wf_set_rop2(wfi->drw->hdc, org_rop2);
	DeleteObject(hpen);

	if (wfi->drw == wfi->backstore)
	{
		wf_invalidate_region(wfi, min(startx, endx), min(starty, endy), max(startx, endx) + 1, max(starty, endy) + 1);
	}
}
Beispiel #2
0
static BOOL wf_gdi_polyline(rdpContext* context, const POLYLINE_ORDER* polyline)
{
	int org_rop2;
	HPEN hpen;
	HPEN org_hpen;
	UINT32 pen_color;
	wfContext* wfc = (wfContext*)context;

	if (!context || !polyline)
		return FALSE;

	if (!wf_decode_color(wfc, polyline->penColor, &pen_color, NULL))
		return FALSE;

	hpen = CreatePen(0, 1, pen_color);
	org_rop2 = wf_set_rop2(wfc->drawing->hdc, polyline->bRop2);
	org_hpen = (HPEN) SelectObject(wfc->drawing->hdc, hpen);

	if (polyline->numDeltaEntries > 0)
	{
		POINT*  pts;
		POINT  temp;
		int    numPoints;
		int    i;
		numPoints = polyline->numDeltaEntries + 1;
		pts = (POINT*) malloc(sizeof(POINT) * numPoints);
		pts[0].x = temp.x = polyline->xStart;
		pts[0].y = temp.y = polyline->yStart;

		for (i = 0; i < (int) polyline->numDeltaEntries; i++)
		{
			temp.x += polyline->points[i].x;
			temp.y += polyline->points[i].y;
			pts[i + 1].x = temp.x;
			pts[i + 1].y = temp.y;
		}

		if (wfc->drawing == wfc->primary)
			wf_invalidate_region(wfc, wfc->client_x, wfc->client_y, wfc->client_width,
			                     wfc->client_height);

		Polyline(wfc->drawing->hdc, pts, numPoints);
		free(pts);
	}

	SelectObject(wfc->drawing->hdc, org_hpen);
	wf_set_rop2(wfc->drawing->hdc, org_rop2);
	DeleteObject(hpen);
	return TRUE;
}
void wf_gdi_line_to(wfContext* wfc, LINE_TO_ORDER* line_to)
{
	HPEN pen;
	HPEN org_pen;
	int x, y, w, h;
	UINT32 pen_color;

	pen_color = freerdp_color_convert_bgr(line_to->penColor, wfc->srcBpp, wfc->dstBpp, wfc->clrconv);

	pen = CreatePen(line_to->penStyle, line_to->penWidth, pen_color);

	wf_set_rop2(wfc->drawing->hdc, line_to->bRop2);
	org_pen = (HPEN) SelectObject(wfc->drawing->hdc, pen);

	MoveToEx(wfc->drawing->hdc, line_to->nXStart, line_to->nYStart, NULL);
	LineTo(wfc->drawing->hdc, line_to->nXEnd, line_to->nYEnd);

	x = (line_to->nXStart < line_to->nXEnd) ? line_to->nXStart : line_to->nXEnd;
	y = (line_to->nYStart < line_to->nYEnd) ? line_to->nYStart : line_to->nYEnd;
	w = (line_to->nXStart < line_to->nXEnd) ? (line_to->nXEnd - line_to->nXStart) : (line_to->nXStart - line_to->nXEnd);
	h = (line_to->nYStart < line_to->nYEnd) ? (line_to->nYEnd - line_to->nYStart) : (line_to->nYStart - line_to->nYEnd);

	if (wfc->drawing == wfc->primary)
		wf_invalidate_region(wfc, x, y, w, h);

	SelectObject(wfc->drawing->hdc, org_pen);
	DeleteObject(pen);
}
Beispiel #4
0
static BOOL wf_gdi_line_to(rdpContext* context, const LINE_TO_ORDER* line_to)
{
	HPEN pen;
	HPEN org_pen;
	int x, y, w, h;
	UINT32 pen_color;
	wfContext* wfc = (wfContext*)context;

	if (!context || !line_to)
		return FALSE;

	if (!wf_decode_color(wfc, line_to->penColor, &pen_color, NULL))
		return FALSE;

	pen = CreatePen(line_to->penStyle, line_to->penWidth, pen_color);
	wf_set_rop2(wfc->drawing->hdc, line_to->bRop2);
	org_pen = (HPEN) SelectObject(wfc->drawing->hdc, pen);
	MoveToEx(wfc->drawing->hdc, line_to->nXStart, line_to->nYStart, NULL);
	LineTo(wfc->drawing->hdc, line_to->nXEnd, line_to->nYEnd);
	x = (line_to->nXStart < line_to->nXEnd) ? line_to->nXStart : line_to->nXEnd;
	y = (line_to->nYStart < line_to->nYEnd) ? line_to->nYStart : line_to->nYEnd;
	w = (line_to->nXStart < line_to->nXEnd) ? (line_to->nXEnd - line_to->nXStart)
	    : (line_to->nXStart - line_to->nXEnd);
	h = (line_to->nYStart < line_to->nYEnd) ? (line_to->nYEnd - line_to->nYStart)
	    : (line_to->nYStart - line_to->nYEnd);

	if (wfc->drawing == wfc->primary)
		wf_invalidate_region(wfc, x, y, w, h);

	SelectObject(wfc->drawing->hdc, org_pen);
	DeleteObject(pen);
	return TRUE;
}
Beispiel #5
0
static void
l_ui_polyline(struct rdp_inst * inst, uint8 opcode, RD_POINT * points, int npoints, RD_PEN * pen)
{
	int i;
	int color;
	int org_rop2;
	HPEN hpen;
	HPEN org_hpen;
	POINT * ps;
	wfInfo * wfi = GET_WFI(inst);

	//printf("ui_polyline opcode %d npoints %d\n", opcode, npoints);
	color = gdi_color_convert(pen->color, inst->settings->server_depth, 24, wfi->clrconv);
	hpen = CreatePen(pen->style, pen->width, color);
	org_rop2 = wf_set_rop2(wfi->drw->hdc, opcode);
	org_hpen = (HPEN)SelectObject(wfi->drw->hdc, hpen);
	if (npoints > 0)
	{
		ps = (POINT *) malloc(sizeof(POINT) * npoints);
		for (i = 0; i < npoints; i++)
		{
			//printf("ui_polyline point %d %d %d\n", i, points[i].x, points[i].y);
			if (i == 0)
			{
				ps[i].x = points[i].x;
				ps[i].y = points[i].y;
			}
			else
			{
				ps[i].x = ps[i - 1].x + points[i].x;
				ps[i].y = ps[i - 1].y + points[i].y;
			}
			if (wfi->drw == wfi->backstore)
			{
				wf_invalidate_region(wfi, ps[i].x, ps[i].y, ps[i].x + 1, ps[i].y + 1);
			}
		}
		Polyline(wfi->drw->hdc, ps, npoints);
	}
	SelectObject(wfi->drw->hdc, org_hpen);
	wf_set_rop2(wfi->drw->hdc, org_rop2);
	DeleteObject(hpen);
}
Beispiel #6
0
void wf_gdi_polyline(wfContext* wfc, POLYLINE_ORDER* polyline)
{
	int i;
	POINT* pts;
	int org_rop2;
	HPEN hpen;
	HPEN org_hpen;
	UINT32 pen_color;

	pen_color = freerdp_color_convert_var_bgr(polyline->penColor, wfc->srcBpp, wfc->dstBpp, wfc->clrconv);

	hpen = CreatePen(0, 1, pen_color);
	org_rop2 = wf_set_rop2(wfc->drawing->hdc, polyline->bRop2);
	org_hpen = (HPEN) SelectObject(wfc->drawing->hdc, hpen);

	if (polyline->numPoints > 0)
	{
		POINT temp;

		temp.x = polyline->xStart;
		temp.y = polyline->yStart;
		pts = (POINT*) malloc(sizeof(POINT) * polyline->numPoints);

		for (i = 0; i < (int) polyline->numPoints; i++)
		{
			temp.x += polyline->points[i].x;
			temp.y += polyline->points[i].y;
			pts[i].x = temp.x;
			pts[i].y = temp.y;

			if (wfc->drawing == wfc->primary)
				wf_invalidate_region(wfc, pts[i].x, pts[i].y, pts[i].x + 1, pts[i].y + 1);
		}

		Polyline(wfc->drawing->hdc, pts, polyline->numPoints);
		free(pts);
	}

	SelectObject(wfc->drawing->hdc, org_hpen);
	wf_set_rop2(wfc->drawing->hdc, org_rop2);
	DeleteObject(hpen);
}
Beispiel #7
0
void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
{
	int i;
	POINT* pts;
	int org_rop2;
	HPEN hpen;
	HPEN org_hpen;
	uint32 pen_color;
	wfInfo* wfi = ((wfContext*) context)->wfi;

	pen_color = freerdp_color_convert_bgr(polyline->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);

	hpen = CreatePen(0, 1, pen_color);
	org_rop2 = wf_set_rop2(wfi->drawing->hdc, polyline->bRop2);
	org_hpen = (HPEN) SelectObject(wfi->drawing->hdc, hpen);

	if (polyline->numPoints > 0)
	{
		pts = (POINT*) xmalloc(sizeof(POINT) * polyline->numPoints);

		for (i = 0; i < (int) polyline->numPoints; i++)
		{
			pts[i].x = polyline->points[i].x;
			pts[i].y = polyline->points[i].y;

			if (wfi->drawing == wfi->primary)
				wf_invalidate_region(wfi, pts[i].x, pts[i].y, pts[i].x + 1, pts[i].y + 1);
		}

		Polyline(wfi->drawing->hdc, pts, polyline->numPoints);
		xfree(pts);
	}

	SelectObject(wfi->drawing->hdc, org_hpen);
	wf_set_rop2(wfi->drawing->hdc, org_rop2);
	DeleteObject(hpen);
}