gtkpreview.pp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. {
  2. }
  3. {****************************************************************************
  4. Interface
  5. ****************************************************************************}
  6. {$ifdef read_interface}
  7. type
  8. PGtkPreview = ^TGtkPreview;
  9. TGtkPreview = record
  10. widget : TGtkWidget;
  11. buffer : Pguchar;
  12. buffer_width : guint16;
  13. buffer_height : guint16;
  14. bpp : guint16;
  15. rowstride : guint16;
  16. dither : TGdkRgbDither;
  17. flag0 : {$ifdef win32}longint{$else}word{$endif};
  18. end;
  19. const
  20. bm_TGtkPreview_type = $1;
  21. bp_TGtkPreview_type = 0;
  22. bm_TGtkPreview_expand = $2;
  23. bp_TGtkPreview_expand = 1;
  24. function thetype(var a : TGtkPreview) : guint;
  25. procedure set_thetype(var a : TGtkPreview; __type : guint);
  26. function expand(var a : TGtkPreview) : guint;
  27. procedure set_expand(var a : TGtkPreview; __expand : guint);
  28. type
  29. PGtkPreviewInfo = ^TGtkPreviewInfo;
  30. PGtkDitherInfo = ^TGtkDitherInfo;
  31. TGtkPreviewInfo = record
  32. visual : PGdkVisual;
  33. cmap : PGdkColormap;
  34. lookup : Pguchar;
  35. gamma : gdouble;
  36. end;
  37. TGtkDitherInfo = record
  38. case longint of
  39. 0 : ( s : array[0..1] of gushort );
  40. 1 : ( c : array[0..3] of guchar );
  41. end;
  42. PGtkPreviewClass = ^TGtkPreviewClass;
  43. TGtkPreviewClass = record
  44. parent_class : TGtkWidgetClass;
  45. info : TGtkPreviewInfo;
  46. end;
  47. Type
  48. GTK_PREVIEW=PGtkPreview;
  49. GTK_PREVIEW_CLASS=PGtkPreviewClass;
  50. function GTK_PREVIEW_TYPE:TGtkType;cdecl;external gtkdll name 'gtk_preview_get_type';
  51. function GTK_IS_PREVIEW(obj:pointer):boolean;
  52. function GTK_IS_PREVIEW_CLASS(klass:pointer):boolean;
  53. function gtk_preview_get_type:TGtkType;cdecl;external gtkdll name 'gtk_preview_get_type';
  54. procedure gtk_preview_uninit;cdecl;external gtkdll name 'gtk_preview_uninit';
  55. function gtk_preview_new(thetype:TGtkPreviewType):PGtkWidget;cdecl;external gtkdll name 'gtk_preview_new';
  56. procedure gtk_preview_size(preview:PGtkPreview; width:gint; height:gint);cdecl;external gtkdll name 'gtk_preview_size';
  57. procedure gtk_preview_put(preview:PGtkPreview; window:PGdkWindow; gc:PGdkGC; srcx:gint; srcy:gint;destx:gint; desty:gint; width:gint; height:gint);cdecl;external gtkdll name 'gtk_preview_put';
  58. procedure gtk_preview_draw_row(preview:PGtkPreview; data:Pguchar; x:gint; y:gint; w:gint);cdecl;external gtkdll name 'gtk_preview_draw_row';
  59. procedure gtk_preview_set_expand(preview:PGtkPreview; expand:gint);cdecl;external gtkdll name 'gtk_preview_set_expand';
  60. procedure gtk_preview_set_gamma(gamma:double);cdecl;external gtkdll name 'gtk_preview_set_gamma';
  61. procedure gtk_preview_set_color_cube(nred_shades:guint; ngreen_shades:guint; nblue_shades:guint; ngray_shades:guint);cdecl;external gtkdll name 'gtk_preview_set_color_cube';
  62. procedure gtk_preview_set_install_cmap(install_cmap:gint);cdecl;external gtkdll name 'gtk_preview_set_install_cmap';
  63. procedure gtk_preview_set_reserved(nreserved:gint);cdecl;external gtkdll name 'gtk_preview_set_reserved';
  64. procedure gtk_preview_set_dither(preview:PGtkPreview; dither:TGdkRgbDither);cdecl;external gtkdll name 'gtk_preview_set_dither';
  65. function gtk_preview_get_visual:PGdkVisual;cdecl;external gtkdll name 'gtk_preview_get_visual';
  66. function gtk_preview_get_cmap:PGdkColormap;cdecl;external gtkdll name 'gtk_preview_get_cmap';
  67. function gtk_preview_get_info:PGtkPreviewInfo;cdecl;external gtkdll name 'gtk_preview_get_info';
  68. procedure gtk_preview_reset;cdecl;external gtkdll name 'gtk_preview_reset';
  69. {$endif read_interface}
  70. {****************************************************************************
  71. Implementation
  72. ****************************************************************************}
  73. {$ifdef read_implementation}
  74. function thetype(var a : TGtkPreview) : guint;
  75. begin
  76. thetype:=(a.flag0 and bm_TGtkPreview_type) shr bp_TGtkPreview_type;
  77. end;
  78. procedure set_thetype(var a : TGtkPreview; __type : guint);
  79. begin
  80. a.flag0:=a.flag0 or ((__type shl bp_TGtkPreview_type) and bm_TGtkPreview_type);
  81. end;
  82. function expand(var a : TGtkPreview) : guint;
  83. begin
  84. expand:=(a.flag0 and bm_TGtkPreview_expand) shr bp_TGtkPreview_expand;
  85. end;
  86. procedure set_expand(var a : TGtkPreview; __expand : guint);
  87. begin
  88. a.flag0:=a.flag0 or ((__expand shl bp_TGtkPreview_expand) and bm_TGtkPreview_expand);
  89. end;
  90. function GTK_IS_PREVIEW(obj:pointer):boolean;
  91. begin
  92. GTK_IS_PREVIEW:=(obj<>nil) and GTK_IS_PREVIEW_CLASS(PGtkTypeObject(obj)^.klass);
  93. end;
  94. function GTK_IS_PREVIEW_CLASS(klass:pointer):boolean;
  95. begin
  96. GTK_IS_PREVIEW_CLASS:=(klass<>nil) and (PGtkTypeClass(klass)^.thetype=GTK_PREVIEW_TYPE);
  97. end;
  98. {$endif read_implementation}