0

When you have a TextLayout which is just partially visible and don't want to render everything, are there any methods to change the startingpoint for rendering?

CComPtr<ID2D1BitmapRenderTarget>        _bitmaprendertarget;
_bitmaprendertarget->DrawTextLayout(D2D1_POINT_2F{ (FLOAT)x, (FLOAT)y }, tLayout, _solidColorBrush, D2D1_DRAW_TEXT_OPTIONS_CLIP);

In this example x and y reflect just the destination point where the TextLayout is drawn to on the rendertarget. I am looking for a way to render it partially instead - so it doesn't get drawn completely.

P Weiss
  • 1
  • 1
  • 1
  • The most simple way is to clip the render target https://learn.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-pushaxisalignedclip(constd2d1_rect_f__d2d1_antialias_mode) – Simon Mourier Mar 25 '21 at 10:01
  • Yes, just set a clip, and use DrawTextLayout(origin) to position output. – bunglehead Mar 25 '21 at 16:56
  • So using a Layer is the only way? – P Weiss Mar 25 '21 at 17:33
  • PushAxisAlignedClip is not a layer: https://learn.microsoft.com/en-us/windows/win32/direct2d/direct2d-layers-overview#alternatives-to-layers – Simon Mourier Mar 25 '21 at 17:49
  • @PWeiss, another option might be to set layout size with SetMaxWidth/SetMaxHeight, and then use D2D1_DRAW_TEXT_OPTIONS_CLIP. – bunglehead Mar 25 '21 at 19:18

0 Answers0