gdi

Get the colour of the screen's current colour filter

流过昼夜 提交于 2019-12-02 02:46:32
The following code SETS the colour filter of the screen to a specific colour. How can I instead GET the colour of the screen? [DllImport("GDI32.dll")] private unsafe static extern bool SetDeviceGammaRamp(IntPtr hdc, void* ramp); private static IntPtr hdc; public unsafe bool SetLCDbrightness(Color c) { short red = c.R; short green = c.G; short blue = c.B; Graphics gg = Graphics.FromHwnd(IntPtr.Zero); hdc = gg.GetHdc(); short* gArray = stackalloc short[3 * 256]; short* idx = gArray; short brightness = 0; for (int j = 0; j < 3; j++) { if (j == 0) brightness = red; if (j == 1) brightness = green;

Drawing polygon with more than one hole?

天大地大妈咪最大 提交于 2019-12-02 01:57:55
I'm trying to draw a polygon with more than one holes. I tried the following code and it does not work correctly. Please advise. PointF[] mypoly = new PointF[6 + 5 + 5]; mypoly[0] = new PointF(0, 0); mypoly[1] = new PointF(100, 0); mypoly[2] = new PointF(100, 100); mypoly[3] = new PointF(0, 100); mypoly[4] = new PointF(10, 80); mypoly[5] = new PointF(0, 0); mypoly[6] = new PointF(10, 10); mypoly[7] = new PointF(10, 20); mypoly[8] = new PointF(20, 20); mypoly[9] = new PointF(20, 10); mypoly[10] = new PointF(10, 10); mypoly[11] = new PointF(40, 10); mypoly[12] = new PointF(40, 20); mypoly[13] =

Intersecting GraphicsPath objects

狂风中的少年 提交于 2019-12-02 01:43:06
How can I intersect two (.NET) GraphicsPath objects? Are you trying to get the area enclosed by two different paths? That is a Region , not a path: var rgn1 = new Region(path1); var intersection = rgn1.Intersect(path2); rgn1.Dispose(); If that is not what you mean, you will have to provide more information. 来源: https://stackoverflow.com/questions/503376/intersecting-graphicspath-objects

海康大华网络摄像头高起播低延时RTSP网页无插件流媒体专用播放器EasyPlayer-RTSP之GDI和D3D两种视频渲染方式的区别介绍

亡梦爱人 提交于 2019-12-01 23:12:08
EasyPlayer是一个RTSP专属的流媒体播放器,在GitHub上开源大部分源码其主要功能有播放、抓图、录制视频、实时静音/取消静音。 GDI和D3D两种视频渲染方式的区别 EasyPlayer-RTSP windows播放器支持D3D和GDI两种渲染方式。 D3D支持格式如下: DISPLAY_FORMAT_YV12 DISPLAY_FORMAT_YUY2 DISPLAY_FORMAT_UYVY DISPLAY_FORMAT_A8R8G8B8 DISPLAY_FORMAT_X8R8G8B8 DISPLAY_FORMAT_RGB565 DISPLAY_FORMAT_RGB555 GDI支持格式如下: DISPLAY_FORMAT_RGB24_GDI GDI渲染方式则是我们熟知的采用GDI进行图像绘制,其优势就是通用性强,只要是目前常用的windows操作系统基本上都支持;其劣势就是效率比较低下,也只支持RGB24一种色彩格式显示; D3D渲染方式则刚好相反,其优势就是效率比较高,支持多种色彩格式进行渲染;劣势就是通用性较差,windows系统必须要支持D3D才可以使用,需要一定的硬件支撑。 GDI渲染格式界面选择如下: D3D渲染格式界面选择如下: 从界面上可以看出GDI方式的OSD字幕叠加比D3D方式有明显的区别

How to make my game engine faster (GDI+, C#)

半城伤御伤魂 提交于 2019-12-01 20:26:37
I'm currently building a 2D Game Engine in C#, using GDI. I do know that there are better alternatives to GDI but I'm also so deep into the project I can't turn back now. So, I currently have a graphics engine, that renders a portion of a bitmap, depending on what my cameras position and windows size is, which has given me a great performance boost. Great! However, I've noticed that if I place a bunch of game objects, in the same position, I get the same frame rate compared to if I placed the objects in different positions. So, maybe the graphics engine is rendering parts of the bitmap that

The result of CreateCompatibleDC only has two colors

那年仲夏 提交于 2019-12-01 18:23:41
In the following code, anytime CreateCompatibleDC is called, the resulting device context only has two colors: black and white. case WM_PAINT: { PAINTSTRUCT ps; ps.hdc=GetDC(g_CSkeletalViewerApp.m_hWnd); ps.fErase=true; RECT rc; GetWindowRect(g_CSkeletalViewerApp.m_hWnd, &rc ); ps.rcPaint=rc; int width = rc.right - rc.left; int height = rc.bottom - rc.top; HDC hdc=BeginPaint(hWnd,&ps); HDC memdc=CreateCompatibleDC(hdc); HBITMAP membm=CreateCompatibleBitmap(memdc,width,height); SelectObject(memdc,membm); for(int i=rc.left; i<rc.right; i++) { for(int j=rc.top; j<rc.bottom; j++) SetPixel(memdc,i

Draw mouse pointer icon?

北城余情 提交于 2019-12-01 18:18:09
问题 I am coding little fun gadget. I want to be able to draw second (or more) mouse pointer icons at different location than the original mouse but to move it according to move of original mouse. I know how to track movement of the mouse but I dunno how to draw/redraw mouse pointer; can anyone help? 回答1: This could be done like: (1) grab the current mouse cursor from your application, using LoadCursor ( http://msdn.microsoft.com/en-us/library/aa924571.aspx ). Just specify NULL, and the cursor you

The result of CreateCompatibleDC only has two colors

泪湿孤枕 提交于 2019-12-01 18:11:35
问题 In the following code, anytime CreateCompatibleDC is called, the resulting device context only has two colors: black and white. case WM_PAINT: { PAINTSTRUCT ps; ps.hdc=GetDC(g_CSkeletalViewerApp.m_hWnd); ps.fErase=true; RECT rc; GetWindowRect(g_CSkeletalViewerApp.m_hWnd, &rc ); ps.rcPaint=rc; int width = rc.right - rc.left; int height = rc.bottom - rc.top; HDC hdc=BeginPaint(hWnd,&ps); HDC memdc=CreateCompatibleDC(hdc); HBITMAP membm=CreateCompatibleBitmap(memdc,width,height); SelectObject

Draw mouse pointer icon?

白昼怎懂夜的黑 提交于 2019-12-01 17:41:45
I am coding little fun gadget. I want to be able to draw second (or more) mouse pointer icons at different location than the original mouse but to move it according to move of original mouse. I know how to track movement of the mouse but I dunno how to draw/redraw mouse pointer; can anyone help? This could be done like: (1) grab the current mouse cursor from your application, using LoadCursor ( http://msdn.microsoft.com/en-us/library/aa924571.aspx ). Just specify NULL, and the cursor you want. Or just load a bitmap for the cursor. Now, you have a bitmap. (2) Next step is to get the Device

教学、会议、展厅大并发无线互联网直播同屏实现之LibEasyScreenLive通过GDI方式实现屏幕捕获采集方法介绍

跟風遠走 提交于 2019-12-01 11:57:53
EasyScreenLive是一款简单、高效、稳定的集采集,编码,组播,推流和流媒体RTSP服务于一身的同屏功能组件,具低延时,高效能,低丢包等特点。 LibEasyScreenLive通过GDI方式实现屏幕捕获采集 windows端最通用的屏幕捕获方式就是通过GDI(图形设备接口)获取桌面的设备上下文DC,然后将其内容转换为RGB位图,从而转换成视频帧实现屏幕的采集,GDI是一种微软较为古老的技术,其采集效率相对较低,不过实现30fps帧率的桌面采集还是绰绰有余的,而且在设备性能较差或者操作系统版本较低的系统上也能兼容。 LibEasyScreenLive通过GDI方式实现屏幕捕获采集的实现主要是通过CCaptureScreen 类实现,该类声明如下: class CCaptureScreen { public: CCaptureScreen(void); ~CCaptureScreen(void); public: //Interface Function int SetCaptureCursor(bool bShow); int Init(HWND hShowWnd); void UnInit(); int StartScreenCapture(int nCapMode = 2, int fps = 25); void StopScreenCapture(); void