FreeRDP
color.c File Reference
#include <freerdp/config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <winpr/crt.h>
#include <freerdp/log.h>
#include <freerdp/freerdp.h>
#include <freerdp/primitives.h>
#include "color.h"

Macros

#define TAG   FREERDP_TAG("color")
 

Functions

BYTEfreerdp_glyph_convert (UINT32 width, UINT32 height, const BYTE *WINPR_RESTRICT data)
 
BOOL freerdp_image_copy_from_monochrome (BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT pSrcData, UINT32 backColor, UINT32 foreColor, const gdiPalette *WINPR_RESTRICT palette)
 
static INLINE UINT32 freerdp_image_inverted_pointer_color (UINT32 x, UINT32 y, UINT32 format)
 
static void fill_gdi_palette_for_icon (const BYTE *colorTable, UINT16 cbColorTable, gdiPalette *palette)
 
static INLINE UINT32 div_ceil (UINT32 a, UINT32 b)
 
static INLINE UINT32 round_up (UINT32 a, UINT32 b)
 
BOOL freerdp_image_copy_from_icon_data (BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT16 nWidth, UINT16 nHeight, const BYTE *WINPR_RESTRICT bitsColor, UINT16 cbBitsColor, const BYTE *WINPR_RESTRICT bitsMask, UINT16 cbBitsMask, const BYTE *WINPR_RESTRICT colorTable, UINT16 cbColorTable, UINT32 bpp)
 
static BOOL freerdp_image_copy_from_pointer_data_1bpp (BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT xorMask, UINT32 xorMaskLength, const BYTE *WINPR_RESTRICT andMask, UINT32 andMaskLength, UINT32 xorBpp)
 
static BOOL freerdp_image_copy_from_pointer_data_xbpp (BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT xorMask, UINT32 xorMaskLength, const BYTE *WINPR_RESTRICT andMask, UINT32 andMaskLength, UINT32 xorBpp, const gdiPalette *palette)
 
BOOL freerdp_image_copy_from_pointer_data (BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT xorMask, UINT32 xorMaskLength, const BYTE *WINPR_RESTRICT andMask, UINT32 andMaskLength, UINT32 xorBpp, const gdiPalette *palette)
 
static INLINE BOOL overlapping (const BYTE *pDstData, UINT32 nXDst, UINT32 nYDst, UINT32 nDstStep, UINT32 dstBytesPerPixel, const BYTE *pSrcData, UINT32 nXSrc, UINT32 nYSrc, UINT32 nSrcStep, UINT32 srcBytesPerPixel, UINT32 nWidth, UINT32 nHeight)
 
static INLINE BOOL freerdp_image_copy_bgr24_bgrx32 (BYTE *WINPR_RESTRICT pDstData, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT pSrcData, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, SSIZE_T srcVMultiplier, SSIZE_T srcVOffset, SSIZE_T dstVMultiplier, SSIZE_T dstVOffset)
 
static INLINE BOOL freerdp_image_copy_bgrx32_bgrx32 (BYTE *WINPR_RESTRICT pDstData, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT pSrcData, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, SSIZE_T srcVMultiplier, SSIZE_T srcVOffset, SSIZE_T dstVMultiplier, SSIZE_T dstVOffset)
 
static INLINE BOOL freerdp_image_copy_generic (BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT pSrcData, UINT32 SrcFormat, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette *WINPR_RESTRICT palette, SSIZE_T srcVMultiplier, SSIZE_T srcVOffset, SSIZE_T dstVMultiplier, SSIZE_T dstVOffset)
 
static INLINE BOOL freerdp_image_copy_no_overlap_dst_alpha (BYTE *WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette *WINPR_RESTRICT palette, SSIZE_T srcVMultiplier, SSIZE_T srcVOffset, SSIZE_T dstVMultiplier, SSIZE_T dstVOffset)
 
BOOL freerdp_image_copy_overlap (BYTE *pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette *WINPR_RESTRICT palette, UINT32 flags)
 
BOOL freerdp_image_copy (BYTE *pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette *WINPR_RESTRICT palette, UINT32 flags)
 
BOOL freerdp_image_fill (BYTE *WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, UINT32 color)
 
