color.h (2415B)
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20#ifndef GUAC_RDP_COLOR_H 21#define GUAC_RDP_COLOR_H 22 23#include <freerdp/freerdp.h> 24#include <winpr/wtypes.h> 25 26/** 27 * Returns the FreeRDP pixel format ID corresponding to the 32-bit RGB format 28 * used by the Cairo library's image surfaces. Cairo handles colors in terms of 29 * integers in native endianness, with CAIRO_FORMAT_ARGB32 representing a color 30 * format where the alpha channel is stored in the most significant byte, 31 * followed by red, green, and blue. FreeRDP handles colors in terms of 32 * absolute byte order, with PIXEL_FORMAT_ARGB32 representing a color format 33 * where the alpha channel is in byte 0, followed by red at byte 1, etc. 34 * 35 * @param alpha 36 * TRUE if the returned FreeRDP pixel format should correspond to Cairo's 37 * CAIRO_FORMAT_ARGB32, FALSE if the returned format should correspond to 38 * Cairo's CAIRO_FORMAT_RGB24. 39 * 40 * @return 41 * The FreeRDP pixel format ID that corresponds to the 32-bit RGB format 42 * used by the Cairo library. 43 */ 44UINT32 guac_rdp_get_native_pixel_format(BOOL alpha); 45 46/** 47 * Converts the given color to ARGB32. The color given may be an index 48 * referring to the palette, a 16-bit or 32-bit color, etc. all depending on 49 * the current color depth of the RDP session. 50 * 51 * @param context 52 * The rdpContext associated with the current RDP session. 53 * 54 * @param color 55 * A color value in the format of the current RDP session. 56 * 57 * @return 58 * A 32-bit ARGB color, where the low 8 bits are the blue component and 59 * the high 8 bits are alpha. 60 */ 61UINT32 guac_rdp_convert_color(rdpContext* context, UINT32 color); 62 63#endif 64