GDI fast scrolling

I am using GDI to create custom text input. I draw directly to the screen, not loaded.

Now I would like to implement some quick scrolling, just the pixels shift the corresponding part of the framebuffer (and only redraw the newly visible lines).

I noticed that, for example, rich text controls do this like this. If I use some of the GDI drawing functions to draw directly in the framebuffer, above the advanced text control, and then scroll the text with rich text, it also scrolls my drawing along with the text. therefore, I assume that rich text just pixels shifts its part of the framebuffer.

I would like to do the same, but I don’t know how to do it.

Can anyone help? (regardless of programming language))

thanks!

+4
source share
2 answers

The ScrollWindowEx () function is optimized for this.

+8
source

See BitBlt Function :

The BitBlt function performs a color data transmission bit block corresponding to a rectangle of pixels from the specified context source to the target device context.

and an example at the end of his documentation: Image capture :

You can use the bitmap to capture the image, and you can save the captured image in memory, display it at a different location in your application window. [...] In some cases, you may need an application to capture images and only store them temporarily. [...] To temporarily save the image, the application must call CreateCompatibleDC to create a DC that is compatible with the current DISTRICT OF COLOMBIA window. After creating a compatible DC, you create a bitmap using the appropriate sizes by calling the CreateCompatibleBitmap function and then select it in this context device by calling the SelectObject function.

After the agreed device context and the corresponding bitmap has been selected into it, you can capture the image. The BitBlt function captures images. This function transfers the bit block, which, it copies the data from the original bitmap to the destination bitmap. [...] To redisplay the image, call BitBlt a second time, specifying compatible DCs as the DC source and DC windows as the target DC.

+2
source

Source: https://habr.com/ru/post/1310741/


All Articles