Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-05

[RE : AppWindow Capture Under Linux]

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

cyberpython

I have managed to get to some point but I seem to always get an empty(0 bytes) png file.

unit Unit1;
{$mode objfpc}{$H+}
interface

uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,

  StdCtrls, gdk, gdkpixbuf, gdk2pixbuf, gdk2, glib2;
type
  { TForm1 }
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;
var
  Form1: TForm1;
implementation

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
 desktop : PGdkWindow;
 screenshot : PGdkPixbuf;
 w, h : longint;
 err : PPGError;
begin
 desktop := gdk_get_default_root_window;
 w := screen.Width;
 h := screen.Height;
 screenshot:=gdk_pixbuf_get_from_drawable(screenshot, desktop,
gdk_window_get_colormap(desktop) , 0, 0, 0, 0, w, h);
 gdk_pixbuf_save(screenshot, pchar('/home/cyberpython/01.png'),
pchar('png') , err);
end;
initialization
  {$I unit1.lrs}
end.

Reply by email