BOOL freerdp_image_scale (BYTE *WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, const BYTE *WINPR_RESTRICT pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, UINT32 nSrcWidth, UINT32 nSrcHeight)
 
DWORD FreeRDPAreColorFormatsEqualNoAlpha (DWORD first, DWORD second)
 
const char * FreeRDPGetColorFormatName (UINT32 format)
 
void FreeRDPSplitColor (UINT32 color, UINT32 format, BYTE *_r, BYTE *_g, BYTE *_b, BYTE *_a, const gdiPalette *palette)
 
BOOL FreeRDPWriteColorIgnoreAlpha (BYTE *WINPR_RESTRICT dst, UINT32 format, UINT32 color)
 
BOOL FreeRDPWriteColor (BYTE *WINPR_RESTRICT dst, UINT32 format, UINT32 color)
 
UINT32 FreeRDPReadColor (const BYTE *WINPR_RESTRICT src, UINT32 format)
 
UINT32 FreeRDPGetColor (UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
 
BOOL freerdp_image_copy_no_overlap (BYTE *pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette *palette, UINT32 flags)
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("color")

FreeRDP: A Remote Desktop Protocol Implementation Color Conversion Routines

Copyright 2010 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2016 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2016 Thincast Technologies 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.

Function Documentation

◆ div_ceil()

static INLINE UINT32 div_ceil ( UINT32  a,
UINT32  b 
)
static
Here is the caller graph for this function:

◆ fill_gdi_palette_for_icon()

static void fill_gdi_palette_for_icon ( const BYTE colorTable,
UINT16  cbColorTable,
gdiPalette *  palette 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_glyph_convert()

BYTE* freerdp_glyph_convert ( UINT32  width,
UINT32  height,
const BYTE *WINPR_RESTRICT  data 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy()

BOOL freerdp_image_copy ( BYTE pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE pSrcData,
DWORD  SrcFormat,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
const gdiPalette *WINPR_RESTRICT  palette,
UINT32  flags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_bgr24_bgrx32()

static INLINE BOOL freerdp_image_copy_bgr24_bgrx32 ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  pSrcData,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
SSIZE_T  srcVMultiplier,
SSIZE_T  srcVOffset,
SSIZE_T  dstVMultiplier,
SSIZE_T  dstVOffset 
)
static
Here is the caller graph for this function:

◆ freerdp_image_copy_bgrx32_bgrx32()

static INLINE BOOL freerdp_image_copy_bgrx32_bgrx32 ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  pSrcData,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
SSIZE_T  srcVMultiplier,
SSIZE_T  srcVOffset,
SSIZE_T  dstVMultiplier,
SSIZE_T  dstVOffset 
)
static
Here is the caller graph for this function:

◆ freerdp_image_copy_from_icon_data()

BOOL freerdp_image_copy_from_icon_data ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT16  nWidth,
UINT16  nHeight,
const BYTE *WINPR_RESTRICT  bitsColor,
UINT16  cbBitsColor,
const BYTE *WINPR_RESTRICT  bitsMask,
UINT16  cbBitsMask,
const BYTE *WINPR_RESTRICT  colorTable,
UINT16  cbColorTable,
UINT32  bpp 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_from_monochrome()

BOOL freerdp_image_copy_from_monochrome ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  pSrcData,
UINT32  backColor,
UINT32  foreColor,
const gdiPalette *WINPR_RESTRICT  palette 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_from_pointer_data()

BOOL freerdp_image_copy_from_pointer_data ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  xorMask,
UINT32  xorMaskLength,
const BYTE *WINPR_RESTRICT  andMask,
UINT32  andMaskLength,
UINT32  xorBpp,
const gdiPalette *  palette 
)

Drawing Monochrome Pointers: http://msdn.microsoft.com/en-us/library/windows/hardware/ff556143/

Drawing Color Pointers: http://msdn.microsoft.com/en-us/library/windows/hardware/ff556138/

Here is the call graph for this function:

◆ freerdp_image_copy_from_pointer_data_1bpp()

static BOOL freerdp_image_copy_from_pointer_data_1bpp ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  xorMask,
UINT32  xorMaskLength,
const BYTE *WINPR_RESTRICT  andMask,
UINT32  andMaskLength,
UINT32  xorBpp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_from_pointer_data_xbpp()

static BOOL freerdp_image_copy_from_pointer_data_xbpp ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  xorMask,
UINT32  xorMaskLength,
const BYTE *WINPR_RESTRICT  andMask,
UINT32  andMaskLength,
UINT32  xorBpp,
const gdiPalette *  palette 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_generic()

static INLINE BOOL freerdp_image_copy_generic ( BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  pSrcData,
UINT32  SrcFormat,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
const gdiPalette *WINPR_RESTRICT  palette,
SSIZE_T  srcVMultiplier,
SSIZE_T  srcVOffset,
SSIZE_T  dstVMultiplier,
SSIZE_T  dstVOffset 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_no_overlap()

BOOL freerdp_image_copy_no_overlap ( BYTE pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE pSrcData,
DWORD  SrcFormat,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
const gdiPalette *  palette,
UINT32  flags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_no_overlap_dst_alpha()

static INLINE BOOL freerdp_image_copy_no_overlap_dst_alpha ( BYTE *WINPR_RESTRICT  pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  pSrcData,
DWORD  SrcFormat,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
const gdiPalette *WINPR_RESTRICT  palette,
SSIZE_T  srcVMultiplier,
SSIZE_T  srcVOffset,
SSIZE_T  dstVMultiplier,
SSIZE_T  dstVOffset 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_copy_overlap()

BOOL freerdp_image_copy_overlap ( BYTE pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE pSrcData,
DWORD  SrcFormat,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
const gdiPalette *WINPR_RESTRICT  palette,
UINT32  flags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_fill()

BOOL freerdp_image_fill ( BYTE *WINPR_RESTRICT  pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
UINT32  color 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_inverted_pointer_color()

static INLINE UINT32 freerdp_image_inverted_pointer_color ( UINT32  x,
UINT32  y,
UINT32  format 
)
static

Inverted pointer colors (where individual pixels can change their color to accommodate the background behind them) only seem to be supported on Windows. Using a static replacement color for these pixels (e.g. black) might result in invisible pointers depending on the background. This function returns either black or white, depending on the pixel's position.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_image_scale()

BOOL freerdp_image_scale ( BYTE *WINPR_RESTRICT  pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstWidth,
UINT32  nDstHeight,
const BYTE *WINPR_RESTRICT  pSrcData,
DWORD  SrcFormat,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
UINT32  nSrcWidth,
UINT32  nSrcHeight 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreeRDPAreColorFormatsEqualNoAlpha()

DWORD FreeRDPAreColorFormatsEqualNoAlpha ( DWORD  first,
DWORD  second 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreeRDPGetColor()

UINT32 FreeRDPGetColor ( UINT32  format,
BYTE  r,
BYTE  g,
BYTE  b,
BYTE  a 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreeRDPGetColorFormatName()

const char* FreeRDPGetColorFormatName ( UINT32  format)
Here is the caller graph for this function:

◆ FreeRDPReadColor()

UINT32 FreeRDPReadColor ( const BYTE *WINPR_RESTRICT  src,
UINT32  format 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreeRDPSplitColor()

void FreeRDPSplitColor ( UINT32  color,
UINT32  format,
BYTE _r,
BYTE _g,
BYTE _b,
BYTE _a,
const gdiPalette *  palette 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreeRDPWriteColor()

BOOL FreeRDPWriteColor ( BYTE *WINPR_RESTRICT  dst,
UINT32  format,
UINT32  color 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreeRDPWriteColorIgnoreAlpha()

BOOL FreeRDPWriteColorIgnoreAlpha ( BYTE *WINPR_RESTRICT  dst,
UINT32  format,
UINT32  color 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ overlapping()

static INLINE BOOL overlapping ( const BYTE pDstData,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstStep,
UINT32  dstBytesPerPixel,
const BYTE pSrcData,
UINT32  nXSrc,
UINT32  nYSrc,
UINT32  nSrcStep,
UINT32  srcBytesPerPixel,
UINT32  nWidth,
UINT32  nHeight 
)
static
Here is the caller graph for this function:

◆ round_up()

static INLINE UINT32 round_up ( UINT32  a,
UINT32  b 
)
static
Here is the call graph for this function:
Here is the caller graph for this function: