Recent

Author Topic: Custom shape of forms with X11  (Read 159 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 2727
    • StrumPract is the musicians best friend
Custom shape of forms with X11
« on: June 15, 2022, 04:02:49 am »
Hello.

I try to find a nice way to do custom shapes of forms for X11/XWayland.

X11 gives XDrawRectangle, XFillRectangle and  XDrawArc, XFillArc for this.

Example, a from with shape ellipse:

Code: Pascal  [Select][+][-]
  1.  XDrawarc(appdisp, pmap, shape_gc, 0, 0, width-1 , height-1,  0, 360*64);
  2.  XFillarc(appdisp, pmap, shape_gc, 0, 0, width-1 , height-1,  0, 360*64);

Now for complex shapes, other developers advice to use many XDrawRectangle+XFillRectangle of different sizes.
And all those rectangles will do the wanted custom form.

Example of a rectangle:

Code: Pascal  [Select][+][-]
  1.  XDrawRectangle(appdisp, pmap, shape_gc, width div 2, 0,  width , height div 3);
  2.  XFillRectangle(appdisp, pmap, shape_gc, width div 2, 0,  width , height div 3);

OK, but using a bitmap monochrome b/w where all the black shapes should be replaced by those rectangles, what would be the steps?
Maybe using BGRABitmap to scan the monochrome bitmap and then create the rectangles?

Any idea is welcome.

Thanks.

Fre;D
« Last Edit: June 15, 2022, 04:20:46 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018