~ubuntu-branches/ubuntu/vivid/freerdp/vivid

« back to all changes in this revision

Viewing changes to libfreerdp-gdi/brush.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-11-11 12:20:50 UTC
  • mfrom: (1.1.9) (9.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20141111122050-wyr8hrnwco9fcmum
Tags: 1.1.0~git20140921.1.440916e+dfsg1-2ubuntu1
* Merge with Debian unstable, remaining changes
  - Disable ffmpeg support
* Disable gstreamer support, this relies on gstreamer 0.10 and we don't want
  to add any more deps on that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * FreeRDP: A Remote Desktop Protocol Client
3
 
 * GDI Brush Functions
4
 
 *
5
 
 * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6
 
 *
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
10
 
 *
11
 
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 
 *
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.
18
 
 */
19
 
 
20
 
/* GDI Brush Functions: http://msdn.microsoft.com/en-us/library/dd183395/ */
21
 
 
22
 
#include <stdio.h>
23
 
#include <string.h>
24
 
#include <stdlib.h>
25
 
 
26
 
#include <freerdp/freerdp.h>
27
 
#include <freerdp/gdi/gdi.h>
28
 
 
29
 
#include <freerdp/gdi/32bpp.h>
30
 
#include <freerdp/gdi/16bpp.h>
31
 
#include <freerdp/gdi/8bpp.h>
32
 
 
33
 
#include <freerdp/gdi/brush.h>
34
 
 
35
 
p_PatBlt PatBlt_[5] =
36
 
{
37
 
        NULL,
38
 
        PatBlt_8bpp,
39
 
        PatBlt_16bpp,
40
 
        NULL,
41
 
        PatBlt_32bpp
42
 
};
43
 
 
44
 
/**
45
 
 * Create a new solid brush.\n
46
 
 * @msdn{dd183518}
47
 
 * @param crColor brush color
48
 
 * @return new brush
49
 
 */
50
 
 
51
 
HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor)
52
 
{
53
 
        HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH));
54
 
        hBrush->objectType = GDIOBJECT_BRUSH;
55
 
        hBrush->style = GDI_BS_SOLID;
56
 
        hBrush->color = crColor;
57
 
        return hBrush;
58
 
}
59
 
 
60
 
/**
61
 
 * Create a new pattern brush.\n
62
 
 * @msdn{dd183508}
63
 
 * @param hbmp pattern bitmap
64
 
 * @return new brush
65
 
 */
66
 
 
67
 
HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp)
68
 
{
69
 
        HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH));
70
 
        hBrush->objectType = GDIOBJECT_BRUSH;
71
 
        hBrush->style = GDI_BS_PATTERN;
72
 
        hBrush->pattern = hbmp;
73
 
        return hBrush;
74
 
}
75
 
 
76
 
/**
77
 
 * Perform a pattern blit operation on the given pixel buffer.\n
78
 
 * @msdn{dd162778}
79
 
 * @param hdc device context
80
 
 * @param nXLeft x1
81
 
 * @param nYLeft y1
82
 
 * @param nWidth width
83
 
 * @param nHeight height
84
 
 * @param rop raster operation code
85
 
 * @return 1 if successful, 0 otherwise
86
 
 */
87
 
 
88
 
int gdi_PatBlt(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop)
89
 
{
90
 
        p_PatBlt _PatBlt = PatBlt_[IBPP(hdc->bitsPerPixel)];
91
 
 
92
 
        if (_PatBlt != NULL)
93
 
                return _PatBlt(hdc, nXLeft, nYLeft, nWidth, nHeight, rop);
94
 
        else
95
 
                return 0;
96
 
}