diff options
162 files changed, 8965 insertions, 430 deletions
diff --git a/doc/blank_template.html b/doc/blank_template.html index d624fee..4f5f09b 100644 --- a/doc/blank_template.html +++ b/doc/blank_template.html @@ -14,6 +14,9 @@ <h2> Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/common_dialogs.html b/doc/common_dialogs.html index 0676bf8..a35be43 100644 --- a/doc/common_dialogs.html +++ b/doc/common_dialogs.html @@ -14,6 +14,9 @@ <h2>Common Dialogs Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl.html b/doc/fl.html index f1da128..254a06e 100644 --- a/doc/fl.html +++ b/doc/fl.html @@ -14,6 +14,9 @@ <h2>Fl Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package names</th></tr> @@ -219,6 +222,11 @@ <td> </td> </tr> + <tr> + <td>Fl_Cursor</td> + <td>Mouse_Cursor</td> + </tr> + </table> diff --git a/doc/fl_adjuster.html b/doc/fl_adjuster.html index 3fdbfa9..ee3d7a3 100644 --- a/doc/fl_adjuster.html +++ b/doc/fl_adjuster.html @@ -14,6 +14,9 @@ <h2>Fl_Adjuster Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_bitmap.html b/doc/fl_bitmap.html index 4d22550..57d8a2a 100644 --- a/doc/fl_bitmap.html +++ b/doc/fl_bitmap.html @@ -14,6 +14,9 @@ <h2>Fl_Bitmap Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -49,15 +52,15 @@ <tr> <td><pre> Fl_Bitmap(const uchar *bits, int W, int H); -</pre></td> -<td> </td> - </tr> - <tr> -<td><pre> Fl_Bitmap(const char *bits, int W, int H); </pre></td> -<td> </td> +<td><pre> +function Create + (Data : in Color_Component_Array; + Width, Height : in Natural) + return Bitmap; +</pre></td> </tr> <tr> @@ -110,21 +113,24 @@ procedure Draw <td><pre> virtual void label(Fl_Widget *w); </pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> virtual void label(Fl_Menu_Item *m); </pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> virtual void uncache(); </pre></td> -<td> </td> +<td><pre> +procedure Uncache + (This : in out Bitmap); +</pre></td> </tr> </table> diff --git a/doc/fl_bmp_image.html b/doc/fl_bmp_image.html index dd0ce62..f017fe2 100644 --- a/doc/fl_bmp_image.html +++ b/doc/fl_bmp_image.html @@ -14,6 +14,9 @@ <h2>Fl_BMP_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_box.html b/doc/fl_box.html index 3f5c5f8..141718b 100644 --- a/doc/fl_box.html +++ b/doc/fl_box.html @@ -14,6 +14,9 @@ <h2>Fl_Box Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_button.html b/doc/fl_button.html index be21c60..dc4af7e 100644 --- a/doc/fl_button.html +++ b/doc/fl_button.html @@ -14,6 +14,9 @@ <h2>Fl_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_chart.html b/doc/fl_chart.html index a9041e7..e143d80 100644 --- a/doc/fl_chart.html +++ b/doc/fl_chart.html @@ -14,6 +14,9 @@ <h2>Fl_Chart Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_check_button.html b/doc/fl_check_button.html index 22405bd..f7a73c1 100644 --- a/doc/fl_check_button.html +++ b/doc/fl_check_button.html @@ -14,6 +14,9 @@ <h2>Fl_Check_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_choice.html b/doc/fl_choice.html index 34b8778..1772272 100644 --- a/doc/fl_choice.html +++ b/doc/fl_choice.html @@ -14,6 +14,9 @@ <h2>Fl_Choice Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_clock.html b/doc/fl_clock.html index 5e37577..9a61274 100644 --- a/doc/fl_clock.html +++ b/doc/fl_clock.html @@ -14,6 +14,9 @@ <h2>Fl_Clock Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_clock_output.html b/doc/fl_clock_output.html index 92aaf37..cb3ec0a 100644 --- a/doc/fl_clock_output.html +++ b/doc/fl_clock_output.html @@ -14,6 +14,9 @@ <h2>Fl_Clock_Output Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_color_chooser.html b/doc/fl_color_chooser.html index 66a14a7..0b5fdd8 100644 --- a/doc/fl_color_chooser.html +++ b/doc/fl_color_chooser.html @@ -14,6 +14,9 @@ <h2>Fl_Color_Chooser Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_copy_surface.html b/doc/fl_copy_surface.html index 2fc1451..62105ba 100644 --- a/doc/fl_copy_surface.html +++ b/doc/fl_copy_surface.html @@ -14,6 +14,9 @@ <h2>Fl_Copy_Surface Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_counter.html b/doc/fl_counter.html index fce7fa4..146576a 100644 --- a/doc/fl_counter.html +++ b/doc/fl_counter.html @@ -14,6 +14,9 @@ <h2>Fl_Counter Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_device.html b/doc/fl_device.html index 5e62da8..b02fde6 100644 --- a/doc/fl_device.html +++ b/doc/fl_device.html @@ -14,6 +14,9 @@ <h2>Fl_Device Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_dial.html b/doc/fl_dial.html index 9c54e4b..c071fc7 100644 --- a/doc/fl_dial.html +++ b/doc/fl_dial.html @@ -14,6 +14,9 @@ <h2>Fl_Dial Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_double_window.html b/doc/fl_double_window.html index cc8a75b..d0655ae 100644 --- a/doc/fl_double_window.html +++ b/doc/fl_double_window.html @@ -14,6 +14,9 @@ <h2>Fl_Double_Window Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_draw.html b/doc/fl_draw.html new file mode 100644 index 0000000..654d586 --- /dev/null +++ b/doc/fl_draw.html @@ -0,0 +1,1268 @@ + +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Fl_Draw Binding Map</title> + <link href="map.css" rel="stylesheet"> + </head> + + <body> + + +<h2>Fl_Draw Binding Map</h2> + + +<a href="index.html">Back to Index</a> + + +<table class="package"> + <tr><th colspan="2">Package name</th></tr> + + <tr> + <td>Fl_Draw</td> + <td>FLTK.Draw</td> + </tr> + +</table> + + + +<table class="type"> + <tr><th colspan="2">Types</th></tr> + + <tr> + <td>Fl_Line</td> + <td>Line_Kind</td> + </tr> + + <tr> + <td> </td> + <td>Cap_Kind</td> + </tr> + + <tr> + <td> </td> + <td>Join_Kind</td> + </tr> + + <tr> + <td> </td> + <td>Dash_Length</td> + </tr> + + <tr> + <td> </td> + <td>Dash_Gap</td> + </tr> + + <tr> + <td> </td> + <td>Dash_Gap_Array</td> + </tr> + + <tr> + <td> </td> + <td>Text_Draw_Function</td> + </tr> + + <tr> + <td> </td> + <td>Symbol_Draw_Function</td> + </tr> + + <tr> + <td> </td> + <td>Area_Draw_Function</td> + </tr> + + <tr> + <td> </td> + <td>Draw_Error</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> +int fl_add_symbol(const char *name, void(*drawit)(Fl_Color), + int scalable); +</pre></td> +<td><pre> +procedure Add_Symbol + (Text : in String; + Func : in Symbol_Drawing_Function; + Scalable : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_arc(double x, double y, double r, double start, double end); +</pre></td> +<td><pre> +procedure Arc + (X, Y, R, Start, Finish : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_arc(int x, int y, int w, int h, double a1, double a2); +</pre></td> +<td><pre> +procedure Arc + (X, Y, W, H : in Integer; + Start, Finish : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_begin_complex_polygon(); +</pre></td> +<td><pre> +procedure Begin_Complex_Polygon; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_begin_line(); +</pre></td> +<td><pre> +procedure Begin_Line; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_begin_loop(); +</pre></td> +<td><pre> +procedure Begin_Loop; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_begin_points(); +</pre></td> +<td><pre> +procedure Begin_Points; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_begin_polygon(); +</pre></td> +<td><pre> +procedure Begin_Polygon; +</pre></td> + </tr> + + <tr> +<td><pre> +char fl_can_do_alpha_blending(); +</pre></td> +<td><pre> +function Can_Do_Alpha_Blending + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_chord(int x, int y, int w, int h, double a1, double a2); +</pre></td> +<td><pre> +procedure Chord + (X, Y, W, H : in Integer; + Angle1, Angle2 : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_circle(double x, double y, double r); +</pre></td> +<td><pre> +procedure Circle + (X, Y, R : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_clip_box(int x, int y, int w, int h, + int &X, int &Y, int &W, int &H); +</pre></td> +<td><pre> +function Clip_Box + (X, Y, W, H : in Integer; + BX, BY, BW, BH : out Integer) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Region fl_clip_region(); +</pre></td> +<td>Left unbound due to being OS-specific</td> + </tr> + + <tr> +<td><pre> +void fl_clip_region(Fl_Region r); +</pre></td> +<td>Left unbound due to being OS-specific</td> + </tr> + + <tr> +<td><pre> +Fl_Color fl_color(); +</pre></td> +<td><pre> +function Get_Color + return Color; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_color(Fl_Color c); +</pre></td> +<td><pre> +procedure Set_Color + (To : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_color(int c); +</pre></td> +<td>Not applicable; original is deprecated.</td> + </tr> + + <tr> +<td><pre> +void fl_color(uchar r, uchar g, uchar b); +</pre></td> +<td><pre> +procedure Set_Color + (R, G, B : in Color_Component); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_cursor(Fl_Cursor); +</pre></td> +<td><pre> +procedure Set_Cursor + (To : in Mouse_Cursor); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_cursor(Fl_Cursor, Fl_Color fg, Fl_Color bg=FL_WHITE); +</pre></td> +<td><pre> +procedure Set_Cursor + (To : in Mouse_Cursor; + Fore : in Color; + Back : in Color := White_Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_curve(double X0, double Y0, double X1, double Y1, + double X2, double Y2, double X3, double Y3); +</pre></td> +<td><pre> +procedure Curve + (X0, Y0 : in Long_Float; + X1, Y1 : in Long_Float; + X2, Y2 : in Long_Float; + X3, Y3 : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_descent(); +</pre></td> +<td><pre> +function Font_Descent + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw(const char *str, int n, int x, int y); + +void fl_draw(const char *str, int x, int y); +</pre></td> +<td><pre> +procedure Draw_Text + (X, Y : in Integer; + Text : in String); +with Pre => Text'Length > 0; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw(const char *str, int x, int y, int w, int h, + Fl_Align align, Fl_Image *img=0, int draw_symbols=1); +</pre></td> +<td><pre> +procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Symbols : in Boolean := True); + +procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Picture : in FLTK.Images.Image'Class; + Symbols : in Boolean := True); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw(const char *str, int x, int y, int w, int h, + Fl_Align align, void (*callthis)(const char *, int, int, int), + Fl_Image *img=0, int draw_symbols=1); +</pre></td> +<td><pre> +procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Func : in Text_Drawing_Function; + Symbols : in Boolean := True); + +procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Func : in Text_Drawing_Function; + Picture : in FLTK.Images.Image'Class; + Symbols : in Boolean := True); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw(int angle, const char *str, int n, int x, int y); + +void fl_draw(int angle, const char *str, int x, int y); +</pre></td> +<td><pre> +procedure Draw_Text + (X, Y : in Integer; + Text : in String; + Angle : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color); +</pre></td> +<td><pre> +procedure Draw_Box + (X, Y, W, H : in Integer; + Kind : in Box_Kind; + Hue : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw_image(const uchar *buf, int X, int Y, + int W, int H, int D=3, int L=0); +</pre></td> +<td><pre> +procedure Draw_Image + (X, Y, W, H : in Integer; + Data : in Color_Component_Array; + Depth : in Positive := 3; + Line_Data : in Natural := 0; + Flip_Horizontal : in Boolean := False; + Flip_Vertical : in Boolean := False); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw_image(Fl_Draw_Image_Cb cb, void *data, + int X, int Y, int W, int H, int D=3); +</pre></td> +<td><pre> +procedure Draw_Image + (X, Y, W, H : in Integer; + Callback : in Image_Draw_Function; + Depth : in Positive := 3); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw_image_mono(const uchar *buf, int X, int Y, + int W, int H, int D=1, int L=0); +</pre></td> +<td><pre> +procedure Draw_Image_Mono + (X, Y, W, H : in Integer; + Data : in Color_Component_Array; + Depth : in Positive := 1; + Line_Data : in Natural := 0; + Flip_Horizontal : Boolean := False; + Flip_Vertical : Boolean := False); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void *data, + int X, int Y, int W, int H, int D=1); +</pre></td> +<td><pre> +procedure Draw_Image_Mono + (X, Y, W, H : in Integer; + Callback : in Image_Draw_Function; + Depth : in Positive := 1); +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_draw_pixmap(char * const *data, int x, int y, + Fl_Color=FL_GRAY); +</pre></td> +<td><pre> + +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_draw_pixmap(const char * const *cdata, int x, int y, + Fl_Color=FL_GRAY); +</pre></td> +<td><pre> + +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_draw_symbol(const char *label, int x, int y, + int w, int h, Fl_Color); +</pre></td> +<td><pre> +procedure Draw_Symbol + (X, Y, W, H : in Integer; + Name : in String; + Hue : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_end_complex_polygon(); +</pre></td> +<td><pre> +procedure End_Complex_Polygon; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_end_line(); +</pre></td> +<td><pre> +procedure End_Line; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_end_loop(); +</pre></td> +<td><pre> +procedure End_Loop; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_end_points(); +</pre></td> +<td><pre> +procedure End_Points; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_end_polygon(); +</pre></td> +<td><pre> +procedure End_Polygon; +</pre></td> + </tr> + + <tr> +<td><pre> +const char * fl_expand_text(const char *from, char *buf, int maxbuf, + double maxw, int &n, double &width, int wrap, int draw_symbols=0); +</pre></td> +<td><pre> + +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Font fl_font(); +</pre></td> +<td><pre> +function Get_Font + return Font_Kind; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_font(Fl_Font face, Fl_Fontsize fsize); +</pre></td> +<td><pre> +procedure Set_Font + (Kind : in Font_Kind; + Size : in Font_Size); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_frame(const char *s, int x, int y, int w, int h); + +void fl_frame2(const char *s, int x, int y, int w, int h); +</pre></td> +<td><pre> +procedure Frame + (X, Y, W, H : in Integer; + Top, Left, Bottom, Right : in Greyscale); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_gap(); +</pre></td> +<td><pre> +procedure Gap; +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_height(); +</pre></td> +<td><pre> +function Font_Line_Spacing + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_height(int font, int size); +</pre></td> +<td><pre> +function Font_Height + (Kind : in Font_Kind; + Size : in Font_Size) + return Natural; +</pre></td> + </tr> + + <tr> +<td><pre> +const char * fl_latin1_to_local(const char *t, int n=-1); +</pre></td> +<td><pre> +function Latin1_To_Local + (From : in String) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_line(int x, int y, int x1, int y1); +</pre></td> +<td><pre> +procedure Line + (X0, Y0 : in Integer; + X1, Y1 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_line(int x, int y, int x1, int y1, int x2, int y2); +</pre></td> +<td><pre> +procedure Line + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_line_style(int style, int width=0, char *dashes=0); +</pre></td> +<td><pre> +procedure Set_Line_Style + (Line : in Line_Kind := Solid_Line; + Cap : in Cap_Kind := Default_Cap; + Join : in Join_Kind := Default_Join; + Width : in Natural := 0; + Dashes : in Dash_Gap_Array := Empty_Dashes); +</pre></td> + </tr> + + <tr> +<td><pre> +const char * fl_local_to_latin1(const char *t, int n=-1); +</pre></td> +<td><pre> +function Local_To_Latin1 + (From : in String) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +const char * fl_local_to_mac_roman(const char *t, int n=-1); +</pre></td> +<td><pre> +function Local_To_Mac_Roman + (From : in String) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_loop(int x, int y, int x1, int y1, int x2, int y2); +</pre></td> +<td><pre> +procedure Outline + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_loop(int x, int y, int x1, int y1, + int x2, int y2, int x3, int y3); +</pre></td> +<td><pre> +procedure Outline + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer; + X3, Y3 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +const char * fl_mac_roman_to_local(const char *t, int n=-1); +</pre></td> +<td><pre> +function Mac_Roman_To_Local + (From : in String) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_measure(const char *str, int &x, int &y, int draw_symbols=1); +</pre></td> +<td><pre> +procedure Measure + (Text : in String; + W, H : out Natural; + Symbols : in Boolean := True; + Wrap : in Natural := 0); +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_measure_pixmap(char *const *data, int &w, int &h); +</pre></td> +<td><pre> + +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_measure_pixmap(const char *const *cdata, int &w, int &h); +</pre></td> +<td><pre> + +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_mult_matrix(double a, double b, double c, double d, + double x, double y); +</pre></td> +<td><pre> +procedure Mult_Matrix + (A, B, C, D, X, Y : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +int fl_not_clipped(int x, int y, int w, int h); +</pre></td> +<td><pre> +function Clip_Intersects + (X, Y, W, H : in Integer) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int fl_old_shortcut(const char *s); +</pre></td> +<td>Not applicable; original is legacy.</td> + </tr> + + <tr> +<td><pre> +void fl_overlay_clear(); +</pre></td> +<td><pre> +procedure Overlay_Clear(); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_overlay_rect(int x, int y, int w, int h); +</pre></td> +<td><pre> +procedure Overlay_Rect + (X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_pie(int x, int y, int w, int h, double a1, double a2); +</pre></td> +<td><pre> +procedure Pie + (X, Y, W, H : in Integer; + Angle1, Angle2 : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_point(int x, int y); +</pre></td> +<td><pre> +procedure Point + (X, Y : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_polygon(int x, int y, int x1, int y1, int x2, int y2); +</pre></td> +<td><pre> +procedure Polygon + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_polygon(int x, int y, int x1, int y1, + int x2, int y2, int x3, int y3); +</pre></td> +<td><pre> +procedure Polygon + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer; + X3, Y3 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_pop_clip(); +</pre></td> +<td><pre> +procedure Pop_Clip(); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_pop_matrix(); +</pre></td> +<td><pre> +procedure Pop_Matrix; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_push_clip(int x, int y, int w, int h); +</pre></td> +<td><pre> +procedure Push_Clip + (X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_push_matrix(); +</pre></td> +<td><pre> +procedure Push_Matrix; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_push_no_clip(); +</pre></td> +<td><pre> +procedure Push_No_Clip; +</pre></td> + </tr> + + <tr> +<td><pre> +uchar * fl_read_image(uchar *p, int X, int Y, int W, int H, + int alpha=0); +</pre></td> +<td><pre> +function Read_Image + (X, Y, W, H : in Integer; + Alpha : in Integer := 0) + return Color_Component_Array +with Post => + (if Alpha = 0 + then Read_Image'Result'Length = W * H * 3 + else Read_Image'Result'Length = W * H * 4); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_rect(int x, int y, int w, int h); +</pre></td> +<td><pre> +procedure Rect + (X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_rect(int x, int y, int w, int h, Fl_Color c); +</pre></td> +<td><pre> +procedure Rect + (X, Y, W, H : in Integer; + Hue : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_rectf(int x, int y, int w, int h); +</pre></td> +<td><pre> +procedure Rect_Fill + (X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_rectf(int x, int y, int w, int h, Fl_Color c); +</pre></td> +<td><pre> +procedure Rect_Fill + (X, Y, W, H : in Integer; + Hue : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b); +</pre></td> +<td><pre> +procedure Rect_Fill + (X, Y, W, H : in Integer; + R, G, B : in Color_Component); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_reset_spot(); +</pre></td> +<td><pre> +procedure Reset_Spot; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_restore_clip(); +</pre></td> +<td><pre> +procedure Restore_Clip; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_rotate(double d); +</pre></td> +<td><pre> +procedure Rotate + (Angle : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_rtl_draw(const char *str, int n, int x, int y); +</pre></td> +<td><pre> +procedure Draw_Text_Right_Left + (X, Y : in Integer; + Text : in String); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_scale(double x); +</pre></td> +<td><pre> +procedure Scale + (Factor : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_scale(double x, double y); +</pre></td> +<td><pre> +procedure Scale + (Factor_X, Factor_Y : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_scroll(int X, int Y, int W, int H, int dx, int dy, + void(*draw_area)(void *, int, int, int, int), void *data); +</pre></td> +<td><pre> +procedure Scroll + (X, Y, W, H : in Integer; + DX, DY : in Integer; + Callback : in Area_Draw_Function); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_set_spot(int font, int size, int X, int Y, + int W, int H, Fl_Window *win=0); +</pre></td> +<td><pre> +procedure Set_Spot + (X, Y, W, H : in Integer; + Font : in Font_Kind; + Size : in Font_Size); + +procedure Set_Spot + (X, Y, W, H : in Integer; + Font : in Font_Kind; + Size : in Font_Size; + Pane : in FLTK.Widgets.Groups.Windows.Window'Class); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_set_status(int X, int Y, int W, int H); +</pre></td> +<td><pre> +procedure Set_Status + (X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +const char * fl_shortcut_label(unsigned int shortcut); + +const char * fl_shortcut_label(unsigned int shortcut, + const char **eom); +</pre></td> +<td><pre> +function Shortcut_Label + (Keys : in Key_Combo) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Fontsize fl_size(); +</pre></td> +<td><pre> +function Get_Font_Size + return Font_Size; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_text_extents(const char *, + int &dx, int &dy, int &w, int &h); + +void fl_text_extents(const char *t, int n, + int &dx, int &dy, int &w, int &h); +</pre></td> +<td><pre> +procedure Text_Extents + (Text : in String; + DX, DY, W, H : out Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +double fl_transform_dx(double x, double y); +</pre></td> +<td><pre> +function Transform_DX + (X, Y : in Long_Float) + return Long_Float; +</pre></td> + </tr> + + <tr> +<td><pre> +double fl_transform_dy(double x, double y); +</pre></td> +<td><pre> +function Transform_DY + (X, Y : in Long_Float) + return Long_Float; +</pre></td> + </tr> + + <tr> +<td><pre> +double fl_transform_x(double x, double y); +</pre></td> +<td><pre> +function Transform_X + (X, Y : in Long_Float) + return Long_Float; +</pre></td> + </tr> + + <tr> +<td><pre> +double fl_transform_y(double x, double y); +</pre></td> +<td><pre> +function Transform_Y + (X, Y : in Long_Float) + return Long_Float; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_transformed_vertex(double xf, double yf); +</pre></td> +<td><pre> +procedure Transformed_Vertex + (XF, YF : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_translate(double x, double y); +</pre></td> +<td><pre> +procedure Translate + (X, Y : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_vertex(double x, double y); +</pre></td> +<td><pre> +procedure Vertex + (X, Y : in Long_Float); +</pre></td> + </tr> + + <tr> +<td><pre> +double fl_width(const char *txt); + +double fl_width(const char *txt, int n); +</pre></td> +<td><pre> +function Width + (Text : in String) + return Long_Float; +</pre></td> + </tr> + + <tr> +<td><pre> +double fl_width(unsigned int c); +</pre></td> +<td><pre> +function Width + (Glyph : in Character) + return Long_Float; + +function Width + (Glyph : in Wide_Character) + return Long_Float; + +function Width + (Glyph : in Wide_Wide_Character) + return Long_Float; +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_xyline(int x, int y, int x1); +</pre></td> +<td><pre> +procedure Ecks_Why_Line + (X0, Y0, X1 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_xyline(int x, int y, int x1, int y2); +</pre></td> +<td><pre> +procedure Ecks_Why_Line + (X0, Y0, X1, Y2 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_xyline(int x, int y, int x1, int y2, int x3); +</pre></td> +<td><pre> +procedure Ecks_Why_Line + (X0, Y0, X1, Y2, X3 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_yxline(int x, int y, int y1); +</pre></td> +<td><pre> +procedure Why_Ecks_Line + (X0, Y0, Y1 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_yxline(int x, int y, int y1, int x2); +</pre></td> +<td><pre> +procedure Why_Ecks_Line + (X0, Y0, Y1, X2 : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fl_yxline(int x, int y, int y1, int x2, int y3); +</pre></td> +<td><pre> +procedure Why_Ecks_Line + (X0, Y0, Y1, X2, Y3 : in Integer); +</pre></td> + </tr> + +</table> + + + </body> +</html> + diff --git a/doc/fl_file_input.html b/doc/fl_file_input.html index d98c29c..f1cf43e 100644 --- a/doc/fl_file_input.html +++ b/doc/fl_file_input.html @@ -14,6 +14,9 @@ <h2>Fl_File_Input Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_fill_dial.html b/doc/fl_fill_dial.html index 26c50b5..a41d1d6 100644 --- a/doc/fl_fill_dial.html +++ b/doc/fl_fill_dial.html @@ -14,6 +14,9 @@ <h2>Fl_Fill_Dial Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_fill_slider.html b/doc/fl_fill_slider.html index c42a5e1..ee78eb4 100644 --- a/doc/fl_fill_slider.html +++ b/doc/fl_fill_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Fill_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_float_input.html b/doc/fl_float_input.html index 04afafe..21189e9 100644 --- a/doc/fl_float_input.html +++ b/doc/fl_float_input.html @@ -14,6 +14,9 @@ <h2>Fl_Float_Input Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_gif_image.html b/doc/fl_gif_image.html index 6117095..3675b80 100644 --- a/doc/fl_gif_image.html +++ b/doc/fl_gif_image.html @@ -14,6 +14,9 @@ <h2>Fl_GIF_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_gl_window.html b/doc/fl_gl_window.html new file mode 100644 index 0000000..da3f197 --- /dev/null +++ b/doc/fl_gl_window.html @@ -0,0 +1,397 @@ + +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Fl_Gl_Window Binding Map</title> + <link href="map.css" rel="stylesheet"> + </head> + + <body> + + +<h2>Fl_Gl_Window Binding Map</h2> + + +<a href="index.html">Back to Index</a> + + +<table class="package"> + <tr><th colspan="2">Package name</th></tr> + + <tr> + <td>Fl_Gl_Window</td> + <td>FLTK.Widgets.Groups.Windows.OpenGL</td> + </tr> + +</table> + + + +<table class="type"> + <tr><th colspan="2">Types</th></tr> + + <tr> + <td>Fl_Gl_Window</td> + <td>GL_Window</td> + </tr> + + <tr> + <td> </td> + <td>GL_Window_Reference</td> + </tr> + + <tr> + <td> </td> + <td>Mode_Mask</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Static Functions and Procedures</th></tr> + + <tr> +<td><pre> +static int can_do(const int *m); +</pre></td> +<td> +Not applicable due to not being part of the public stable API +</td> + </tr> + + <tr> +<td><pre> +static int can_do(int m); +</pre></td> +<td><pre> +function Can_Do + (Mask : in Mode_Mask) + return Boolean; +</pre></td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> +Fl_Gl_Window(int W, int H, const char *l=0); +</pre></td> +<td><pre> +function Create + (W, H : in Integer; + Text : in String := "") + return GL_Window; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0); +</pre></td> +<td><pre> +function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return GL_Window; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual Fl_Gl_Window * as_gl_window(); +</pre></td> +<td> +Use view conversion and tag membership tests instead +</td> + </tr> + + <tr> +<td><pre> +int can_do(); +</pre></td> +<td><pre> +function Can_Do + (This : in GL_Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +int can_do_overlay(); +</pre></td> +<td><pre> +function Can_Do_Overlay + (This : in GL_Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void * context() const; +</pre></td> +<td><pre> +function Get_Context + (This : in GL_Window) + return System.Address; +</pre></td> + </tr> + + <tr> +<td><pre> +void context(void *, int destroy_flag=0); +</pre></td> +<td><pre> +procedure Set_Context + (This : in out GL_Window; + Struct : in System.Address; + Destroy : in Boolean := False); +</pre></td> + </tr> + + <tr> +<td><pre> +char context_valid() const; +</pre></td> +<td><pre> +function Get_Context_Valid + (This : in GL_Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void context_valid(char v); +</pre></td> +<td><pre> +procedure Set_Context_Valid + (This : in out GL_Window; + Valud : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +void flush(); +</pre></td> +<td><pre> +procedure Flush + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +int handle(int); +</pre></td> +<td><pre> +function Handle + (This : in out GL_Window; + Event : in Event_Kind) + return Event_Outcome; +</pre></td> + </tr> + + <tr> +<td><pre> +void hide(); +</pre></td> +<td><pre> +procedure Hide + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void hide_overlay(); +</pre></td> +<td><pre> +procedure Hide_Overlay + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void invalidate(); +</pre></td> +<td> +Use Set_Valid instead +</td> + </tr> + + <tr> +<td><pre> +void make_current(); +</pre></td> +<td><pre> +procedure Make_Current + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void make_overlay_current(); +</pre></td> +<td><pre> +procedure Make_Overlay_Current + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Mode mode() const; +</pre></td> +<td><pre> +function Get_Mode + (This : in GL_Window) + return Mode_Mask; +</pre></td> + </tr> + + <tr> +<td><pre> +int mode(const int *a); +</pre></td> +<td> +Not applicable due to not being part of the public stable API +</td> + </tr> + + <tr> +<td><pre> +int mode(int a); +</pre></td> +<td><pre> +procedure Set_Mode + (This : in out GL_Window; + Mask : in Mode_Mask); +</pre></td> + </tr> + + <tr> +<td><pre> +void ortho(); +</pre></td> +<td><pre> +procedure Ortho + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +int pixel_h(); +</pre></td> +<td><pre> +function Pixel_H + (This : in GL_Window) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +int pixel_w(); +</pre></td> +<td><pre> +function Pixel_W + (This : in GL_Window) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +float pixels_per_unit(); +</pre></td> +<td><pre> +function Pixels_Per_Unit + (This : in GL_Window) + return Float; +</pre></td> + </tr> + + <tr> +<td><pre> +void Redraw_Overlay(); +</pre></td> +<td><pre> +procedure Redraw_Overlay + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void resize(int, int, int, int); +</pre></td> +<td> +Use Resize/Reposition from FLTK.Widgets instead +</td> + </tr> + + <tr> +<td><pre> +void show(); + +void show(int a, char **b); +</pre></td> +<td><pre> +procedure Show + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void swap_buffers(); +</pre></td> +<td><pre> +procedure Swap_Buffers + (This : in out GL_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +char valid() const; +</pre></td> +<td><pre> +function Get_Valid + (This : in GL_Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void valid(char v); +</pre></td> +<td><pre> +procedure Set_Valid + (This : in out GL_Window; + Value : in Boolean); +</pre></td> + </tr> + +</table> + + + </body> +</html> + diff --git a/doc/fl_graphics_driver.html b/doc/fl_graphics_driver.html index 9f613ef..43429d5 100644 --- a/doc/fl_graphics_driver.html +++ b/doc/fl_graphics_driver.html @@ -14,6 +14,9 @@ <h2>Fl_Graphics_Driver Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_group.html b/doc/fl_group.html index 123e05b..e5501a3 100644 --- a/doc/fl_group.html +++ b/doc/fl_group.html @@ -14,6 +14,9 @@ <h2>Fl_Group Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_hor_fill_slider.html b/doc/fl_hor_fill_slider.html index bf816d1..da8cba1 100644 --- a/doc/fl_hor_fill_slider.html +++ b/doc/fl_hor_fill_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Hor_Fill_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_hor_nice_slider.html b/doc/fl_hor_nice_slider.html index 6597050..aa597be 100644 --- a/doc/fl_hor_nice_slider.html +++ b/doc/fl_hor_nice_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Hor_Nice_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_hor_slider.html b/doc/fl_hor_slider.html index 9cc9a22..05a79eb 100644 --- a/doc/fl_hor_slider.html +++ b/doc/fl_hor_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Hor_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_hor_value_slider.html b/doc/fl_hor_value_slider.html index 7d817a4..a22043c 100644 --- a/doc/fl_hor_value_slider.html +++ b/doc/fl_hor_value_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Hor_Value_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_image.html b/doc/fl_image.html index 4708f3f..7838289 100644 --- a/doc/fl_image.html +++ b/doc/fl_image.html @@ -14,6 +14,9 @@ <h2>Fl_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -53,6 +56,55 @@ +<table class="type"> + <tr><th colspan="2">Errors</th></tr> + + <tr> + <td>ERR_FILE_ACCESS</td> + <td>File_Access_Error</td> + </tr> + + <tr> + <td>ERR_FORMAT</td> + <td>Format_Error</td> + </tr> + + <tr> + <td>ERR_NO_IMAGE</td> + <td>No_Image_Error</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Static Functions and Procedures</th></tr> + + <tr> +<td><pre> +static void RGB_scaling(Fl_RGB_Scaling); +</pre></td> +<td><pre> +procedure Set_Copy_Algorithm + (To : in Scaling_Kind); +</pre></td> + </tr> + + <tr> +<td><pre> +static Fl_RGB_Scaling RGB_scaling(); +</pre></td> +<td><pre> +function Get_Copy_Algorithm + return Scaling_Kind; +</pre></td> + </tr> + +</table> + + + <table class="function"> <tr><th colspan="2">Functions and Procedures</th></tr> @@ -106,7 +158,20 @@ function Copy <td><pre> int count() const; </pre></td> +<td><pre> +function Get_Data_Count + (This : in Image) + return Natural; +</pre></td> + </tr> + + <tr> <td> </td> +<td><pre> +function Get_Data_Size + (This : in Image) + return Natural; +</pre></td> </tr> <tr> @@ -124,7 +189,53 @@ function Get_D <td><pre> const char * const * data() const; </pre></td> -<td> </td> +<td><pre> +function Get_Datum + (This : in Image; + Data : in Positive; + Position : in Positive) + return Color_Component +with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This); + +procedure Set_Datum + (This : in out Image; + Data : in Positive; + Position : in Positive; + Value : in Color_Component) +with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This); + +function Get_Data + (This : in Image; + Data : in Positive; + Position : in Positive; + Count : in Natural) + return Color_Component_Array +with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This) and + Count <= Get_Data_Size (This) - Position + 1; + +function All_Data + (This : in Image; + Data : in Positive) + return Color_Component_Array +with Pre => + Data <= Get_Data_Count (This); + +procedure Update_Data + (This : in out Image; + Data : in Positive; + Position : in Positive; + Values : in Color_Component_Array) +with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This) and + Values'Length <= Get_Data_Size (This) - Position + 1; +</pre></td> </tr> <tr> @@ -139,7 +250,8 @@ procedure Desaturate <tr> <td><pre> -virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); +virtual void draw(int X, int Y, int W, int H, + int cx=0, int cy=0); </pre></td> <td><pre> procedure Draw @@ -207,48 +319,35 @@ procedure Inactive <td><pre> virtual void label(Fl_Widget *w); </pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> virtual void label(Fl_Menu_Item *m); </pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> int ld() const; </pre></td> -<td> </td> - </tr> - - <tr> <td><pre> -static void RGB_scaling(Fl_RGB_Scaling); -</pre></td> -<td><pre> -procedure Set_Copy_Algorithm - (To : in Scaling_Kind); +function Get_Line_Data + (This : in Image) + return Natural; </pre></td> </tr> <tr> <td><pre> -static Fl_RGB_Scaling RGB_scaling(); -</pre></td> -<td><pre> -function Get_Copy_Algorithm - return Scaling_Kind; +virtual void uncache(); </pre></td> - </tr> - - <tr> <td><pre> -virtual void uncache(); +procedure Uncache + (This : in out Image); </pre></td> -<td> </td> </tr> <tr> diff --git a/doc/fl_image_surface.html b/doc/fl_image_surface.html index 4450127..1ee459c 100644 --- a/doc/fl_image_surface.html +++ b/doc/fl_image_surface.html @@ -14,6 +14,9 @@ <h2>Fl_Image_Surface Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_input.html b/doc/fl_input.html index f93b4c8..c916343 100644 --- a/doc/fl_input.html +++ b/doc/fl_input.html @@ -14,6 +14,9 @@ <h2>Fl_Input Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_input_choice.html b/doc/fl_input_choice.html index c15f677..a34ea8b 100644 --- a/doc/fl_input_choice.html +++ b/doc/fl_input_choice.html @@ -14,6 +14,9 @@ <h2>Fl_Input_Choice Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_int_input.html b/doc/fl_int_input.html index 5acce80..841d818 100644 --- a/doc/fl_int_input.html +++ b/doc/fl_int_input.html @@ -14,6 +14,9 @@ <h2>Fl_Int_Input Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_jpeg_image.html b/doc/fl_jpeg_image.html index b948ab0..0bc768d 100644 --- a/doc/fl_jpeg_image.html +++ b/doc/fl_jpeg_image.html @@ -14,6 +14,9 @@ <h2>Fl_JPEG_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -61,7 +64,12 @@ function Create <td><pre> Fl_JPEG_Image(const char *name, const unsigned char *data); </pre></td> -<td> </td> +<td><pre> +function Create + (Name : in String := ""; + Data : in Color_Component_Array) + return JPEG_Image; +</pre></td> </tr> </table> diff --git a/doc/fl_light_button.html b/doc/fl_light_button.html index 521d1be..d2cc2c3 100644 --- a/doc/fl_light_button.html +++ b/doc/fl_light_button.html @@ -14,6 +14,9 @@ <h2>Fl_Light_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_line_dial.html b/doc/fl_line_dial.html index 9020bad..23fc5fb 100644 --- a/doc/fl_line_dial.html +++ b/doc/fl_line_dial.html @@ -14,6 +14,9 @@ <h2>Fl_Line_Dial Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_menu_.html b/doc/fl_menu_.html index 731c16e..8609c82 100644 --- a/doc/fl_menu_.html +++ b/doc/fl_menu_.html @@ -14,6 +14,9 @@ <h2>Fl_Menu_ Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -401,7 +404,7 @@ function Popup X, Y : in Integer; Title : in String := ""; Initial : in Extended_Index := No_Index) - return FLTK.Menu_Items.Menu_Item_Reference; + return Extended_Index; </pre></td> </tr> @@ -412,7 +415,7 @@ function Pulldown (This : in Menu; X, Y, W, H : in Integer; Initial : in Extended_Index := No_Index) - return FLTK.Menu_Items.Menu_Item_Reference; + return Extended_Index; </pre></td> </tr> diff --git a/doc/fl_menu_bar.html b/doc/fl_menu_bar.html index 3ff571b..98aed26 100644 --- a/doc/fl_menu_bar.html +++ b/doc/fl_menu_bar.html @@ -14,6 +14,9 @@ <h2>Fl_Menu_Bar Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_menu_button.html b/doc/fl_menu_button.html index 55b9e57..64d4838 100644 --- a/doc/fl_menu_button.html +++ b/doc/fl_menu_button.html @@ -14,6 +14,9 @@ <h2>Fl_Menu_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -92,7 +95,7 @@ const Fl_Menu_Item * popup(); <td><pre> function Popup (This : in out Menu_Button) - return FLTK.Menu_Items.Menu_Item; + return Extended_Index; </pre></td> </tr> diff --git a/doc/fl_menu_item.html b/doc/fl_menu_item.html index cca7528..61646ea 100644 --- a/doc/fl_menu_item.html +++ b/doc/fl_menu_item.html @@ -14,6 +14,9 @@ <h2>Fl_Menu_Item Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_menu_window.html b/doc/fl_menu_window.html index 9237db5..6d7003b 100644 --- a/doc/fl_menu_window.html +++ b/doc/fl_menu_window.html @@ -14,6 +14,9 @@ <h2>Fl_Menu_Window Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_multiline_input.html b/doc/fl_multiline_input.html index 54d8ce0..3916f7a 100644 --- a/doc/fl_multiline_input.html +++ b/doc/fl_multiline_input.html @@ -14,6 +14,9 @@ <h2>Fl_Multiline_Input Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_multiline_output.html b/doc/fl_multiline_output.html index 982c48d..da48b27 100644 --- a/doc/fl_multiline_output.html +++ b/doc/fl_multiline_output.html @@ -14,6 +14,9 @@ <h2>Fl_Multiline_Output Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_nice_slider.html b/doc/fl_nice_slider.html index 571bf07..31012cd 100644 --- a/doc/fl_nice_slider.html +++ b/doc/fl_nice_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Nice_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_output.html b/doc/fl_output.html index a8b7502..8fa243c 100644 --- a/doc/fl_output.html +++ b/doc/fl_output.html @@ -14,6 +14,9 @@ <h2>Fl_Output Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_overlay_window.html b/doc/fl_overlay_window.html new file mode 100644 index 0000000..c72b50e --- /dev/null +++ b/doc/fl_overlay_window.html @@ -0,0 +1,153 @@ + +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Fl_Overlay_Window Binding Map</title> + <link href="map.css" rel="stylesheet"> + </head> + + <body> + + +<h2>Fl_Overlay_Window Binding Map</h2> + + +<a href="index.html">Back to Index</a> + + +<table class="package"> + <tr><th colspan="2">Package name</th></tr> + + <tr> + <td>Fl_Overlay_Window</td> + <td>FLTK.Widgets.Groups.Windows.Double.Overlay</td> + </tr> + +</table> + + + +<table class="type"> + <tr><th colspan="2">Types</th></tr> + + <tr> + <td>Fl_Overlay_Window</td> + <td>Overlay_Window</td> + </tr> + + <tr> + <td> </td> + <td>Overlay_Window_Reference</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> +Fl_Overlay_Window(int W, int H, const char *l=0); +</pre></td> +<td><pre> +function Create + (W, H : in Integer; + Text : in String := "") + return Overlay_Window; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0); +</pre></td> +<td><pre> +function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return Overlay_Window; +</pre></td> + </tr> + + <tr> +<td><pre> +int can_do_overlay(); +</pre></td> +<td><pre> +function Can_Do_Overlay + (This : in Overlay_Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void draw_overlay()=0; +</pre></td> +<td><pre> +procedure Draw_Overlay + (This : in out Overlay_Window) is null; +</pre></td> + </tr> + + <tr> +<td><pre> +void flush(); +</pre></td> +<td><pre> +procedure Flush + (This : in out Overlay_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void hide(); +</pre></td> +<td><pre> +procedure Hide + (This : in out Overlay_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void redraw_overlay(); +</pre></td> +<td><pre> +procedure Redraw_Overlay + (This : in out Overlay_Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void resize(int, int, int, int); +</pre></td> +<td> +Use Resize/Reposition from FLTK.Widgets instead +</td> + </tr> + + <tr> +<td><pre> +void show(); + +void show(int a, char **b); +</pre></td> +<td><pre> +procedure Show + (This : in out Overlay_Window); +</pre></td> + </tr> + +</table> + + + </body> +</html> + diff --git a/doc/fl_pack.html b/doc/fl_pack.html index e48a791..62b33f2 100644 --- a/doc/fl_pack.html +++ b/doc/fl_pack.html @@ -14,6 +14,9 @@ <h2>Fl_Pack Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_paged_device.html b/doc/fl_paged_device.html index e919ac0..05203fc 100644 --- a/doc/fl_paged_device.html +++ b/doc/fl_paged_device.html @@ -14,6 +14,9 @@ <h2>Fl_Paged_Device Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_pixmap.html b/doc/fl_pixmap.html index de528e6..81d3cc5 100644 --- a/doc/fl_pixmap.html +++ b/doc/fl_pixmap.html @@ -14,6 +14,9 @@ <h2>Fl_Pixmap Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -128,21 +131,24 @@ procedure Draw <td><pre> virtual void label(Fl_Widget *w); </pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> virtual void label(Fl_Menu_Item *m); </pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> virtual void uncache(); </pre></td> -<td> </td> +<td><pre> +procedure Uncache + (This : in out Pixmap); +</pre></td> </tr> </table> diff --git a/doc/fl_png_image.html b/doc/fl_png_image.html index 25260d7..7905098 100644 --- a/doc/fl_png_image.html +++ b/doc/fl_png_image.html @@ -14,6 +14,9 @@ <h2>Fl_PNG_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -59,9 +62,15 @@ function Create <tr> <td><pre> -Fl_PNG_Image(const char *name, const unsigned char *buffer, int datasize); +Fl_PNG_Image(const char *name, const unsigned char *buffer, + int datasize); +</pre></td> +<td><pre> +function Create + (Name : in String := ""; + Data : in Color_Component_Array) + return PNG_Image; </pre></td> -<td> </td> </tr> </table> diff --git a/doc/fl_pnm_image.html b/doc/fl_pnm_image.html index 5302866..dd2d698 100644 --- a/doc/fl_pnm_image.html +++ b/doc/fl_pnm_image.html @@ -14,6 +14,9 @@ <h2>Fl_PNM_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_preferences.html b/doc/fl_preferences.html index b3d5ec0..136ebca 100644 --- a/doc/fl_preferences.html +++ b/doc/fl_preferences.html @@ -14,6 +14,9 @@ <h2>Fl_Preferences Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_printer.html b/doc/fl_printer.html index 97b0e9c..4d52af7 100644 --- a/doc/fl_printer.html +++ b/doc/fl_printer.html @@ -14,6 +14,9 @@ <h2>Fl_Printer Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_progress.html b/doc/fl_progress.html index 8718ce0..ace6956 100644 --- a/doc/fl_progress.html +++ b/doc/fl_progress.html @@ -14,6 +14,9 @@ <h2>Fl_Progress Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_radio_button.html b/doc/fl_radio_button.html index 03f2f92..5c1074f 100644 --- a/doc/fl_radio_button.html +++ b/doc/fl_radio_button.html @@ -14,6 +14,9 @@ <h2>Fl_Radio_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_radio_light_button.html b/doc/fl_radio_light_button.html index bde57e4..dcd6522 100644 --- a/doc/fl_radio_light_button.html +++ b/doc/fl_radio_light_button.html @@ -14,6 +14,9 @@ <h2>Fl_Radio_Light_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_radio_round_button.html b/doc/fl_radio_round_button.html index 3cd67dd..38fdb58 100644 --- a/doc/fl_radio_round_button.html +++ b/doc/fl_radio_round_button.html @@ -14,6 +14,9 @@ <h2>Fl_Radio_Round_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_repeat_button.html b/doc/fl_repeat_button.html index 852a1ce..e3ebc36 100644 --- a/doc/fl_repeat_button.html +++ b/doc/fl_repeat_button.html @@ -14,6 +14,9 @@ <h2>Fl_Repeat_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_return_button.html b/doc/fl_return_button.html index 2bbfac0..02a91cc 100644 --- a/doc/fl_return_button.html +++ b/doc/fl_return_button.html @@ -14,6 +14,9 @@ <h2>Fl_Return_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_rgb_image.html b/doc/fl_rgb_image.html index 95ee4e0..f85686e 100644 --- a/doc/fl_rgb_image.html +++ b/doc/fl_rgb_image.html @@ -14,6 +14,9 @@ <h2>Fl_RGB_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -44,20 +47,59 @@ <table class="function"> + <tr><th colspan="2">Static Functions and Procedures</th></tr> + + <tr> +<td><pre> +static void max_size(size_t size); +</pre></td> +<td><pre> +procedure Set_Max_Size + (Value : in Natural); +</pre></td> + </tr> + + <tr> +<td><pre> +static size_t max_size(); +</pre></td> +<td><pre> +function Get_Max_Size + return Natural; +</pre></td> + </tr> + +</table> + + + +<table class="function"> <tr><th colspan="2">Functions and Procedures</th></tr> <tr> <td><pre> Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0); </pre></td> -<td> </td> +<td><pre> +function Create + (Data : in Color_Component_Array; + Width, Height : in Natural; + Depth : in Natural := 3; + Line_Data : in Natural := 0) + return RGB_Image; +</pre></td> </tr> <tr> <td><pre> Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY); </pre></td> -<td> </td> +<td><pre> +function Create + (Data : in FLTK.Images.Pixmaps.Pixmap; + Background : in Color := Background_Color) + return RGB_Image; +</pre></td> </tr> <tr> @@ -132,35 +174,24 @@ procedure Draw <td><pre> virtual void label(Fl_Widget *w); </pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> virtual void label(Fl_Menu_Item *m); </pre></td> -<td> </td> - </tr> - - <tr> -<td><pre> -static void max_size(size_t size); -</pre></td> -<td> </td> +<td>Not applicable as the original is marked as obsolete</td> </tr> <tr> <td><pre> -static size_t max_size(); +virtual void uncache(); </pre></td> -<td> </td> - </tr> - - <tr> <td><pre> -virtual void uncache(); +procedure Uncache + (This : in out RGB_Image); </pre></td> -<td> </td> </tr> </table> diff --git a/doc/fl_roller.html b/doc/fl_roller.html index fb0b6cc..9a1a445 100644 --- a/doc/fl_roller.html +++ b/doc/fl_roller.html @@ -14,6 +14,9 @@ <h2>Fl_Roller Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_round_button.html b/doc/fl_round_button.html index cc780f7..1115d9c 100644 --- a/doc/fl_round_button.html +++ b/doc/fl_round_button.html @@ -14,6 +14,9 @@ <h2>Fl_Round_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_round_clock.html b/doc/fl_round_clock.html index 9049459..5398280 100644 --- a/doc/fl_round_clock.html +++ b/doc/fl_round_clock.html @@ -14,6 +14,9 @@ <h2>Fl_Round_Clock Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_scroll.html b/doc/fl_scroll.html index 3cc9087..386006a 100644 --- a/doc/fl_scroll.html +++ b/doc/fl_scroll.html @@ -14,6 +14,9 @@ <h2>Fl_Scroll Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_scrollbar.html b/doc/fl_scrollbar.html index 8538525..1be8f97 100644 --- a/doc/fl_scrollbar.html +++ b/doc/fl_scrollbar.html @@ -14,6 +14,9 @@ <h2>Fl_Scrollbar Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_secret_input.html b/doc/fl_secret_input.html index 43e5226..0509e46 100644 --- a/doc/fl_secret_input.html +++ b/doc/fl_secret_input.html @@ -14,6 +14,9 @@ <h2>Fl_Secret_Input Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_shared_image.html b/doc/fl_shared_image.html index 298a541..0c43ff7 100644 --- a/doc/fl_shared_image.html +++ b/doc/fl_shared_image.html @@ -14,6 +14,9 @@ <h2>Fl_Shared_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -44,31 +47,93 @@ <table class="function"> - <tr><th colspan="2">Functions and Procedures</th></tr> + <tr><th colspan="2">Static Functions and Procedures</th></tr> <tr> <td><pre> -Fl_Shared_Image(); +static void add_handler(Fl_Shared_Handler f); </pre></td> -<td> </td> +<td>Documentation lacking, claims to be a test function yet used for adding extra formats?</td> </tr> <tr> <td><pre> -Fl_Shared_Image(const char *n, Fl_Image *img=0); +static Fl_Shared_Image * find(const char *name, int W=0, int H=0); +</pre></td> +<td><pre> +function Find + (Name : in String; + W, H : in Integer := 0) + return Shared_Image; </pre></td> -<td> </td> </tr> <tr> <td><pre> -static void add_handler(Fl_Shared_Handler f); +static Fl_Shared_Image * get(const char *name, int W=0, int H=0); +</pre></td> +<td><pre> +function Create + (Filename : in String; + W, H : in Integer) + return Shared_Image; +</pre></td> + </tr> + + <tr> +<td><pre> +static Fl_Shared_Image * get(Fl_RGB_Image *rgb, int own_it=1); +</pre></td> +<td><pre> +function Create + (From : in FLTK.Images.RGB.RGB_Image'Class) + return Shared_Image; +</pre></td> + </tr> + + <tr> +<td><pre> +static Fl_Shared_Image ** images(); </pre></td> <td> </td> </tr> <tr> <td><pre> +static int num_images(); +</pre></td> +<td><pre> +function Number_Of_Images + return Natural; +</pre></td> + </tr> + + <tr> +<td><pre> +static void remove_handler(Fl_Shared_Handler f); +</pre></td> +<td>Documentation lacking, claims to be a test function yet used for adding extra formats?</td> + </tr> + + <tr> +<td><pre> +static void scaling_algorithm(Fl_RGB_Scaling algorithm); +</pre></td> +<td><pre> +procedure Set_Scaling_Algorithm + (To : in Scaling_Kind); +</pre></td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> virtual void color_average(Fl_Color c, float i); </pre></td> <td><pre> @@ -137,48 +202,6 @@ procedure Draw <tr> <td><pre> -static Fl_Shared_Image * find(const char *name, int W=0, int H=0); -</pre></td> -<td><pre> -function Find - (Name : in String; - W, H : in Integer := 0) - return Shared_Image; -</pre></td> - </tr> - - <tr> -<td><pre> -static Fl_Shared_Image * get(const char *name, int W=0, int H=0); -</pre></td> -<td><pre> -function Create - (Filename : in String; - W, H : in Integer) - return Shared_Image; -</pre></td> - </tr> - - <tr> -<td><pre> -static Fl_Shared_Image * get(Fl_RGB_Image *rgb, int own_it=1); -</pre></td> -<td><pre> -function Create - (From : in FLTK.Images.RGB.RGB_Image'Class) - return Shared_Image; -</pre></td> - </tr> - - <tr> -<td><pre> -static Fl_Shared_Image ** images(); -</pre></td> -<td> </td> - </tr> - - <tr> -<td><pre> const char * name(); </pre></td> <td><pre> @@ -190,16 +213,24 @@ function Name <tr> <td><pre> -static int num_images(); +int original(); +</pre></td> +<td><pre> +function Original + (This : in Shared_Image) + return Boolean; </pre></td> -<td> </td> </tr> <tr> <td><pre> int refcount(); </pre></td> -<td> </td> +<td><pre> +function Reference_Count + (This : in Shared_Image) + return Natural; +</pre></td> </tr> <tr> @@ -221,14 +252,8 @@ procedure Reload <tr> <td><pre> -static void remove_handler(Fl_Shared_Handler f); -</pre></td> -<td> </td> - </tr> - - <tr> -<td><pre> -void scale(int width, int height, int proportional=1, int can_expand=0); +void scale(int width, int height, + int proportional=1, int can_expand=0); </pre></td> <td><pre> procedure Scale @@ -241,19 +266,12 @@ procedure Scale <tr> <td><pre> -static void scaling_algorithm(Fl_RGB_Scaling algorithm); -</pre></td> -<td><pre> -procedure Set_Scaling_Algorithm - (To : in Scaling_Kind); +virtual void uncache(); </pre></td> - </tr> - - <tr> <td><pre> -virtual void uncache(); +procedure Uncache + (This : in out Shared_Image); </pre></td> -<td> </td> </tr> </table> diff --git a/doc/fl_simple_counter.html b/doc/fl_simple_counter.html index 2961598..3d4d694 100644 --- a/doc/fl_simple_counter.html +++ b/doc/fl_simple_counter.html @@ -14,6 +14,9 @@ <h2>Fl_Simple_Counter Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_single_window.html b/doc/fl_single_window.html index f3ce48b..5947167 100644 --- a/doc/fl_single_window.html +++ b/doc/fl_single_window.html @@ -14,6 +14,9 @@ <h2>Fl_Single_Window Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_slider.html b/doc/fl_slider.html index 0853595..c18b809 100644 --- a/doc/fl_slider.html +++ b/doc/fl_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_spinner.html b/doc/fl_spinner.html index 8c726ae..c343723 100644 --- a/doc/fl_spinner.html +++ b/doc/fl_spinner.html @@ -14,6 +14,9 @@ <h2>Fl_Spinner Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_surface_device.html b/doc/fl_surface_device.html index 6da46c9..d72d0d4 100644 --- a/doc/fl_surface_device.html +++ b/doc/fl_surface_device.html @@ -14,6 +14,9 @@ <h2>Fl_Surface_Device Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_tabs.html b/doc/fl_tabs.html index 048c356..920e680 100644 --- a/doc/fl_tabs.html +++ b/doc/fl_tabs.html @@ -14,6 +14,9 @@ <h2>Fl_Tabs Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_text_buffer.html b/doc/fl_text_buffer.html index 8fe431f..5416208 100644 --- a/doc/fl_text_buffer.html +++ b/doc/fl_text_buffer.html @@ -14,6 +14,9 @@ <h2>Fl_Text_Buffer Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_text_display.html b/doc/fl_text_display.html index 723c5fe..062af18 100644 --- a/doc/fl_text_display.html +++ b/doc/fl_text_display.html @@ -14,6 +14,9 @@ <h2>Fl_Text_Display Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_text_editor.html b/doc/fl_text_editor.html index 88bf734..2a9d089 100644 --- a/doc/fl_text_editor.html +++ b/doc/fl_text_editor.html @@ -14,6 +14,9 @@ <h2>Fl_Text_Editor Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_tile.html b/doc/fl_tile.html index 0aab994..86286fd 100644 --- a/doc/fl_tile.html +++ b/doc/fl_tile.html @@ -14,6 +14,9 @@ <h2>Fl_Tile Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_tiled_image.html b/doc/fl_tiled_image.html new file mode 100644 index 0000000..7cbc7ad --- /dev/null +++ b/doc/fl_tiled_image.html @@ -0,0 +1,148 @@ + +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Fl_Tiled_Image Binding Map</title> + <link href="map.css" rel="stylesheet"> + </head> + + <body> + + +<h2>Fl_Tiled_Image Binding Map</h2> + + +<a href="index.html">Back to Index</a> + + +<table class="package"> + <tr><th colspan="2">Package name</th></tr> + + <tr> + <td>Fl_Tiled_Image</td> + <td>FLTK.Images.Tiled</td> + </tr> + +</table> + + + +<table class="type"> + <tr><th colspan="2">Types</th></tr> + + <tr> + <td>Fl_Tiled_Image</td> + <td>Tiled_Image</td> + </tr> + + <tr> + <td> </td> + <td>Tiled_Image_Reference</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> +Fl_Tiled_Image(Fl_Image *i, int W=0, int H=0); +</pre></td> +<td><pre> +function Create + (From : in out Image'Class; + W, H : in Integer := 0) + return Tiled_Image; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void color_average(Fl_Color c, float i); +</pre></td> +<td><pre> +procedure Color_Average + (This : in out Tiled_Image; + Hue : in Color; + Amount : in Blend); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Image * copy(); +</pre></td> +<td><pre> +function Copy + (This : in Tiled_Image) + return Tiled_Image'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual Fl_Image * copy(int W, int H); +</pre></td> +<td><pre> +function Copy + (This : in Tiled_Image; + Width, Height : in Natural) + return Tiled_Image'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void desaturate(); +</pre></td> +<td><pre> +procedure Desaturate + (This : in out Tiled_Image); +</pre></td> + </tr> + + <tr> +<td><pre> +void draw(int X, int Y); +</pre></td> +<td><pre> +procedure Draw + (This : in Tiled_Image; + X, Y : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void draw(int X, int Y, int W, int H, int cx, int cy); +</pre></td> +<td><pre> +procedure Draw + (This : in Tiled_Image; + X, Y, W, H : in Integer; + CX, CY : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Image * image(); +</pre></td> +<td><pre> +function Tile + (This : in out Tiled_Image) + return Image_Reference; +</pre></td> + </tr> + +</table> + + + </body> +</html> + diff --git a/doc/fl_toggle_button.html b/doc/fl_toggle_button.html index 1696895..86d3b23 100644 --- a/doc/fl_toggle_button.html +++ b/doc/fl_toggle_button.html @@ -14,6 +14,9 @@ <h2>Fl_Toggle_Button Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_tooltip.html b/doc/fl_tooltip.html index 9c72207..c415fa7 100644 --- a/doc/fl_tooltip.html +++ b/doc/fl_tooltip.html @@ -14,6 +14,9 @@ <h2>Fl_Tooltip Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_valuator.html b/doc/fl_valuator.html index 81e374b..e7ef33a 100644 --- a/doc/fl_valuator.html +++ b/doc/fl_valuator.html @@ -14,6 +14,9 @@ <h2>Fl_Valuator Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_value_input.html b/doc/fl_value_input.html index 16d02b8..f0c0b5f 100644 --- a/doc/fl_value_input.html +++ b/doc/fl_value_input.html @@ -14,6 +14,9 @@ <h2>Fl_Value_Input Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_value_output.html b/doc/fl_value_output.html index 3924e14..fabae05 100644 --- a/doc/fl_value_output.html +++ b/doc/fl_value_output.html @@ -14,6 +14,9 @@ <h2>Fl_Value_Output Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_value_slider.html b/doc/fl_value_slider.html index 54bae4e..52e1873 100644 --- a/doc/fl_value_slider.html +++ b/doc/fl_value_slider.html @@ -14,6 +14,9 @@ <h2>Fl_Value_Slider Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_widget.html b/doc/fl_widget.html index 762591b..8c54afe 100644 --- a/doc/fl_widget.html +++ b/doc/fl_widget.html @@ -14,6 +14,9 @@ <h2>Fl_Widget Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_window.html b/doc/fl_window.html index a1a5bb8..518dc97 100644 --- a/doc/fl_window.html +++ b/doc/fl_window.html @@ -14,6 +14,9 @@ <h2>Fl_Window Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> @@ -49,11 +52,6 @@ <td>Modal_State</td> </tr> - <tr> - <td> </td> - <td>Cursor</td> - </tr> - </table> @@ -156,7 +154,7 @@ void cursor(Fl_Cursor); <td><pre> procedure Set_Cursor (This : in out Window; - To : in Cursor); + To : in Mouse_Cursor); </pre></td> </tr> @@ -208,7 +206,7 @@ void default_cursor(Fl_Cursor); <td><pre> procedure Set_Default_Cursor (This : in out Window; - To : in Cursor); + To : in Mouse_Cursor); </pre></td> </tr> diff --git a/doc/fl_wizard.html b/doc/fl_wizard.html index 313924a..d6b7b76 100644 --- a/doc/fl_wizard.html +++ b/doc/fl_wizard.html @@ -14,6 +14,9 @@ <h2>Fl_Wizard Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_xbm_image.html b/doc/fl_xbm_image.html index cfa3b68..9adbb2a 100644 --- a/doc/fl_xbm_image.html +++ b/doc/fl_xbm_image.html @@ -14,6 +14,9 @@ <h2>Fl_XBM_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/fl_xpm_image.html b/doc/fl_xpm_image.html index 72e95b4..26fc651 100644 --- a/doc/fl_xpm_image.html +++ b/doc/fl_xpm_image.html @@ -14,6 +14,9 @@ <h2>Fl_XPM_Image Binding Map</h2> +<a href="index.html">Back to Index</a> + + <table class="package"> <tr><th colspan="2">Package name</th></tr> diff --git a/doc/index.html b/doc/index.html index e3c4f0a..f729db2 100644 --- a/doc/index.html +++ b/doc/index.html @@ -14,9 +14,10 @@ <h2>Binding Map Index</h2> -<h4>List of C++ classes</h4> +<h4>List of C++ headers</h4> <ul> + <li><a href="fl.html">Enumerations</a></li> <li><a href="fl.html">Fl</a></li> <li><a href="fl_adjuster.html">Fl_Adjuster</a></li> <li><a href="common_dialogs.html">Fl_Ask</a></li> @@ -40,6 +41,7 @@ <li><a href="fl_dial.html">Fl_Dial</a></li> <li>Fl_Display_Device</li> <li><a href="fl_double_window.html">Fl_Double_Window</a></li> + <li><a href="fl_draw.html">Fl_Draw</a></li> <li>Fl_File_Browser</li> <li>Fl_File_Chooser</li> <li><a href="fl_file_input.html">Fl_File_Input</a></li> @@ -47,7 +49,7 @@ <li><a href="fl_fill_slider.html">Fl_Fill_Slider</a></li> <li><a href="fl_float_input.html">Fl_Float_Input</a></li> <li><a href="fl_gif_image.html">Fl_GIF_Image</a></li> - <li>Fl_Gl_Window</li> + <li><a href="fl_gl_window.html">Fl_Gl_Window</a></li> <li>Fl_Glut_Window</li> <li><a href="fl_graphics_driver.html">Fl_Graphics_Driver</a></li> <li><a href="fl_group.html">Fl_Group</a></li> @@ -78,7 +80,7 @@ <li><a href="fl_multiline_output.html">Fl_Multiline_Output</a></li> <li><a href="fl_nice_slider.html">Fl_Nice_Slider</a></li> <li><a href="fl_output.html">Fl_Output</a></li> - <li>Fl_Overlay_Window</li> + <li><a href="fl_overlay_window.html">Fl_Overlay_Window</a></li> <li><a href="fl_pack.html">Fl_Pack</a></li> <li><a href="fl_paged_device.html">Fl_Paged_Device</a></li> <li><a href="fl_pixmap.html">Fl_Pixmap</a></li> @@ -114,7 +116,7 @@ <li><a href="fl_text_display.html">Fl_Text_Display</a></li> <li><a href="fl_text_editor.html">Fl_Text_Editor</a></li> <li><a href="fl_tile.html">Fl_Tile</a></li> - <li>Fl_Tiled_Image</li> + <li><a href="fl_tiled_image.html">Fl_Tiled_Image</a></li> <li><a href="fl_toggle_button.html">Fl_Toggle_Button</a></li> <li><a href="fl_tooltip.html">Fl_Tooltip</a></li> <li>Fl_Tree</li> @@ -142,6 +144,7 @@ <li><a href="fl_paged_device.html">FLTK.Devices.Surfaces.Paged</a></li> <li><a href="fl_printer.html">FLTK.Devices.Surfaces.Paged.Printers</a></li> <li><a href="common_dialogs.html">FLTK.Dialogs</a></li> + <li><a href="fl_draw.html">FLTK.Draw</a></li> <li><a href="fl_preferences.html">FLTK.Environment</a></li> <li><a href="fl.html">FLTK.Event</a></li> <li><a href="fl_image.html">FLTK.Images</a></li> @@ -156,6 +159,7 @@ <li><a href="fl_png_image.html">FLTK.Images.RGB.PNG</a></li> <li><a href="fl_pnm_image.html">FLTK.Images.RGB.PNM</a></li> <li><a href="fl_shared_image.html">FLTK.Images.Shared</a></li> + <li><a href="fl_tiled_image.html">FLTK.Images.Tiled</a></li> <li><a href="fl_menu_item.html">FLTK.Menu_Items</a></li> <li><a href="fl.html">FLTK.Screen</a></li> <li><a href="fl.html">FLTK.Static</a></li> @@ -189,6 +193,8 @@ <li><a href="fl_tile.html">FLTK.Widgets.Groups.Tiled</a></li> <li><a href="fl_window.html">FLTK.Widgets.Groups.Windows</a></li> <li><a href="fl_double_window.html">FLTK.Widgets.Groups.Windows.Double</a></li> + <li><a href="fl_overlay_window.html">FLTK.Widgets.Groups.Windows.Double.Overlay</a></li> + <li><a href="fl_gl_window.html">FLTK.Widgets.Groups.Windows.OpenGL</a></li> <li><a href="fl_single_window.html">FLTK.Widgets.Groups.Windows.Single</a></li> <li><a href="fl_menu_window.html">FLTK.Widgets.Groups.Windows.Single.Menu</a></li> <li><a href="fl_wizard.html">FLTK.Widgets.Groups.Wizards</a></li> diff --git a/progress.txt b/progress.txt index 2f87b25..1cfb0be 100644 --- a/progress.txt +++ b/progress.txt @@ -5,7 +5,7 @@ Approximate Progress List -Overall estimate: 80% +Overall estimate: 82% @@ -27,6 +27,7 @@ FLTK.Devices.Surfaces.Image FLTK.Devices.Surfaces.Paged FLTK.Devices.Surfaces.Paged.Printers FLTK.Dialogs +FLTK.Draw FLTK.Event FLTK.Images FLTK.Images.Bitmaps @@ -40,6 +41,7 @@ FLTK.Images.RGB.JPEG FLTK.Images.RGB.PNG FLTK.Images.RGB.PNM FLTK.Images.Shared +FLTK.Images.Tiled FLTK.Menu_Items FLTK.Screen FLTK.Static @@ -73,6 +75,8 @@ FLTK.Widgets.Groups.Text_Displays.Text_Editors FLTK.Widgets.Groups.Tiled FLTK.Widgets.Groups.Windows FLTK.Widgets.Groups.Windows.Double +FLTK.Widgets.Groups.Windows.Double.Overlay +FLTK.Widgets.Groups.Windows.OpenGL FLTK.Widgets.Groups.Windows.Single FLTK.Widgets.Groups.Windows.Single.Menu FLTK.Widgets.Groups.Wizards @@ -135,19 +139,16 @@ Fl_Check_Browser Fl_Display_Device Fl_File_Browser Fl_File_Chooser -Fl_Gl_Window Fl_Glut_Window Fl_Help_Dialog Fl_Help_View Fl_Hold_Browser Fl_Label Fl_Multi_Browser -Fl_Overlay_Window Fl_Postscript_File_Device Fl_Select_Browser Fl_Table Fl_Table_Row -Fl_Tiled_Image Fl_Tree diff --git a/src/c_fl_bitmap.cpp b/src/c_fl_bitmap.cpp index 38665b5..6a38b1e 100644 --- a/src/c_fl_bitmap.cpp +++ b/src/c_fl_bitmap.cpp @@ -6,11 +6,17 @@ +BITMAP new_fl_bitmap(void *data, int w, int h) { + Fl_Bitmap *b = new Fl_Bitmap(reinterpret_cast<uchar*>(data), w, h); + return b; +} + void free_fl_bitmap(BITMAP b) { delete reinterpret_cast<Fl_Bitmap*>(b); } BITMAP fl_bitmap_copy(BITMAP b, int w, int h) { + // virtual so disable dispatch return reinterpret_cast<Fl_Bitmap*>(b)->Fl_Bitmap::copy(w, h); } @@ -21,11 +27,20 @@ BITMAP fl_bitmap_copy2(BITMAP b) { +void fl_bitmap_uncache(BITMAP b) { + // virtual so disable dispatch + reinterpret_cast<Fl_Bitmap*>(b)->Fl_Bitmap::uncache(); +} + + + + void fl_bitmap_draw2(BITMAP b, int x, int y) { reinterpret_cast<Fl_Bitmap*>(b)->draw(x, y); } void fl_bitmap_draw(BITMAP b, int x, int y, int w, int h, int cx, int cy) { + // virtual so disable dispatch reinterpret_cast<Fl_Bitmap*>(b)->Fl_Bitmap::draw(x, y, w, h, cx, cy); } diff --git a/src/c_fl_bitmap.h b/src/c_fl_bitmap.h index 219af14..f2290dd 100644 --- a/src/c_fl_bitmap.h +++ b/src/c_fl_bitmap.h @@ -11,11 +11,15 @@ typedef void* BITMAP; +extern "C" BITMAP new_fl_bitmap(void *data, int w, int h); extern "C" void free_fl_bitmap(BITMAP b); extern "C" BITMAP fl_bitmap_copy(BITMAP b, int w, int h); extern "C" BITMAP fl_bitmap_copy2(BITMAP b); +extern "C" void fl_bitmap_uncache(BITMAP b); + + extern "C" void fl_bitmap_draw2(BITMAP b, int x, int y); extern "C" void fl_bitmap_draw(BITMAP b, int x, int y, int w, int h, int cx, int cy); diff --git a/src/c_fl_draw.cpp b/src/c_fl_draw.cpp new file mode 100644 index 0000000..5021cd9 --- /dev/null +++ b/src/c_fl_draw.cpp @@ -0,0 +1,443 @@ + + +#include <FL/fl_draw.H> +#include <FL/Fl_Window.H> +#include "c_fl_draw.h" + + + + +void fl_draw_reset_spot() { + fl_reset_spot(); +} + +void fl_draw_set_spot(int f, int s, int x, int y, int w, int h, void * ptr) { + fl_set_spot(f, s, x, y, w, h, reinterpret_cast<Fl_Window*>(ptr)); +} + +void fl_draw_set_status(int x, int y, int w, int h) { + fl_set_status(x, y, w, h); +} + + + + +int fl_draw_can_do_alpha_blending() { + return fl_can_do_alpha_blending(); +} + +const char * fl_draw_shortcut_label(unsigned long shortcut) { + return fl_shortcut_label(shortcut); +} + + + + +const char * fl_draw_latin1_to_local(const char *t, int n) { + return fl_latin1_to_local(t, n); +} + +const char * fl_draw_local_to_latin1(const char *t, int n) { + return fl_local_to_latin1(t, n); +} + +const char * fl_draw_mac_roman_to_local(const char *t, int n) { + return fl_mac_roman_to_local(t, n); +} + +const char * fl_draw_local_to_mac_roman(const char *t, int n) { + return fl_local_to_mac_roman(t, n); +} + + + + +int fl_draw_clip_box(int x, int y, int w, int h, int &bx, int &by, int &bw, int &bh) { + return fl_clip_box(x, y, w, h, bx, by, bw, bh); +} + +int fl_draw_not_clipped(int x, int y, int w, int h) { + return fl_not_clipped(x, y, w, h); +} + +void fl_draw_pop_clip() { + fl_pop_clip(); +} + +void fl_draw_push_clip(int x, int y, int w, int h) { + fl_push_clip(x, y, w, h); +} + +void fl_draw_push_no_clip() { + fl_push_no_clip(); +} + +void fl_draw_restore_clip() { + fl_restore_clip(); +} + + + + +void fl_draw_overlay_clear() { + fl_overlay_clear(); +} + +void fl_draw_overlay_rect(int x, int y, int w, int h) { + fl_overlay_rect(x, y, w, h); +} + + + + +unsigned int fl_draw_get_color() { + return fl_color(); +} + +void fl_draw_set_color(unsigned int c) { + fl_color(c); +} + +void fl_draw_set_color2(uchar r, uchar g, uchar b) { + fl_color(r, g, b); +} + +void fl_draw_set_cursor(int m) { + fl_cursor((Fl_Cursor)m); +} + +void fl_draw_set_cursor2(int m, unsigned int f, unsigned int b) { + fl_cursor((Fl_Cursor)m, f, b); +} + +unsigned int fl_draw_get_font() { + return (unsigned int)fl_font(); +} + +int fl_draw_size() { + return fl_size(); +} + +void fl_draw_set_font(unsigned int f, int s) { + fl_font((Fl_Font)f, (Fl_Fontsize)s); +} + +int fl_draw_height() { + return fl_height(); +} + +int fl_draw_descent() { + return fl_descent(); +} + +int fl_draw_height2(unsigned int f, int s) { + return fl_height(f, s); +} + +void fl_draw_line_style(int style, int width, char * dashes) { + fl_line_style(style, width, dashes); +} + + + + +void fl_draw_mult_matrix(double a, double b, double c, double d, double x, double y) { + fl_mult_matrix(a, b, c, d, x, y); +} + +void fl_draw_pop_matrix() { + fl_pop_matrix(); +} + +void fl_draw_push_matrix() { + fl_push_matrix(); +} + +void fl_draw_rotate(double d) { + fl_rotate(d); +} + +void fl_draw_scale(double x) { + fl_scale(x); +} + +void fl_draw_scale2(double x, double y) { + fl_scale(x, y); +} + +double fl_draw_transform_dx(double x, double y) { + return fl_transform_dx(x, y); +} + +double fl_draw_transform_dy(double x, double y) { + return fl_transform_dy(x, y); +} + +double fl_draw_transform_x(double x, double y) { + return fl_transform_x(x, y); +} + +double fl_draw_transform_y(double x, double y) { + return fl_transform_y(x, y); +} + +void fl_draw_transformed_vertex(double xf, double yf) { + fl_transformed_vertex(xf, yf); +} + +void fl_draw_translate(double x, double y) { + fl_translate(x, y); +} + +void fl_draw_vertex(double x, double y) { + fl_vertex(x, y); +} + + + + +void fl_draw_draw_image(void * data, int x, int y, int w, int h, int d, int l) { + fl_draw_image(reinterpret_cast<uchar*>(data), x, y, w, h, d, l); +} + +void fl_draw_draw_image2(void * func, void * data, int x, int y, int w, int h, int d) { + fl_draw_image(reinterpret_cast<Fl_Draw_Image_Cb>(func), data, x, y, w, h, d); +} + +void fl_draw_draw_image_mono(void * data, int x, int y, int w, int h, int d, int l) { + fl_draw_image_mono(reinterpret_cast<uchar*>(data), x, y, w, h, d, l); +} + +void fl_draw_draw_image_mono2(void * func, void * data, int x, int y, int w, int h, int d) { + fl_draw_image_mono(reinterpret_cast<Fl_Draw_Image_Cb>(func), data, x, y, w, h, d); +} + +void * fl_draw_read_image(void * data, int x, int y, int w, int h, int alpha) { + return fl_read_image(reinterpret_cast<uchar*>(data), x, y, w, h, alpha); +} + + + + +typedef void (sym_hook)(Fl_Color); +typedef sym_hook* sym_hook_p; + +int fl_draw_add_symbol(const char *name, void *func, int scalable) { + return fl_add_symbol(name, reinterpret_cast<sym_hook_p>(func), scalable); +} + +void fl_draw_draw_text(const char *str, int n, int x, int y) { + fl_draw(str, n, x, y); +} + +void fl_draw_draw_text2(const char *str, int x, int y, int w, int h, + unsigned align, void * img, int draw_symbols) { + fl_draw(str, x, y, w, h, (Fl_Align)align, (Fl_Image*)img, draw_symbols); +} + +typedef void (t_hook)(const char *, int ,int ,int); +typedef t_hook* t_hook_p; + +void fl_draw_draw_text3(const char *str, int x, int y, int w, int h, + unsigned align, void * func, void * img, int draw_symbols) { + fl_draw(str, x, y, w, h, (Fl_Align)align, + reinterpret_cast<t_hook_p>(func), (Fl_Image*)img, draw_symbols); +} + +void fl_draw_draw_text4(int angle, const char *str, int n, int x, int y) { + fl_draw(angle, str, n, x, y); +} + +void fl_draw_rtl_draw(const char *str, int n, int x, int y) { + fl_rtl_draw(str, n, x, y); +} + +void fl_draw_draw_box(int bk, int x, int y, int w, int h, unsigned int c) { + fl_draw_box((Fl_Boxtype)bk, x, y, w, h, (Fl_Color)c); +} + +void fl_draw_draw_symbol(const char *label, int x, int y, int w, int h, unsigned int c) { + fl_draw_symbol(label, x, y, w, h, (Fl_Color)c); +} + +void fl_draw_measure(const char * str, int &w, int &h, int draw_symbols) { + fl_measure(str, w, h, draw_symbols); +} + +typedef void (a_hook)(void *, int, int, int, int); +typedef a_hook* a_hook_p; + +void fl_draw_scroll(int x, int y, int w, int h, int dx, int dy, + void * func, void * data) { + fl_scroll(x, y, w, h, dx, dy, reinterpret_cast<a_hook_p>(func), data); +} + +void fl_draw_text_extents(const char * t, int n, int &dx, int &dy, int &w, int &h) { + fl_text_extents(t, n, dx, dy, w, h); +} + +double fl_draw_width(const char *txt, int n) { + return fl_width(txt, n); +} + +double fl_draw_width2(unsigned long c) { + return fl_width(c); +} + + + + +void fl_draw_begin_complex_polygon() { + fl_begin_complex_polygon(); +} + +void fl_draw_begin_line() { + fl_begin_line(); +} + +void fl_draw_begin_loop() { + fl_begin_loop(); +} + +void fl_draw_begin_points() { + fl_begin_points(); +} + +void fl_draw_begin_polygon() { + fl_begin_polygon(); +} + + + + +void fl_draw_arc(double x, double y, double r, double start, double end) { + fl_arc(x, y, r, start, end); +} + +void fl_draw_arc2(int x, int y, int w, int h, double a1, double a2) { + fl_arc(x, y, w, h, a1, a2); +} + +// function does not yet exist +// void fl_draw_chord(int x, int y, int w, int h, double a1, double a2) { +// function does not yet exist +// fl_chord(x, y, w, h, a1, a2); +// } + +void fl_draw_circle(double x, double y, double r) { + fl_circle(x, y, r); +} + +void fl_draw_curve(double x0, double y0, double x1, double y1, + double x2, double y2, double x3, double y3) { + fl_curve(x0, y0, x1, y1, x2, y2, x3, y3); +} + +void fl_draw_frame(const char *s, int x, int y, int w, int h) { + fl_frame(s, x, y, w, h); +} + +void fl_draw_gap() { + fl_gap(); +} + +void fl_draw_line(int x0, int y0, int x1, int y1) { + fl_line(x0, y0, x1, y1); +} + +void fl_draw_line2(int x0, int y0, int x1, int y1, int x2, int y2) { + fl_line(x0, y0, x1, y1, x2, y2); +} + +void fl_draw_loop(int x0, int y0, int x1, int y1, int x2, int y2) { + fl_loop(x0, y0, x1, y1, x2, y2); +} + +void fl_draw_loop2(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) { + fl_loop(x0, y0, x1, y1, x2, y2, x3, y3); +} + +void fl_draw_pie(int x, int y, int w, int h, double a1, double a2) { + fl_pie(x, y, w, h, a1, a2); +} + +void fl_draw_point(int x, int y) { + fl_point(x, y); +} + +void fl_draw_polygon(int x0, int y0, int x1, int y1, int x2, int y2) { + fl_polygon(x0, y0, x1, y1, x2, y2); +} + +void fl_draw_polygon2(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) { + fl_polygon(x0, y0, x1, y1, x2, y2, x3, y3); +} + +void fl_draw_rect(int x, int y, int w, int h) { + fl_rect(x, y, w, h); +} + +void fl_draw_rect2(int x, int y, int w, int h, unsigned int c) { + fl_rect(x, y, w, h, c); +} + +void fl_draw_rect_fill(int x, int y, int w, int h) { + fl_rectf(x, y, w, h); +} + +void fl_draw_rect_fill2(int x, int y, int w, int h, unsigned int c) { + fl_rectf(x, y, w, h, (Fl_Color)c); +} + +void fl_draw_rect_fill3(int x, int y, int w, int h, uchar r, uchar g, uchar b) { + fl_rectf(x, y, w, h, r, g, b); +} + +void fl_draw_xy_line(int x0, int y0, int x1) { + fl_xyline(x0, y0, x1); +} + +void fl_draw_xy_line2(int x0, int y0, int x1, int y2) { + fl_xyline(x0, y0, x1, y2); +} + +void fl_draw_xy_line3(int x0, int y0, int x1, int y2, int x3) { + fl_xyline(x0, y0, x1, y2, x3); +} + +void fl_draw_yx_line(int x0, int y0, int y1) { + fl_yxline(x0, y0, y1); +} + +void fl_draw_yx_line2(int x0, int y0, int y1, int x2) { + fl_yxline(x0, y0, y1, x2); +} + +void fl_draw_yx_line3(int x0, int y0, int y1, int x2, int y3) { + fl_yxline(x0, y0, y1, x2, y3); +} + + + + +void fl_draw_end_complex_polygon() { + fl_end_complex_polygon(); +} + +void fl_draw_end_line() { + fl_end_line(); +} + +void fl_draw_end_loop() { + fl_end_loop(); +} + +void fl_draw_end_points() { + fl_end_points(); +} + +void fl_draw_end_polygon() { + fl_end_polygon(); +} + + diff --git a/src/c_fl_draw.h b/src/c_fl_draw.h new file mode 100644 index 0000000..851386e --- /dev/null +++ b/src/c_fl_draw.h @@ -0,0 +1,134 @@ + + +#ifndef FL_DRAW_GUARD +#define FL_DRAW_GUARD + + + + +extern "C" void fl_draw_reset_spot(); +extern "C" void fl_draw_set_spot(int f, int s, int x, int y, int w, int h, void * ptr); +extern "C" void fl_draw_set_status(int x, int y, int w, int h); + + +extern "C" int fl_draw_can_do_alpha_blending(); +extern "C" const char * fl_draw_shortcut_label(unsigned long shortcut); + + +extern "C" const char * fl_draw_latin1_to_local(const char *t, int n); +extern "C" const char * fl_draw_local_to_latin1(const char *t, int n); +extern "C" const char * fl_draw_mac_roman_to_local(const char *t, int n); +extern "C" const char * fl_draw_local_to_mac_roman(const char *t, int n); + + +extern "C" int fl_draw_clip_box(int x, int y, int w, int h, int &bx, int &by, int &bw, int &bh); +extern "C" int fl_draw_not_clipped(int x, int y, int w, int h); +extern "C" void fl_draw_pop_clip(); +extern "C" void fl_draw_push_clip(int x, int y, int w, int h); +extern "C" void fl_draw_push_no_clip(); +extern "C" void fl_draw_restore_clip(); + + +extern "C" void fl_draw_overlay_clear(); +extern "C" void fl_draw_overlay_rect(int x, int y, int w, int h); + + +extern "C" unsigned int fl_draw_get_color(); +extern "C" void fl_draw_set_color(unsigned int c); +extern "C" void fl_draw_set_color2(uchar r, uchar g, uchar b); +extern "C" void fl_draw_set_cursor(int m); +extern "C" void fl_draw_set_cursor2(int m, unsigned int f, unsigned int b); +extern "C" unsigned int fl_draw_get_font(); +extern "C" int fl_draw_size(); +extern "C" void fl_draw_set_font(unsigned int f, int s); +extern "C" int fl_draw_height(); +extern "C" int fl_draw_descent(); +extern "C" int fl_draw_height2(unsigned int f, int s); +extern "C" void fl_draw_line_style(int style, int width, char * dashes); + + +extern "C" void fl_draw_mult_matrix(double a, double b, double c, double d, double x, double y); +extern "C" void fl_draw_pop_matrix(); +extern "C" void fl_draw_push_matrix(); +extern "C" void fl_draw_rotate(double d); +extern "C" void fl_draw_scale(double x); +extern "C" void fl_draw_scale2(double x, double y); +extern "C" double fl_draw_transform_dx(double x, double y); +extern "C" double fl_draw_transform_dy(double x, double y); +extern "C" double fl_draw_transform_x(double x, double y); +extern "C" double fl_draw_transform_y(double x, double y); +extern "C" void fl_draw_transformed_vertex(double xf, double yf); +extern "C" void fl_draw_translate(double x, double y); +extern "C" void fl_draw_vertex(double x, double y); + + +extern "C" void fl_draw_draw_image(void * data, int x, int y, int w, int h, int d, int l); +extern "C" void fl_draw_draw_image2(void * func, void * data, int x, int y, int w, int h, int d); +extern "C" void fl_draw_draw_image_mono(void * data, int x, int y, int w, int h, int d, int l); +extern "C" void fl_draw_draw_image_mono2(void * func, void * data, int x, int y, int w, int h, int d); +extern "C" void * fl_draw_read_image(void * data, int x, int y, int w, int h, int alpha); + + +extern "C" int fl_draw_add_symbol(const char *name, void *func, int scalable); +extern "C" void fl_draw_draw_text(const char *str, int n, int x, int y); +extern "C" void fl_draw_draw_text2(const char *str, int x, int y, int w, int h, + unsigned align, void * img, int draw_symbols); +extern "C" void fl_draw_draw_text3(const char *str, int x, int y, int w, int h, + unsigned align, void * func, void * img, int draw_symbols); +extern "C" void fl_draw_draw_text4(int angle, const char *str, int n, int x, int y); +extern "C" void fl_draw_rtl_draw(const char *str, int n, int x, int y); +extern "C" void fl_draw_draw_box(int bk, int x, int y, int w, int h, unsigned int c); +extern "C" void fl_draw_draw_symbol(const char *label, int x, int y, int w, int h, unsigned int c); +extern "C" void fl_draw_measure(const char * str, int &w, int &h, int draw_symbols); +extern "C" void fl_draw_scroll(int x, int y, int w, int h, int dx, int dy, + void * func, void * data); +extern "C" void fl_draw_text_extents(const char * t, int n, int &dx, int &dy, int &w, int &h); +extern "C" double fl_draw_width(const char *txt, int n); +extern "C" double fl_draw_width2(unsigned long c); + + +extern "C" void fl_draw_begin_complex_polygon(); +extern "C" void fl_draw_begin_line(); +extern "C" void fl_draw_begin_loop(); +extern "C" void fl_draw_begin_points(); +extern "C" void fl_draw_begin_polygon(); + + +extern "C" void fl_draw_arc(double x, double y, double r, double start, double end); +extern "C" void fl_draw_arc2(int x, int y, int w, int h, double a1, double a2); +// extern "C" void fl_draw_chord(int x, int y, int w, int h, double a1, double a2); +extern "C" void fl_draw_circle(double x, double y, double r); +extern "C" void fl_draw_curve(double x0, double y0, double x1, double y1, + double x2, double y2, double x3, double y3); +extern "C" void fl_draw_frame(const char *s, int x, int y, int w, int h); +extern "C" void fl_draw_gap(); +extern "C" void fl_draw_line(int x0, int y0, int x1, int y1); +extern "C" void fl_draw_line2(int x0, int y0, int x1, int y1, int x2, int y2); +extern "C" void fl_draw_loop(int x0, int y0, int x1, int y1, int x2, int y2); +extern "C" void fl_draw_loop2(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); +extern "C" void fl_draw_pie(int x, int y, int w, int h, double a1, double a2); +extern "C" void fl_draw_point(int x, int y); +extern "C" void fl_draw_polygon(int x0, int y0, int x1, int y1, int x2, int y2); +extern "C" void fl_draw_polygon2(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); +extern "C" void fl_draw_rect(int x, int y, int w, int h); +extern "C" void fl_draw_rect2(int x, int y, int w, int h, unsigned int c); +extern "C" void fl_draw_rect_fill(int x, int y, int w, int h); +extern "C" void fl_draw_rect_fill2(int x, int y, int w, int h, unsigned int c); +extern "C" void fl_draw_rect_fill3(int x, int y, int w, int h, uchar r, uchar g, uchar b); +extern "C" void fl_draw_xy_line(int x0, int y0, int x1); +extern "C" void fl_draw_xy_line2(int x0, int y0, int x1, int y2); +extern "C" void fl_draw_xy_line3(int x0, int y0, int x1, int y2, int x3); +extern "C" void fl_draw_yx_line(int x0, int y0, int y1); +extern "C" void fl_draw_yx_line2(int x0, int y0, int y1, int x2); +extern "C" void fl_draw_yx_line3(int x0, int y0, int y1, int x2, int y3); + + +extern "C" void fl_draw_end_complex_polygon(); +extern "C" void fl_draw_end_line(); +extern "C" void fl_draw_end_loop(); +extern "C" void fl_draw_end_points(); +extern "C" void fl_draw_end_polygon(); + + +#endif + diff --git a/src/c_fl_gl_window.cpp b/src/c_fl_gl_window.cpp new file mode 100644 index 0000000..9b1766d --- /dev/null +++ b/src/c_fl_gl_window.cpp @@ -0,0 +1,182 @@ + + +#include <FL/Fl_Gl_Window.H> +#include "c_fl_gl_window.h" +#include "c_fl_type.h" + + + + +class My_Gl_Window : public Fl_Gl_Window { + public: + using Fl_Gl_Window::Fl_Gl_Window; + friend void gl_window_set_draw_hook(GLWINDOW n, void * d); + friend void fl_gl_window_draw(GLWINDOW n); + friend void gl_window_set_handle_hook(GLWINDOW n, void * h); + friend int fl_gl_window_handle(GLWINDOW n, int e); + protected: + void draw(); + void real_draw(); + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; +}; + +void My_Gl_Window::draw() { + (*draw_hook)(this->user_data()); +} + +void My_Gl_Window::real_draw() { + Fl_Gl_Window::draw(); +} + +int My_Gl_Window::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + +int My_Gl_Window::real_handle(int e) { + return Fl_Gl_Window::handle(e); +} + +void gl_window_set_draw_hook(GLWINDOW n, void * d) { + reinterpret_cast<My_Gl_Window*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + +void fl_gl_window_draw(GLWINDOW n) { + reinterpret_cast<My_Gl_Window*>(n)->real_draw(); +} + +void gl_window_set_handle_hook(GLWINDOW n, void * h) { + reinterpret_cast<My_Gl_Window*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h); +} + +int fl_gl_window_handle(GLWINDOW n, int e) { + return reinterpret_cast<My_Gl_Window*>(n)->real_handle(e); +} + + + + +GLWINDOW new_fl_gl_window(int x, int y, int w, int h, char* label) { + My_Gl_Window *gw = new My_Gl_Window(x, y, w, h, label); + return gw; +} + +GLWINDOW new_fl_gl_window2(int w, int h, char* label) { + My_Gl_Window *gw = new My_Gl_Window(w, h, label); + return gw; +} + +void free_fl_gl_window(GLWINDOW w) { + delete reinterpret_cast<My_Gl_Window*>(w); +} + + + + +void fl_gl_window_show(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->show(); +} + +void fl_gl_window_hide(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->hide(); +} + +void fl_gl_window_hide_overlay(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->hide_overlay(); +} + +void fl_gl_window_flush(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->flush(); +} + + + + +int fl_gl_window_pixel_h(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->pixel_h(); +} + +int fl_gl_window_pixel_w(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->pixel_w(); +} + +float fl_gl_window_pixels_per_unit(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->pixels_per_unit(); +} + + + + +unsigned int fl_gl_window_get_mode(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->mode(); +} + +void fl_gl_window_set_mode(GLWINDOW w, unsigned int a) { + reinterpret_cast<Fl_Gl_Window*>(w)->mode(a); +} + +int fl_gl_window_static_can_do(unsigned int m) { + return Fl_Gl_Window::can_do(m); +} + +int fl_gl_window_can_do(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->can_do(); +} + +int fl_gl_window_can_do_overlay(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->can_do_overlay(); +} + + + + +void * fl_gl_window_get_context(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->context(); +} + +void fl_gl_window_set_context(GLWINDOW w, void * con, int des) { + reinterpret_cast<Fl_Gl_Window*>(w)->context(con, des); +} + +char fl_gl_window_context_valid(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->context_valid(); +} + +void fl_gl_window_set_context_valid(GLWINDOW w, char v) { + reinterpret_cast<Fl_Gl_Window*>(w)->context_valid(v); +} + +char fl_gl_window_valid(GLWINDOW w) { + return reinterpret_cast<Fl_Gl_Window*>(w)->valid(); +} + +void fl_gl_window_set_valid(GLWINDOW w, char v) { + reinterpret_cast<Fl_Gl_Window*>(w)->valid(v); +} + +void fl_gl_window_make_current(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->make_current(); +} + +void fl_gl_window_make_overlay_current(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->make_overlay_current(); +} + + + + +void fl_gl_window_ortho(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->ortho(); +} + +void fl_gl_window_redraw_overlay(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->redraw_overlay(); +} + +void fl_gl_window_swap_buffers(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->swap_buffers(); +} + + diff --git a/src/c_fl_gl_window.h b/src/c_fl_gl_window.h new file mode 100644 index 0000000..155c2ef --- /dev/null +++ b/src/c_fl_gl_window.h @@ -0,0 +1,63 @@ + + +#ifndef FL_GL_WINDOW_GUARD +#define FL_GL_WINDOW_GUARD + + + + +typedef void* GLWINDOW; + + + + +extern "C" void gl_window_set_draw_hook(GLWINDOW n, void * d); +extern "C" void fl_gl_window_draw(GLWINDOW n); +extern "C" void gl_window_set_handle_hook(GLWINDOW n, void * h); +extern "C" int fl_gl_window_handle(GLWINDOW n, int e); + + + + +extern "C" GLWINDOW new_fl_gl_window(int x, int y, int w, int h, char* label); +extern "C" GLWINDOW new_fl_gl_window2(int w, int h, char* label); +extern "C" void free_fl_gl_window(GLWINDOW w); + + + + +extern "C" void fl_gl_window_show(GLWINDOW w); +extern "C" void fl_gl_window_hide(GLWINDOW w); +extern "C" void fl_gl_window_hide_overlay(GLWINDOW w); +extern "C" void fl_gl_window_flush(GLWINDOW w); + + +extern "C" int fl_gl_window_pixel_h(GLWINDOW w); +extern "C" int fl_gl_window_pixel_w(GLWINDOW w); +extern "C" float fl_gl_window_pixels_per_unit(GLWINDOW w); + + +extern "C" unsigned int fl_gl_window_get_mode(GLWINDOW w); +extern "C" void fl_gl_window_set_mode(GLWINDOW w, unsigned int a); +extern "C" int fl_gl_window_static_can_do(unsigned int m); +extern "C" int fl_gl_window_can_do(GLWINDOW w); +extern "C" int fl_gl_window_can_do_overlay(GLWINDOW w); + + +extern "C" void * fl_gl_window_get_context(GLWINDOW w); +extern "C" void fl_gl_window_set_context(GLWINDOW w, void * con, int des); +extern "C" char fl_gl_window_context_valid(GLWINDOW w); +extern "C" void fl_gl_window_set_context_valid(GLWINDOW w, char v); +extern "C" char fl_gl_window_valid(GLWINDOW w); +extern "C" void fl_gl_window_set_valid(GLWINDOW w, char v); +extern "C" void fl_gl_window_make_current(GLWINDOW w); +extern "C" void fl_gl_window_make_overlay_current(GLWINDOW w); + + +extern "C" void fl_gl_window_ortho(GLWINDOW w); +extern "C" void fl_gl_window_redraw_overlay(GLWINDOW w); +extern "C" void fl_gl_window_swap_buffers(GLWINDOW w); + + +#endif + diff --git a/src/c_fl_image.cpp b/src/c_fl_image.cpp index 07b6d4d..6e42280 100644 --- a/src/c_fl_image.cpp +++ b/src/c_fl_image.cpp @@ -77,6 +77,11 @@ int fl_image_fail(IMAGE i) { } } +void fl_image_uncache(IMAGE i) { + // virtual so disable dispatch + reinterpret_cast<Fl_Image*>(i)->Fl_Image::uncache(); +} + @@ -92,6 +97,29 @@ int fl_image_d(IMAGE i) { return reinterpret_cast<Fl_Image*>(i)->d(); } +int fl_image_ld(IMAGE i) { + return reinterpret_cast<Fl_Image*>(i)->ld(); +} + +int fl_image_count(IMAGE i) { + return reinterpret_cast<Fl_Image*>(i)->count(); +} + + + + +const void * fl_image_data(IMAGE i) { + return reinterpret_cast<Fl_Image*>(i)->data(); +} + +char fl_image_get_pixel(char *c, int off) { + return c[off]; +} + +void fl_image_set_pixel(char *c, int off, char val) { + c[off] = val; +} + diff --git a/src/c_fl_image.h b/src/c_fl_image.h index 29e1b93..2915ab7 100644 --- a/src/c_fl_image.h +++ b/src/c_fl_image.h @@ -29,11 +29,19 @@ extern "C" void fl_image_desaturate(IMAGE i); extern "C" void fl_image_inactive(IMAGE i); extern "C" int fl_image_fail(IMAGE i); +extern "C" void fl_image_uncache(IMAGE i); extern "C" int fl_image_w(IMAGE i); extern "C" int fl_image_h(IMAGE i); extern "C" int fl_image_d(IMAGE i); +extern "C" int fl_image_ld(IMAGE i); +extern "C" int fl_image_count(IMAGE i); + + +extern "C" const void * fl_image_data(IMAGE i); +extern "C" char fl_image_get_pixel(char *c, int off); +extern "C" void fl_image_set_pixel(char *c, int off, char val); extern "C" void fl_image_draw(IMAGE i, int x, int y); diff --git a/src/c_fl_jpeg_image.cpp b/src/c_fl_jpeg_image.cpp index 93ab22d..be99257 100644 --- a/src/c_fl_jpeg_image.cpp +++ b/src/c_fl_jpeg_image.cpp @@ -11,6 +11,11 @@ JPEG_IMAGE new_fl_jpeg_image(const char * f) { return j; } +JPEG_IMAGE new_fl_jpeg_image2(const char *n, void *data) { + Fl_JPEG_Image *j = new Fl_JPEG_Image(n, reinterpret_cast<uchar*>(data)); + return j; +} + void free_fl_jpeg_image(JPEG_IMAGE j) { delete reinterpret_cast<Fl_JPEG_Image*>(j); } diff --git a/src/c_fl_jpeg_image.h b/src/c_fl_jpeg_image.h index c81bd6f..1592465 100644 --- a/src/c_fl_jpeg_image.h +++ b/src/c_fl_jpeg_image.h @@ -12,6 +12,7 @@ typedef void* JPEG_IMAGE; extern "C" JPEG_IMAGE new_fl_jpeg_image(const char * f); +extern "C" JPEG_IMAGE new_fl_jpeg_image2(const char * n, void *data); extern "C" void free_fl_jpeg_image(JPEG_IMAGE j); diff --git a/src/c_fl_overlay_window.cpp b/src/c_fl_overlay_window.cpp new file mode 100644 index 0000000..84a65f2 --- /dev/null +++ b/src/c_fl_overlay_window.cpp @@ -0,0 +1,117 @@ + + +#include <FL/Fl_Overlay_Window.H> +#include "c_fl_overlay_window.h" +#include "c_fl_type.h" + + + + +class My_Overlay_Window : public Fl_Overlay_Window { + public: + using Fl_Overlay_Window::Fl_Overlay_Window; + friend void overlay_window_set_draw_hook(OVERLAYWINDOW w, void * d); + friend void fl_overlay_window_draw(OVERLAYWINDOW w); + friend void overlay_window_set_draw_overlay_hook(OVERLAYWINDOW w, void * d); + friend void overlay_window_set_handle_hook(OVERLAYWINDOW w, void * h); + friend int fl_overlay_window_handle(OVERLAYWINDOW w, int e); + friend OVERLAYWINDOW new_fl_overlay_window(int x, int y, int w, int h, char *label); + friend OVERLAYWINDOW new_fl_overlay_window2(int w, int h, char *label); + protected: + void draw(); + void real_draw(); + void draw_overlay(); + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + d_hook_p draw_overlay_hook; + h_hook_p handle_hook; +}; + +void My_Overlay_Window::draw() { + (*draw_hook)(this->user_data()); +} + +void My_Overlay_Window::real_draw() { + Fl_Overlay_Window::draw(); +} + +void My_Overlay_Window::draw_overlay() { + (*draw_overlay_hook)(this->user_data()); +} + +int My_Overlay_Window::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + +int My_Overlay_Window::real_handle(int e) { + return Fl_Overlay_Window::handle(e); +} + +void overlay_window_set_draw_hook(OVERLAYWINDOW w, void * d) { + reinterpret_cast<My_Overlay_Window*>(w)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + +void fl_overlay_window_draw(OVERLAYWINDOW w) { + reinterpret_cast<My_Overlay_Window*>(w)->real_draw(); +} + +void overlay_window_set_draw_overlay_hook(OVERLAYWINDOW w, void * d) { + reinterpret_cast<My_Overlay_Window*>(w)->draw_overlay_hook = reinterpret_cast<d_hook_p>(d); +} + +void overlay_window_set_handle_hook(OVERLAYWINDOW w, void * h) { + reinterpret_cast<My_Overlay_Window*>(w)->handle_hook = reinterpret_cast<h_hook_p>(h); +} + +int fl_overlay_window_handle(OVERLAYWINDOW w, int e) { + return reinterpret_cast<My_Overlay_Window*>(w)->real_handle(e); +} + + + + +OVERLAYWINDOW new_fl_overlay_window(int x, int y, int w, int h, char *label) { + My_Overlay_Window *ow = new My_Overlay_Window(x, y, w, h, label); + return ow; +} + +OVERLAYWINDOW new_fl_overlay_window2(int w, int h, char *label) { + My_Overlay_Window *ow = new My_Overlay_Window(w, h, label); + return ow; +} + +void free_fl_overlay_window(OVERLAYWINDOW w) { + delete reinterpret_cast<My_Overlay_Window*>(w); +} + + + + +int fl_overlay_window_can_do_overlay(OVERLAYWINDOW w) { + return reinterpret_cast<Fl_Overlay_Window*>(w)->can_do_overlay(); +} + + + + +void fl_overlay_window_show(OVERLAYWINDOW w) { + reinterpret_cast<Fl_Overlay_Window*>(w)->show(); +} + +void fl_overlay_window_hide(OVERLAYWINDOW w) { + reinterpret_cast<Fl_Overlay_Window*>(w)->hide(); +} + +void fl_overlay_window_flush(OVERLAYWINDOW w) { + reinterpret_cast<Fl_Overlay_Window*>(w)->flush(); +} + + + + +void fl_overlay_window_redraw_overlay(OVERLAYWINDOW w) { + reinterpret_cast<Fl_Overlay_Window*>(w)->redraw_overlay(); +} + + diff --git a/src/c_fl_overlay_window.h b/src/c_fl_overlay_window.h new file mode 100644 index 0000000..ab8cb70 --- /dev/null +++ b/src/c_fl_overlay_window.h @@ -0,0 +1,42 @@ + + +#ifndef FL_OVERLAY_WINDOW_GUARD +#define FL_OVERLAY_WINDOW_GUARD + + + + +typedef void* OVERLAYWINDOW; + + + + +extern "C" void overlay_window_set_draw_hook(OVERLAYWINDOW w, void * d); +extern "C" void fl_overlay_window_draw(OVERLAYWINDOW w); +extern "C" void overlay_window_set_draw_overlay_hook(OVERLAYWINDOW w, void * d); +extern "C" void overlay_window_set_handle_hook(OVERLAYWINDOW w, void * h); +extern "C" int fl_overlay_window_handle(OVERLAYWINDOW w, int e); + + + + +extern "C" OVERLAYWINDOW new_fl_overlay_window(int x, int y, int w, int h, char *label); +extern "C" OVERLAYWINDOW new_fl_overlay_window2(int w, int h, char *label); +extern "C" void free_fl_overlay_window(OVERLAYWINDOW w); + + + + +extern "C" int fl_overlay_window_can_do_overlay(OVERLAYWINDOW w); + + +extern "C" void fl_overlay_window_show(OVERLAYWINDOW w); +extern "C" void fl_overlay_window_hide(OVERLAYWINDOW w); +extern "C" void fl_overlay_window_flush(OVERLAYWINDOW w); + + +extern "C" void fl_overlay_window_redraw_overlay(OVERLAYWINDOW w); + + +#endif + diff --git a/src/c_fl_pixmap.cpp b/src/c_fl_pixmap.cpp index 18e6b5d..322f98c 100644 --- a/src/c_fl_pixmap.cpp +++ b/src/c_fl_pixmap.cpp @@ -11,6 +11,7 @@ void free_fl_pixmap(PIXMAP b) { } PIXMAP fl_pixmap_copy(PIXMAP b, int w, int h) { + // virtual so disable dispatch return reinterpret_cast<Fl_Pixmap*>(b)->Fl_Pixmap::copy(w, h); } @@ -34,11 +35,20 @@ void fl_pixmap_desaturate(PIXMAP p) { +void fl_pixmap_uncache(PIXMAP p) { + // virtual so disable dispatch + reinterpret_cast<Fl_Pixmap*>(p)->Fl_Pixmap::uncache(); +} + + + + void fl_pixmap_draw2(PIXMAP b, int x, int y) { reinterpret_cast<Fl_Pixmap*>(b)->draw(x, y); } void fl_pixmap_draw(PIXMAP b, int x, int y, int w, int h, int cx, int cy) { + // virtual so disable dispatch reinterpret_cast<Fl_Pixmap*>(b)->Fl_Pixmap::draw(x, y, w, h, cx, cy); } diff --git a/src/c_fl_pixmap.h b/src/c_fl_pixmap.h index de987a8..1d5a57a 100644 --- a/src/c_fl_pixmap.h +++ b/src/c_fl_pixmap.h @@ -20,6 +20,9 @@ extern "C" void fl_pixmap_color_average(PIXMAP p, int c, float b); extern "C" void fl_pixmap_desaturate(PIXMAP p); +extern "C" void fl_pixmap_uncache(PIXMAP p); + + extern "C" void fl_pixmap_draw2(PIXMAP b, int x, int y); extern "C" void fl_pixmap_draw(PIXMAP b, int x, int y, int w, int h, int cx, int cy); diff --git a/src/c_fl_png_image.cpp b/src/c_fl_png_image.cpp index 132c567..b4fb29a 100644 --- a/src/c_fl_png_image.cpp +++ b/src/c_fl_png_image.cpp @@ -11,6 +11,11 @@ PNG_IMAGE new_fl_png_image(const char * f) { return p; } +PNG_IMAGE new_fl_png_image2(const char *name, void *data, int size) { + Fl_PNG_Image *p = new Fl_PNG_Image(name, reinterpret_cast<uchar*>(data), size); + return p; +} + void free_fl_png_image(PNG_IMAGE p) { delete reinterpret_cast<Fl_PNG_Image*>(p); } diff --git a/src/c_fl_png_image.h b/src/c_fl_png_image.h index b9901ea..7e9a25c 100644 --- a/src/c_fl_png_image.h +++ b/src/c_fl_png_image.h @@ -12,6 +12,7 @@ typedef void* PNG_IMAGE; extern "C" PNG_IMAGE new_fl_png_image(const char * f); +extern "C" PNG_IMAGE new_fl_png_image2(const char *name, void *data, int size); extern "C" void free_fl_png_image(PNG_IMAGE p); diff --git a/src/c_fl_rgb_image.cpp b/src/c_fl_rgb_image.cpp index 3c0fec6..adde3e4 100644 --- a/src/c_fl_rgb_image.cpp +++ b/src/c_fl_rgb_image.cpp @@ -1,15 +1,34 @@ #include <FL/Fl_RGB_Image.H> +#include <FL/Fl_Pixmap.H> #include "c_fl_rgb_image.h" +RGB_IMAGE new_fl_rgb_image(void *data, int w, int h, int d, int ld) { + Fl_RGB_Image *rgb = new Fl_RGB_Image(reinterpret_cast<uchar*>(data), w, h, d, ld); + return rgb; +} + +RGB_IMAGE new_fl_rgb_image2(void *pix, unsigned int c) { + Fl_RGB_Image *rgb = new Fl_RGB_Image(reinterpret_cast<Fl_Pixmap*>(pix), c); + return rgb; +} + void free_fl_rgb_image(RGB_IMAGE i) { delete reinterpret_cast<Fl_RGB_Image*>(i); } +size_t fl_rgb_image_get_max_size() { + return Fl_RGB_Image::max_size(); +} + +void fl_rgb_image_set_max_size(size_t v) { + Fl_RGB_Image::max_size(v); +} + RGB_IMAGE fl_rgb_image_copy(RGB_IMAGE i, int w, int h) { // virtual so disable dispatch return reinterpret_cast<Fl_RGB_Image*>(i)->Fl_RGB_Image::copy(w, h); @@ -35,6 +54,14 @@ void fl_rgb_image_desaturate(RGB_IMAGE i) { +void fl_rgb_image_uncache(RGB_IMAGE i) { + // virtual so disable dispatch + reinterpret_cast<Fl_RGB_Image*>(i)->Fl_RGB_Image::uncache(); +} + + + + void fl_rgb_image_draw2(RGB_IMAGE i, int x, int y) { reinterpret_cast<Fl_RGB_Image*>(i)->draw(x, y); } diff --git a/src/c_fl_rgb_image.h b/src/c_fl_rgb_image.h index 3ec4c58..0e32539 100644 --- a/src/c_fl_rgb_image.h +++ b/src/c_fl_rgb_image.h @@ -11,7 +11,11 @@ typedef void* RGB_IMAGE; +extern "C" RGB_IMAGE new_fl_rgb_image(void *data, int w, int h, int d, int ld); +extern "C" RGB_IMAGE new_fl_rgb_image2(void *pix, unsigned int c); extern "C" void free_fl_rgb_image(RGB_IMAGE i); +extern "C" size_t fl_rgb_image_get_max_size(); +extern "C" void fl_rgb_image_set_max_size(size_t v); extern "C" RGB_IMAGE fl_rgb_image_copy(RGB_IMAGE i, int w, int h); extern "C" RGB_IMAGE fl_rgb_image_copy2(RGB_IMAGE i); @@ -22,6 +26,9 @@ extern "C" void fl_rgb_image_color_average(RGB_IMAGE i, int c, float b); extern "C" void fl_rgb_image_desaturate(RGB_IMAGE i); +extern "C" void fl_rgb_image_uncache(RGB_IMAGE i); + + extern "C" void fl_rgb_image_draw2(RGB_IMAGE i, int x, int y); extern "C" void fl_rgb_image_draw(RGB_IMAGE i, int x, int y, int w, int h, int cx, int cy); diff --git a/src/c_fl_shared_image.cpp b/src/c_fl_shared_image.cpp index b7fcdb2..fd09519 100644 --- a/src/c_fl_shared_image.cpp +++ b/src/c_fl_shared_image.cpp @@ -48,14 +48,31 @@ void fl_shared_image_desaturate(SHARED_IMAGE i) { +int fl_shared_image_num_images() { + return Fl_Shared_Image::num_images(); +} + const char * fl_shared_image_name(SHARED_IMAGE i) { return reinterpret_cast<Fl_Shared_Image*>(i)->name(); } +int fl_shared_image_original(SHARED_IMAGE i) { + return reinterpret_cast<Fl_Shared_Image*>(i)->original(); +} + +int fl_shared_image_refcount(SHARED_IMAGE i) { + return reinterpret_cast<Fl_Shared_Image*>(i)->refcount(); +} + void fl_shared_image_reload(SHARED_IMAGE i) { reinterpret_cast<Fl_Shared_Image*>(i)->reload(); } +void fl_shared_image_uncache(SHARED_IMAGE i) { + // virtual so disable dispatch + reinterpret_cast<Fl_Shared_Image*>(i)->uncache(); +} + @@ -67,9 +84,6 @@ void fl_shared_image_scale(SHARED_IMAGE i, int w, int h, int p, int e) { reinterpret_cast<Fl_Shared_Image*>(i)->scale(w, h, p, e); } - - - void fl_shared_image_draw(SHARED_IMAGE i, int x, int y, int w, int h, int cx, int cy) { // virtual so disable dispatch reinterpret_cast<Fl_Shared_Image*>(i)->Fl_Shared_Image::draw(x, y, w, h, cx, cy); diff --git a/src/c_fl_shared_image.h b/src/c_fl_shared_image.h index 5555530..d7d57f2 100644 --- a/src/c_fl_shared_image.h +++ b/src/c_fl_shared_image.h @@ -25,14 +25,16 @@ extern "C" void fl_shared_image_color_average(SHARED_IMAGE i, int c, float b); extern "C" void fl_shared_image_desaturate(SHARED_IMAGE i); +extern "C" int fl_shared_image_num_images(); extern "C" const char * fl_shared_image_name(SHARED_IMAGE i); +extern "C" int fl_shared_image_original(SHARED_IMAGE i); +extern "C" int fl_shared_image_refcount(SHARED_IMAGE i); extern "C" void fl_shared_image_reload(SHARED_IMAGE i); +extern "C" void fl_shared_image_uncache(SHARED_IMAGE i); extern "C" void fl_shared_image_scaling_algorithm(int v); extern "C" void fl_shared_image_scale(SHARED_IMAGE i, int w, int h, int p, int e); - - extern "C" void fl_shared_image_draw(SHARED_IMAGE i, int x, int y, int w, int h, int cx, int cy); extern "C" void fl_shared_image_draw2(SHARED_IMAGE i, int x, int y); diff --git a/src/c_fl_tiled_image.cpp b/src/c_fl_tiled_image.cpp new file mode 100644 index 0000000..8d7ecde --- /dev/null +++ b/src/c_fl_tiled_image.cpp @@ -0,0 +1,60 @@ + + +#include <FL/Fl_Tiled_Image.H> +#include <FL/Fl_Image.H> +#include "c_fl_tiled_image.h" + + + + +TILED_IMAGE new_fl_tiled_image(void * i, int w, int h) { + Fl_Tiled_Image *t = new Fl_Tiled_Image(reinterpret_cast<Fl_Image*>(i), w, h); + return t; +} + +void free_fl_tiled_image(TILED_IMAGE t) { + delete reinterpret_cast<Fl_Tiled_Image*>(t); +} + +TILED_IMAGE fl_tiled_image_copy(TILED_IMAGE t, int w, int h) { + // virtual so disable dispatch + return reinterpret_cast<Fl_Tiled_Image*>(t)->Fl_Tiled_Image::copy(w, h); +} + +TILED_IMAGE fl_tiled_image_copy2(TILED_IMAGE t) { + return reinterpret_cast<Fl_Tiled_Image*>(t)->copy(); +} + + + + +void * fl_tiled_image_get_image(TILED_IMAGE t) { + return reinterpret_cast<Fl_Tiled_Image*>(t)->image(); +} + + + + +void fl_tiled_image_color_average(TILED_IMAGE t, int c, float b) { + // virtual so disable dispatch + reinterpret_cast<Fl_Tiled_Image*>(t)->Fl_Tiled_Image::color_average(c, b); +} + +void fl_tiled_image_desaturate(TILED_IMAGE t) { + // virtual so disable dispatch + reinterpret_cast<Fl_Tiled_Image*>(t)->Fl_Tiled_Image::desaturate(); +} + + + + +void fl_tiled_image_draw(TILED_IMAGE t, int x, int y) { + reinterpret_cast<Fl_Tiled_Image*>(t)->draw(x, y); +} + +void fl_tiled_image_draw2(TILED_IMAGE t, int x, int y, int w, int h, int cx, int cy) { + // virtual so disable dispatch + reinterpret_cast<Fl_Tiled_Image*>(t)->Fl_Tiled_Image::draw(x, y, w, h, cx, cy); +} + + diff --git a/src/c_fl_tiled_image.h b/src/c_fl_tiled_image.h new file mode 100644 index 0000000..12b1c1e --- /dev/null +++ b/src/c_fl_tiled_image.h @@ -0,0 +1,34 @@ + + +#ifndef FL_TILED_IMAGE_GUARD +#define FL_TILED_IMAGE_GUARD + + + + +typedef void* TILED_IMAGE; + + + + +extern "C" TILED_IMAGE new_fl_tiled_image(void * i, int w, int h); +extern "C" void free_fl_tiled_image(TILED_IMAGE t); +extern "C" TILED_IMAGE fl_tiled_image_copy(TILED_IMAGE t, int w, int h); +extern "C" TILED_IMAGE fl_tiled_image_copy2(TILED_IMAGE t); + + + + +extern "C" void * fl_tiled_image_get_image(TILED_IMAGE t); + + +extern "C" void fl_tiled_image_color_average(TILED_IMAGE t, int c, float b); +extern "C" void fl_tiled_image_desaturate(TILED_IMAGE t); + + +extern "C" void fl_tiled_image_draw(TILED_IMAGE t, int x, int y); +extern "C" void fl_tiled_image_draw2(TILED_IMAGE t, int x, int y, int w, int h, int cx, int cy); + + +#endif + diff --git a/src/fltk-draw.adb b/src/fltk-draw.adb new file mode 100644 index 0000000..df2af30 --- /dev/null +++ b/src/fltk-draw.adb @@ -0,0 +1,1880 @@ + + +with + + Ada.Unchecked_Deallocation, + Interfaces.C.Strings, + System; + +use type + + Interfaces.C.int, + Interfaces.C.size_t, + System.Address; + + +package body FLTK.Draw is + + + procedure fl_draw_reset_spot; + pragma Import (C, fl_draw_reset_spot, "fl_draw_reset_spot"); + pragma Inline (fl_draw_reset_spot); + + procedure fl_draw_set_spot + (F, S : in Interfaces.C.int; + X, Y, W, H : in Interfaces.C.int; + Ptr : in System.Address); + pragma Import (C, fl_draw_set_spot, "fl_draw_set_spot"); + pragma Inline (fl_draw_set_spot); + + procedure fl_draw_set_status + (X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_draw_set_status, "fl_draw_set_status"); + pragma Inline (fl_draw_set_status); + + + + + function fl_draw_can_do_alpha_blending + return Interfaces.C.int; + pragma Import (C, fl_draw_can_do_alpha_blending, "fl_draw_can_do_alpha_blending"); + pragma Inline (fl_draw_can_do_alpha_blending); + + function fl_draw_shortcut_label + (Shortcut : in Interfaces.C.unsigned_long) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_draw_shortcut_label, "fl_draw_shortcut_label"); + pragma Inline (fl_draw_shortcut_label); + + + + + function fl_draw_latin1_to_local + (T : in Interfaces.C.char_array; + N : in Interfaces.C.int) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_draw_latin1_to_local, "fl_draw_latin1_to_local"); + pragma Inline (fl_draw_latin1_to_local); + + function fl_draw_local_to_latin1 + (T : in Interfaces.C.char_array; + N : in Interfaces.C.int) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_draw_local_to_latin1, "fl_draw_local_to_latin1"); + pragma Inline (fl_draw_local_to_latin1); + + function fl_draw_mac_roman_to_local + (T : in Interfaces.C.char_array; + N : in Interfaces.C.int) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_draw_mac_roman_to_local, "fl_draw_mac_roman_to_local"); + pragma Inline (fl_draw_mac_roman_to_local); + + function fl_draw_local_to_mac_roman + (T : in Interfaces.C.char_array; + N : in Interfaces.C.int) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_draw_local_to_mac_roman, "fl_draw_local_to_mac_roman"); + pragma Inline (fl_draw_local_to_mac_roman); + + + + + function fl_draw_clip_box + (X, Y, W, H : in Interfaces.C.int; + BX, BY, BW, BH : out Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_draw_clip_box, "fl_draw_clip_box"); + pragma Inline (fl_draw_clip_box); + + function fl_draw_not_clipped + (X, Y, W, H : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_draw_not_clipped, "fl_draw_not_clipped"); + pragma Inline (fl_draw_not_clipped); + + procedure fl_draw_pop_clip; + pragma Import (C, fl_draw_pop_clip, "fl_draw_pop_clip"); + pragma Inline (fl_draw_pop_clip); + + procedure fl_draw_push_clip + (X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_draw_push_clip, "fl_draw_push_clip"); + pragma Inline (fl_draw_push_clip); + + procedure fl_draw_push_no_clip; + pragma Import (C, fl_draw_push_no_clip, "fl_draw_push_no_clip"); + pragma Inline (fl_draw_push_no_clip); + + procedure fl_draw_restore_clip; + pragma Import (C, fl_draw_restore_clip, "fl_draw_restore_clip"); + pragma Inline (fl_draw_restore_clip); + + + + + procedure fl_draw_overlay_clear; + pragma Import (C, fl_draw_overlay_clear, "fl_draw_overlay_clear"); + pragma Inline (fl_draw_overlay_clear); + + procedure fl_draw_overlay_rect + (X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_draw_overlay_rect, "fl_draw_overlay_rect"); + pragma Inline (fl_draw_overlay_rect); + + + + + function fl_draw_get_color + return Interfaces.C.unsigned; + pragma Import (C, fl_draw_get_color, "fl_draw_get_color"); + pragma Inline (fl_draw_get_color); + + procedure fl_draw_set_color + (C : in Interfaces.C.unsigned); + pragma Import (C, fl_draw_set_color, "fl_draw_set_color"); + pragma Inline (fl_draw_set_color); + + procedure fl_draw_set_color2 + (R, G, B : in Interfaces.C.unsigned_char); + pragma Import (C, fl_draw_set_color2, "fl_draw_set_color2"); + pragma Inline (fl_draw_set_color2); + + procedure fl_draw_set_cursor + (M : in Interfaces.C.int); + pragma Import (C, fl_draw_set_cursor, "fl_draw_set_cursor"); + pragma Inline (fl_draw_set_cursor); + + procedure fl_draw_set_cursor2 + (M : in Interfaces.C.int; + F, B : in Interfaces.C.unsigned); + pragma Import (C, fl_draw_set_cursor2, "fl_draw_set_cursor2"); + pragma Inline (fl_draw_set_cursor2); + + function fl_draw_get_font + return Interfaces.C.unsigned; + pragma Import (C, fl_draw_get_font, "fl_draw_get_font"); + pragma Inline (fl_draw_get_font); + + function fl_draw_size + return Interfaces.C.int; + pragma Import (C, fl_draw_size, "fl_draw_size"); + pragma Inline (fl_draw_size); + + procedure fl_draw_set_font + (F : in Interfaces.C.unsigned; + S : in Interfaces.C.int); + pragma Import (C, fl_draw_set_font, "fl_draw_set_font"); + pragma Inline (fl_draw_set_font); + + function fl_draw_height + return Interfaces.C.int; + pragma Import (C, fl_draw_height, "fl_draw_height"); + pragma Inline (fl_draw_height); + + function fl_draw_descent + return Interfaces.C.int; + pragma Import (C, fl_draw_descent, "fl_draw_descent"); + pragma Inline (fl_draw_descent); + + function fl_draw_height2 + (F : in Interfaces.C.unsigned; + S : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_draw_height2, "fl_draw_height2"); + pragma Inline (fl_draw_height2); + + procedure fl_draw_line_style + (Style : in Interfaces.C.int; + Width : in Interfaces.C.int; + Dashes : in Interfaces.C.char_array); + pragma Import (C, fl_draw_line_style, "fl_draw_line_style"); + pragma Inline (fl_draw_line_style); + + + + + procedure fl_draw_mult_matrix + (A, B, C, D, X, Y : in Interfaces.C.double); + pragma Import (C, fl_draw_mult_matrix, "fl_draw_mult_matrix"); + pragma Inline (fl_draw_mult_matrix); + + procedure fl_draw_pop_matrix; + pragma Import (C, fl_draw_pop_matrix, "fl_draw_pop_matrix"); + pragma Inline (fl_draw_pop_matrix); + + procedure fl_draw_push_matrix; + pragma Import (C, fl_draw_push_matrix, "fl_draw_push_matrix"); + pragma Inline (fl_draw_push_matrix); + + procedure fl_draw_rotate + (D : in Interfaces.C.double); + pragma Import (C, fl_draw_rotate, "fl_draw_rotate"); + pragma Inline (fl_draw_rotate); + + procedure fl_draw_scale + (X : in Interfaces.C.double); + pragma Import (C, fl_draw_scale, "fl_draw_scale"); + pragma Inline (fl_draw_scale); + + procedure fl_draw_scale2 + (X, Y : in Interfaces.C.double); + pragma Import (C, fl_draw_scale2, "fl_draw_scale2"); + pragma Inline (fl_draw_scale2); + + function fl_draw_transform_dx + (X, Y : in Interfaces.C.double) + return Interfaces.C.double; + pragma Import (C, fl_draw_transform_dx, "fl_draw_transform_dx"); + pragma Inline (fl_draw_transform_dx); + + function fl_draw_transform_dy + (X, Y : in Interfaces.C.double) + return Interfaces.C.double; + pragma Import (C, fl_draw_transform_dy, "fl_draw_transform_dy"); + pragma Inline (fl_draw_transform_dy); + + function fl_draw_transform_x + (X, Y : in Interfaces.C.double) + return Interfaces.C.double; + pragma Import (C, fl_draw_transform_x, "fl_draw_transform_x"); + pragma Inline (fl_draw_transform_x); + + function fl_draw_transform_y + (X, Y : in Interfaces.C.double) + return Interfaces.C.double; + pragma Import (C, fl_draw_transform_y, "fl_draw_transform_y"); + pragma Inline (fl_draw_transform_y); + + procedure fl_draw_transformed_vertex + (XF, YF : in Interfaces.C.double); + pragma Import (C, fl_draw_transformed_vertex, "fl_draw_transformed_vertex"); + pragma Inline (fl_draw_transformed_vertex); + + procedure fl_draw_translate + (X, Y : in Interfaces.C.double); + pragma Import (C, fl_draw_translate, "fl_draw_translate"); + pragma Inline (fl_draw_translate); + + procedure fl_draw_vertex + (X, Y : in Interfaces.C.double); + pragma Import (C, fl_draw_vertex, "fl_draw_vertex"); + pragma Inline (fl_draw_vertex); + + + + + procedure fl_draw_draw_image + (Buf : in System.Address; + X, Y, W, H : in Interfaces.C.int; + D, L : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_image, "fl_draw_draw_image"); + pragma Inline (fl_draw_draw_image); + + procedure fl_draw_draw_image2 + (Call, User : in System.Address; + X, Y, W, H, D : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_image2, "fl_draw_draw_image2"); + pragma Inline (fl_draw_draw_image2); + + procedure fl_draw_draw_image_mono + (Buf : in System.Address; + X, Y, W, H : in Interfaces.C.int; + D, L : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_image_mono, "fl_draw_draw_image_mono"); + pragma Inline (fl_draw_draw_image_mono); + + procedure fl_draw_draw_image_mono2 + (Call, User : in System.Address; + X, Y, W, H, D : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_image_mono2, "fl_draw_draw_image_mono2"); + pragma Inline (fl_draw_draw_image_mono2); + + function fl_draw_read_image + (Buf : in System.Address; + X, Y, W, H : in Interfaces.C.int; + Alpha : in Interfaces.C.int) + return System.Address; + pragma Import (C, fl_draw_read_image, "fl_draw_read_image"); + pragma Inline (fl_draw_read_image); + + + + + function fl_draw_add_symbol + (Name : in Interfaces.C.char_array; + Drawit : in System.Address; + Scalable : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_draw_add_symbol, "fl_draw_add_symbol"); + pragma Inline (fl_draw_add_symbol); + + procedure fl_draw_draw_text + (Str : in Interfaces.C.char_array; + N, X, Y : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_text, "fl_draw_draw_text"); + pragma Inline (fl_draw_draw_text); + + procedure fl_draw_draw_text2 + (Str : in Interfaces.C.char_array; + X, Y, W, H : in Interfaces.C.int; + Ali : in Interfaces.Unsigned_16; + Img : in System.Address; + Sym : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_text2, "fl_draw_draw_text2"); + pragma Inline (fl_draw_draw_text2); + + procedure fl_draw_draw_text3 + (Str : in Interfaces.C.char_array; + X, Y, W, H : in Interfaces.C.int; + Ali : in Interfaces.Unsigned_16; + Func : in System.Address; + Img : in System.Address; + Sym : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_text3, "fl_draw_draw_text3"); + pragma Inline (fl_draw_draw_text3); + + procedure fl_draw_draw_text4 + (Ang : in Interfaces.C.int; + Str : in Interfaces.C.char_array; + N, X, Y : in Interfaces.C.int); + pragma Import (C, fl_draw_draw_text4, "fl_draw_draw_text4"); + pragma Inline (fl_draw_draw_text4); + + procedure fl_draw_rtl_draw + (Str : in Interfaces.C.char_array; + N, X, Y : in Interfaces.C.int); + pragma Import (C, fl_draw_rtl_draw, "fl_draw_rtl_draw"); + pragma Inline (fl_draw_rtl_draw); + + procedure fl_draw_draw_box + (BK : in Interfaces.C.int; + X, Y, W, H : in Interfaces.C.int; + C : in Interfaces.C.unsigned); + pragma Import (C, fl_draw_draw_box, "fl_draw_draw_box"); + pragma Inline (fl_draw_draw_box); + + function fl_draw_draw_symbol + (Lab : in Interfaces.C.char_array; + X, Y, W, H : in Interfaces.C.int; + Hue : in Interfaces.C.unsigned) + return Interfaces.C.int; + pragma Import (C, fl_draw_draw_symbol, "fl_draw_draw_symbol"); + pragma Inline (fl_draw_draw_symbol); + + procedure fl_draw_measure + (Str : in Interfaces.C.char_array; + W, H : in out Interfaces.C.int; + S : in Interfaces.C.int); + pragma Import (C, fl_draw_measure, "fl_draw_measure"); + pragma Inline (fl_draw_measure); + + procedure fl_draw_scroll + (X, Y, W, H : in Interfaces.C.int; + DX, DY : in Interfaces.C.int; + Func, Data : in System.Address); + pragma Import (C, fl_draw_scroll, "fl_draw_scroll"); + pragma Inline (fl_draw_scroll); + + procedure fl_draw_text_extents + (Str : in Interfaces.C.char_array; + N : in Interfaces.C.int; + DX, DY, W, H : out Interfaces.C.int); + pragma Import (C, fl_draw_text_extents, "fl_draw_text_extents"); + pragma Inline (fl_draw_text_extents); + + function fl_draw_width + (Str : in Interfaces.C.char_array; + N : in Interfaces.C.int) + return Interfaces.C.double; + pragma Import (C, fl_draw_width, "fl_draw_width"); + pragma Inline (fl_draw_width); + + function fl_draw_width2 + (C : in Interfaces.C.unsigned_long) + return Interfaces.C.double; + pragma Import (C, fl_draw_width2, "fl_draw_width2"); + pragma Inline (fl_draw_width2); + + + + + procedure fl_draw_begin_complex_polygon; + pragma Import (C, fl_draw_begin_complex_polygon, "fl_draw_begin_complex_polygon"); + pragma Inline (fl_draw_begin_complex_polygon); + + procedure fl_draw_begin_line; + pragma Import (C, fl_draw_begin_line, "fl_draw_begin_line"); + pragma Inline (fl_draw_begin_line); + + procedure fl_draw_begin_loop; + pragma Import (C, fl_draw_begin_loop, "fl_draw_begin_loop"); + pragma Inline (fl_draw_begin_loop); + + procedure fl_draw_begin_points; + pragma Import (C, fl_draw_begin_points, "fl_draw_begin_points"); + pragma Inline (fl_draw_begin_points); + + procedure fl_draw_begin_polygon; + pragma Import (C, fl_draw_begin_polygon, "fl_draw_begin_polygon"); + pragma Inline (fl_draw_begin_polygon); + + + + + procedure fl_draw_arc + (X, Y, R, Start, Finish : in Interfaces.C.double); + pragma Import (C, fl_draw_arc, "fl_draw_arc"); + pragma Inline (fl_draw_arc); + + procedure fl_draw_arc2 + (X, Y, W, H : in Interfaces.C.int; + A1, A2 : in Interfaces.C.double); + pragma Import (C, fl_draw_arc2, "fl_draw_arc2"); + pragma Inline (fl_draw_arc2); + + -- this function does not yet exist + -- procedure fl_draw_chord + -- (X, Y, W, H : in Interfaces.C.int; + -- A1, A2 : in Interfaces.C.double); + -- pragma Import (C, fl_draw_chord, "fl_draw_chord"); + -- pragma Inline (fl_draw_chord); + + procedure fl_draw_circle + (X, Y, R : in Interfaces.C.double); + pragma Import (C, fl_draw_circle, "fl_draw_circle"); + pragma Inline (fl_draw_circle); + + procedure fl_draw_curve + (X0, Y0 : in Interfaces.C.double; + X1, Y1 : in Interfaces.C.double; + X2, Y2 : in Interfaces.C.double; + X3, Y3 : in Interfaces.C.double); + pragma Import (C, fl_draw_curve, "fl_draw_curve"); + pragma Inline (fl_draw_curve); + + procedure fl_draw_frame + (S : in Interfaces.C.char_array; + X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_draw_frame, "fl_draw_frame"); + pragma Inline (fl_draw_frame); + + procedure fl_draw_gap; + pragma Import (C, fl_draw_gap, "fl_draw_gap"); + pragma Inline (fl_draw_gap); + + procedure fl_draw_line + (X0, Y0 : in Interfaces.C.int; + X1, Y1 : in Interfaces.C.int); + pragma Import (C, fl_draw_line, "fl_draw_line"); + pragma Inline (fl_draw_line); + + procedure fl_draw_line2 + (X0, Y0 : in Interfaces.C.int; + X1, Y1 : in Interfaces.C.int; + X2, Y2 : in Interfaces.C.int); + pragma Import (C, fl_draw_line2, "fl_draw_line2"); + pragma Inline (fl_draw_line2); + + procedure fl_draw_loop + (X0, Y0 : in Interfaces.C.int; + X1, Y1 : in Interfaces.C.int; + X2, Y2 : in Interfaces.C.int); + pragma Import (C, fl_draw_loop, "fl_draw_loop"); + pragma Inline (fl_draw_loop); + + procedure fl_draw_loop2 + (X0, Y0 : in Interfaces.C.int; + X1, Y1 : in Interfaces.C.int; + X2, Y2 : in Interfaces.C.int; + X3, Y3 : in Interfaces.C.int); + pragma Import (C, fl_draw_loop2, "fl_draw_loop2"); + pragma Inline (fl_draw_loop2); + + procedure fl_draw_pie + (X, Y, W, H : in Interfaces.C.int; + A1, A2 : in Interfaces.C.double); + pragma Import (C, fl_draw_pie, "fl_draw_pie"); + pragma Inline (fl_draw_pie); + + procedure fl_draw_point + (X, Y : in Interfaces.C.int); + pragma Import (C, fl_draw_point, "fl_draw_point"); + pragma Inline (fl_draw_point); + + procedure fl_draw_polygon + (X0, Y0 : in Interfaces.C.int; + X1, Y1 : in Interfaces.C.int; + X2, Y2 : in Interfaces.C.int); + pragma Import (C, fl_draw_polygon, "fl_draw_polygon"); + pragma Inline (fl_draw_polygon); + + procedure fl_draw_polygon2 + (X0, Y0 : in Interfaces.C.int; + X1, Y1 : in Interfaces.C.int; + X2, Y2 : in Interfaces.C.int; + X3, Y3 : in Interfaces.C.int); + pragma Import (C, fl_draw_polygon2, "fl_draw_polygon2"); + pragma Inline (fl_draw_polygon2); + + procedure fl_draw_rect + (X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_draw_rect, "fl_draw_rect"); + pragma Inline (fl_draw_rect); + + procedure fl_draw_rect2 + (X, Y, W, H : in Interfaces.C.int; + C : in Interfaces.C.unsigned); + pragma Import (C, fl_draw_rect2, "fl_draw_rect2"); + pragma Inline (fl_draw_rect2); + + procedure fl_draw_rect_fill + (X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_draw_rect_fill, "fl_draw_rect_fill"); + pragma Inline (fl_draw_rect_fill); + + procedure fl_draw_rect_fill2 + (X, Y, W, H : in Interfaces.C.int; + C : in Interfaces.C.unsigned); + pragma Import (C, fl_draw_rect_fill2, "fl_draw_rect_fill2"); + pragma Inline (fl_draw_rect_fill2); + + procedure fl_draw_rect_fill3 + (X, Y, W, H : in Interfaces.C.int; + R, G, B : in Interfaces.C.unsigned_char); + pragma Import (C, fl_draw_rect_fill3, "fl_draw_rect_fill3"); + pragma Inline (fl_draw_rect_fill3); + + procedure fl_draw_xy_line + (X0, Y0, X1 : in Interfaces.C.int); + pragma Import (C, fl_draw_xy_line, "fl_draw_xy_line"); + pragma Inline (fl_draw_xy_line); + + procedure fl_draw_xy_line2 + (X0, Y0, X1, Y2 : in Interfaces.C.int); + pragma Import (C, fl_draw_xy_line2, "fl_draw_xy_line2"); + pragma Inline (fl_draw_xy_line2); + + procedure fl_draw_xy_line3 + (X0, Y0, X1, Y2, X3 : in Interfaces.C.int); + pragma Import (C, fl_draw_xy_line3, "fl_draw_xy_line3"); + pragma Inline (fl_draw_xy_line3); + + procedure fl_draw_yx_line + (X0, Y0, Y1 : in Interfaces.C.int); + pragma Import (C, fl_draw_yx_line, "fl_draw_yx_line"); + pragma Inline (fl_draw_yx_line); + + procedure fl_draw_yx_line2 + (X0, Y0, Y1, X2 : in Interfaces.C.int); + pragma Import (C, fl_draw_yx_line2, "fl_draw_yx_line2"); + pragma Inline (fl_draw_yx_line2); + + procedure fl_draw_yx_line3 + (X0, Y0, Y1, X2, Y3 : in Interfaces.C.int); + pragma Import (C, fl_draw_yx_line3, "fl_draw_yx_line3"); + pragma Inline (fl_draw_yx_line3); + + + + + procedure fl_draw_end_complex_polygon; + pragma Import (C, fl_draw_end_complex_polygon, "fl_draw_end_complex_polygon"); + pragma Inline (fl_draw_end_complex_polygon); + + procedure fl_draw_end_line; + pragma Import (C, fl_draw_end_line, "fl_draw_end_line"); + pragma Inline (fl_draw_end_line); + + procedure fl_draw_end_loop; + pragma Import (C, fl_draw_end_loop, "fl_draw_end_loop"); + pragma Inline (fl_draw_end_loop); + + procedure fl_draw_end_points; + pragma Import (C, fl_draw_end_points, "fl_draw_end_points"); + pragma Inline (fl_draw_end_points); + + procedure fl_draw_end_polygon; + pragma Import (C, fl_draw_end_polygon, "fl_draw_end_polygon"); + pragma Inline (fl_draw_end_polygon); + + + + + ------------------------ + -- No Documentation -- + ------------------------ + + procedure Reset_Spot is + begin + fl_draw_reset_spot; + end Reset_Spot; + + + procedure Set_Spot + (X, Y, W, H : in Integer; + Font : in Font_Kind; + Size : in Font_Size) is + begin + fl_draw_set_spot + (Font_Kind'Pos (Font), + Interfaces.C.int (Size), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + System.Null_Address); + end Set_Spot; + + + procedure Set_Spot + (X, Y, W, H : in Integer; + Font : in Font_Kind; + Size : in Font_Size; + Pane : in FLTK.Widgets.Groups.Windows.Window'Class) is + begin + fl_draw_set_spot + (Font_Kind'Pos (Font), + Interfaces.C.int (Size), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Wrapper (Pane).Void_Ptr); + end Set_Spot; + + + procedure Set_Status + (X, Y, W, H : in Integer) is + begin + fl_draw_set_status + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Set_Status; + + + + + --------------- + -- Utility -- + --------------- + + function Can_Do_Alpha_Blending + return Boolean + is + Result : Interfaces.C.int := fl_draw_can_do_alpha_blending; + begin + if Result = 1 then + return True; + elsif Result = 0 then + return False; + else + raise Program_Error; + end if; + end Can_Do_Alpha_Blending; + + + function Shortcut_Label + (Keys : in Key_Combo) + return String is + begin + return Interfaces.C.Strings.Value + (fl_draw_shortcut_label (To_C (Keys))); + end Shortcut_Label; + + + + + -------------------------- + -- Charset Conversion -- + -------------------------- + + function Latin1_To_Local + (From : in String) + return String is + begin + return Interfaces.C.Strings.Value + (fl_draw_latin1_to_local (Interfaces.C.To_C (From), -1)); + end Latin1_To_Local; + + + function Local_To_Latin1 + (From : in String) + return String is + begin + return Interfaces.C.Strings.Value + (fl_draw_local_to_latin1 (Interfaces.C.To_C (From), -1)); + end Local_To_Latin1; + + + function Mac_Roman_To_Local + (From : in String) + return String is + begin + return Interfaces.C.Strings.Value + (fl_draw_mac_roman_to_local (Interfaces.C.To_C (From), -1)); + end Mac_Roman_To_Local; + + + function Local_To_Mac_Roman + (From : in String) + return String is + begin + return Interfaces.C.Strings.Value + (fl_draw_local_to_mac_roman (Interfaces.C.To_C (From), -1)); + end Local_To_Mac_Roman; + + + + + ---------------- + -- Clipping -- + ---------------- + + function Clip_Box + (X, Y, W, H : in Integer; + BX, BY, BW, BH : out Integer) + return Boolean + is + CX, CY, CW, CH : Interfaces.C.int; + Result : Interfaces.C.int := fl_draw_clip_box + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + CX, CY, CW, CH); + begin + BX := Integer (CX); + BY := Integer (CY); + BW := Integer (CW); + BH := Integer (CH); + return Result /= 0; + end Clip_Box; + + + function Clip_Intersects + (X, Y, W, H : in Integer) + return Boolean is + begin + return fl_draw_not_clipped + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)) /= 0; + end Clip_Intersects; + + + procedure Pop_Clip is + begin + fl_draw_pop_clip; + end Pop_Clip; + + + procedure Push_Clip + (X, Y, W, H : in Integer) is + begin + fl_draw_push_clip + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Push_Clip; + + + procedure Push_No_Clip is + begin + fl_draw_push_no_clip; + end Push_No_Clip; + + + procedure Restore_Clip is + begin + fl_draw_restore_clip; + end Restore_Clip; + + + + + --------------- + -- Overlay -- + --------------- + + procedure Overlay_Clear is + begin + fl_draw_overlay_clear; + end Overlay_Clear; + + + procedure Overlay_Rect + (X, Y, W, H : in Integer) is + begin + fl_draw_overlay_rect + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Overlay_Rect; + + + + + ---------------- + -- Settings -- + ---------------- + + function Get_Color + return Color is + begin + return Color (fl_draw_get_color); + end Get_Color; + + + procedure Set_Color + (To : in Color) is + begin + fl_draw_set_color (Interfaces.C.unsigned (To)); + end Set_Color; + + + procedure Set_Color + (R, G, B : in Color_Component) is + begin + fl_draw_set_color2 + (Interfaces.C.unsigned_char (R), + Interfaces.C.unsigned_char (G), + Interfaces.C.unsigned_char (B)); + end Set_Color; + + + procedure Set_Cursor + (To : in Mouse_Cursor_Kind) is + begin + fl_draw_set_cursor (Cursor_Values (To)); + end Set_Cursor; + + procedure Set_Cursor + (To : in Mouse_Cursor_Kind; + Fore : in Color; + Back : in Color := White_Color) is + begin + fl_draw_set_cursor2 + (Cursor_Values (To), + Interfaces.C.unsigned (Fore), + Interfaces.C.unsigned (Back)); + end Set_Cursor; + + + function Get_Font + return Font_Kind is + begin + return Font_Kind'Val (fl_draw_get_font); + end Get_Font; + + + function Get_Font_Size + return Font_Size is + begin + return Font_Size (fl_draw_size); + end Get_Font_Size; + + + procedure Set_Font + (Kind : in Font_Kind; + Size : in Font_Size) is + begin + fl_draw_set_font (Font_Kind'Pos (Kind), Interfaces.C.int (Size)); + end Set_Font; + + + function Font_Line_Spacing + return Integer is + begin + return Integer (fl_draw_height); + end Font_Line_Spacing; + + + function Font_Descent + return Integer is + begin + return Integer (fl_draw_descent); + end Font_Descent; + + + function Font_Height + (Kind : in Font_Kind; + Size : in Font_Size) + return Natural is + begin + return Natural (fl_draw_height2 (Font_Kind'Pos (Kind), Interfaces.C.int (Size))); + end Font_Height; + + + type Char_Array_Access is access Interfaces.C.char_array; + + procedure Free_Char_Array is new Ada.Unchecked_Deallocation + (Object => Interfaces.C.char_array, + Name => Char_Array_Access); + + Current_Dashes : Char_Array_Access; + + procedure Set_Line_Style + (Line : in Line_Kind := Solid_Line; + Cap : in Cap_Kind := Default_Cap; + Join : in Join_Kind := Default_Join; + Width : in Natural := 0; + Dashes : in Dash_Gap_Array := Empty_Dashes) is + begin + Free_Char_Array (Current_Dashes); + Current_Dashes := new Interfaces.C.char_array (1 .. (Dashes'Length + 1) * 2); + for Index in Integer range 1 .. Dashes'Length loop + Current_Dashes (2 * Interfaces.C.size_t (Index) - 1) := + Interfaces.C.char'Val (Integer (Dashes (Index).Solid)); + Current_Dashes (2 * Interfaces.C.size_t (Index)) := + Interfaces.C.char'Val (Integer (Dashes (Index).Blank)); + end loop; + Current_Dashes (Current_Dashes'Last - 1) := Interfaces.C.char'Val (0); + Current_Dashes (Current_Dashes'Last) := Interfaces.C.char'Val (0); + fl_draw_line_style + (Line_Kind'Pos (Line) + Cap_Kind'Pos (Cap) * 16#100# + Join_Kind'Pos (Join) * 16#1000#, + Interfaces.C.int (Width), + Current_Dashes.all); + end Set_Line_Style; + + + + + ------------------------- + -- Matrix Operations -- + ------------------------- + + procedure Mult_Matrix + (A, B, C, D, X, Y : in Long_Float) is + begin + fl_draw_mult_matrix + (Interfaces.C.double (A), + Interfaces.C.double (B), + Interfaces.C.double (C), + Interfaces.C.double (D), + Interfaces.C.double (X), + Interfaces.C.double (Y)); + end Mult_Matrix; + + + procedure Pop_Matrix is + begin + fl_draw_pop_matrix; + end Pop_Matrix; + + + procedure Push_Matrix is + begin + fl_draw_push_matrix; + end Push_Matrix; + + + procedure Rotate + (Angle : in Long_Float) is + begin + fl_draw_rotate (Interfaces.C.double (Angle)); + end Rotate; + + + procedure Scale + (Factor : in Long_Float) is + begin + fl_draw_scale (Interfaces.C.double (Factor)); + end Scale; + + + procedure Scale + (Factor_X, Factor_Y : in Long_Float) is + begin + fl_draw_scale2 + (Interfaces.C.double (Factor_X), + Interfaces.C.double (Factor_Y)); + end Scale; + + + function Transform_DX + (X, Y : in Long_Float) + return Long_Float is + begin + return Long_Float (fl_draw_transform_dx + (Interfaces.C.double (X), + Interfaces.C.double (Y))); + end Transform_DX; + + + function Transform_DY + (X, Y : in Long_Float) + return Long_Float is + begin + return Long_Float (fl_draw_transform_dy + (Interfaces.C.double (X), + Interfaces.C.double (Y))); + end Transform_DY; + + + function Transform_X + (X, Y : in Long_Float) + return Long_Float is + begin + return Long_Float (fl_draw_transform_x + (Interfaces.C.double (X), + Interfaces.C.double (Y))); + end Transform_X; + + + function Transform_Y + (X, Y : in Long_Float) + return Long_Float is + begin + return Long_Float (fl_draw_transform_y + (Interfaces.C.double (X), + Interfaces.C.double (Y))); + end Transform_Y; + + + procedure Transformed_Vertex + (XF, YF : in Long_Float) is + begin + fl_draw_transformed_vertex + (Interfaces.C.double (XF), + Interfaces.C.double (YF)); + end Transformed_Vertex; + + + procedure Translate + (X, Y : in Long_Float) is + begin + fl_draw_translate + (Interfaces.C.double (X), + Interfaces.C.double (Y)); + end Translate; + + + procedure Vertex + (X, Y : in Long_Float) is + begin + fl_draw_vertex + (Interfaces.C.double (X), + Interfaces.C.double (Y)); + end Vertex; + + + + + --------------------- + -- Image Drawing -- + --------------------- + + procedure Draw_Image + (X, Y, W, H : in Integer; + Data : in Color_Component_Array; + Depth : in Positive := 3; + Line_Data : in Natural := 0; + Flip_Horizontal : in Boolean := False; + Flip_Vertical : in Boolean := False) + is + Real_Depth : Integer := Depth; + Real_Line_Data : Integer := Line_Data; + begin + if Flip_Horizontal then + Real_Depth := Real_Depth * (-1); + end if; + if Flip_Vertical then + if Real_Line_Data = 0 then + Real_Line_Data := W * Depth * (-1); + else + Real_Line_Data := Real_Line_Data * (-1); + end if; + end if; + fl_draw_draw_image + (Data (Data'First)'Address, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Real_Depth), + Interfaces.C.int (Real_Line_Data)); + end Draw_Image; + + + Image_Func_Ptr : Image_Draw_Function; + + procedure Draw_Image_Hook + (User : in System.Address; + X, Y, W : in Interfaces.C.int; + Buf_Ptr : in System.Address) + is + Data_Buffer : Color_Component_Array (1 .. Integer (W)); + for Data_Buffer'Address use Buf_Ptr; + pragma Import (Ada, Data_Buffer); + begin + Image_Func_Ptr (Integer (X), Integer (Y), Data_Buffer); + end Draw_Image_Hook; + + procedure Draw_Image + (X, Y, W, H : in Integer; + Callback : in Image_Draw_Function; + Depth : in Positive := 3) is + begin + Image_Func_Ptr := Callback; + fl_draw_draw_image2 + (Draw_Image_Hook'Address, + System.Null_Address, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Depth)); + end Draw_Image; + + + procedure Draw_Image_Mono + (X, Y, W, H : in Integer; + Data : in Color_Component_Array; + Depth : in Positive := 1; + Line_Data : in Natural := 0; + Flip_Horizontal : Boolean := False; + Flip_Vertical : Boolean := False) + is + Real_Depth : Integer := Depth; + Real_Line_Data : Integer := Line_Data; + begin + if Flip_Horizontal then + Real_Depth := Real_Depth * (-1); + end if; + if Flip_Vertical then + if Real_Line_Data = 0 then + Real_Line_Data := W * Depth * (-1); + else + Real_Line_Data := Real_Line_Data * (-1); + end if; + end if; + fl_draw_draw_image_mono + (Data (Data'First)'Address, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Real_Depth), + Interfaces.C.int (Real_Line_Data)); + end Draw_Image_Mono; + + + Mono_Image_Func_Ptr : Image_Draw_Function; + + procedure Draw_Image_Mono_Hook + (User : in System.Address; + X, Y, W : in Interfaces.C.int; + Buf_Ptr : in System.Address) + is + Data_Buffer : Color_Component_Array (1 .. Integer (W)); + for Data_Buffer'Address use Buf_Ptr; + pragma Import (Ada, Data_Buffer); + begin + Mono_Image_Func_Ptr (Integer (X), Integer (Y), Data_Buffer); + end Draw_Image_Mono_Hook; + + procedure Draw_Image_Mono + (X, Y, W, H : in Integer; + Callback : in Image_Draw_Function; + Depth : in Positive := 1) is + begin + Mono_Image_Func_Ptr := Callback; + fl_draw_draw_image_mono2 + (Draw_Image_Mono_Hook'Address, + System.Null_Address, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Depth)); + end Draw_Image_Mono; + + + function Read_Image + (X, Y, W, H : in Integer; + Alpha : in Integer := 0) + return Color_Component_Array + is + My_Len : Integer := (if Alpha = 0 then W * H * 3 else W * H * 4); + Result : Color_Component_Array (1 .. My_Len); + Buffer : System.Address; + begin + Buffer := fl_draw_read_image + (Result (Result'First)'Address, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Alpha)); + if Buffer /= Result (Result'First)'Address then + raise Program_Error; + end if; + return Result; + end Read_Image; + + + + + ----------------------- + -- Special Drawing -- + ----------------------- + + procedure Add_Symbol + (Text : in String; + Callback : in Symbol_Draw_Function; + Scalable : in Boolean) + is + Ret_Val : Interfaces.C.int := fl_draw_add_symbol + (Interfaces.C.To_C (Text), + Callback.all'Address, + Boolean'Pos (Scalable)); + begin + if Ret_Val = 0 then + raise Draw_Error; + elsif Ret_Val /= 1 then + raise Program_Error; + end if; + end Add_Symbol; + + procedure Draw_Text + (X, Y : in Integer; + Text : in String) is + begin + fl_draw_draw_text + (Interfaces.C.To_C (Text), + Text'Length, + Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Draw_Text; + + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Symbols : in Boolean := True) is + begin + fl_draw_draw_text2 + (Interfaces.C.To_C (Text), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.Unsigned_16 (Align), + System.Null_Address, + Boolean'Pos (Symbols)); + end Draw_Text; + + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Picture : in FLTK.Images.Image'Class; + Symbols : in Boolean := True) is + begin + fl_draw_draw_text2 + (Interfaces.C.To_C (Text), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.Unsigned_16 (Align), + Wrapper (Picture).Void_Ptr, + Boolean'Pos (Symbols)); + end Draw_Text; + + + Text_Func_Ptr : Text_Draw_Function; + + procedure Draw_Text_Hook + (Ptr : in System.Address; + N, X0, Y0 : in Interfaces.C.int) + is + Data : String (1 .. Integer (N)); + for Data'Address use Ptr; + pragma Import (Ada, Data); + begin + Text_Func_Ptr (Integer (X0), Integer (Y0), Data); + end Draw_Text_Hook; + + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Callback : in Text_Draw_Function; + Symbols : in Boolean := True) is + begin + Text_Func_Ptr := Callback; + fl_draw_draw_text3 + (Interfaces.C.To_C (Text), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.Unsigned_16 (Align), + Draw_Text_Hook'Address, + System.Null_Address, + Boolean'Pos (Symbols)); + end Draw_Text; + + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Callback : in Text_Draw_Function; + Picture : in FLTK.Images.Image'Class; + Symbols : in Boolean := True) is + begin + Text_Func_Ptr := Callback; + fl_draw_draw_text3 + (Interfaces.C.To_C (Text), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.Unsigned_16 (Align), + Draw_Text_Hook'Address, + Wrapper (Picture).Void_Ptr, + Boolean'Pos (Symbols)); + end Draw_Text; + + + procedure Draw_Text + (X, Y : in Integer; + Text : in String; + Angle : in Integer) is + begin + fl_draw_draw_text4 + (Interfaces.C.int (Angle), + Interfaces.C.To_C (Text), + Text'Length, + Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Draw_Text; + + + procedure Draw_Text_Right_Left + (X, Y : in Integer; + Text : in String) is + begin + fl_draw_rtl_draw + (Interfaces.C.To_C (Text), + Text'Length, + Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Draw_Text_Right_Left; + + + procedure Draw_Box + (X, Y, W, H : in Integer; + Kind : in Box_Kind; + Hue : in Color) is + begin + fl_draw_draw_box + (Box_Kind'Pos (Kind), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.unsigned (Hue)); + end Draw_Box; + + + procedure Draw_Symbol + (X, Y, W, H : in Integer; + Name : in String; + Hue : in Color) + is + Ret_Val : Interfaces.C.int := fl_draw_draw_symbol + (Interfaces.C.To_C (Name), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.unsigned (Hue)); + begin + if Ret_Val = 0 then + raise Draw_Error; + elsif Ret_Val /= 1 then + raise Program_Error; + end if; + end Draw_Symbol; + + + procedure Measure + (Text : in String; + W, H : out Natural; + Symbols : in Boolean := True; + Wrap : in Natural := 0) + is + Result_W : Interfaces.C.int := Interfaces.C.int (Wrap); + Result_H : Interfaces.C.int := 0; + begin + fl_draw_measure + (Interfaces.C.To_C (Text), + Result_W, Result_H, + Boolean'Pos (Symbols)); + W := Natural (Result_W); + H := Natural (Result_H); + end Measure; + + + procedure Scroll_Hook + (Ptr : in Area_Draw_Function; + X, Y, W, H : in Interfaces.C.int) is + begin + Ptr.all (Integer (X), Integer (Y), Integer (W), Integer (H)); + end Scroll_Hook; + + + procedure Scroll + (X, Y, W, H : in Integer; + DX, DY : in Integer; + Callback : in Area_Draw_Function) is + begin + fl_draw_scroll + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (DX), + Interfaces.C.int (DY), + Scroll_Hook'Address, + Callback.all'Address); + end Scroll; + + + procedure Text_Extents + (Text : in String; + DX, DY, W, H : out Integer) + is + Result_DX, Result_DY, Result_W, Result_H : Interfaces.C.int; + begin + fl_draw_text_extents + (Interfaces.C.To_C (Text), + Text'Length, + Result_DX, + Result_DY, + Result_W, + Result_H); + DX := Integer (Result_DX); + DY := Integer (Result_DY); + W := Integer (Result_W); + H := Integer (Result_H); + end Text_Extents; + + + function Width + (Text : in String) + return Long_Float is + begin + return Long_Float (fl_draw_width (Interfaces.C.To_C (Text), Text'Length)); + end Width; + + + function Width + (Glyph : in Character) + return Long_Float is + begin + return Long_Float (fl_draw_width2 (Character'Pos (Glyph))); + end Width; + + + function Width + (Glyph : in Wide_Character) + return Long_Float is + begin + return Long_Float (fl_draw_width2 (Wide_Character'Pos (Glyph))); + end Width; + + + function Width + (Glyph : in Wide_Wide_Character) + return Long_Float is + begin + return Long_Float (fl_draw_width2 (Wide_Wide_Character'Pos (Glyph))); + end Width; + + + + + ---------------------- + -- Manual Drawing -- + ---------------------- + + procedure Begin_Complex_Polygon is + begin + fl_draw_begin_complex_polygon; + end Begin_Complex_Polygon; + + procedure Begin_Line is + begin + fl_draw_begin_line; + end Begin_Line; + + procedure Begin_Loop is + begin + fl_draw_begin_loop; + end Begin_Loop; + + procedure Begin_Points is + begin + fl_draw_begin_points; + end Begin_Points; + + procedure Begin_Polygon is + begin + fl_draw_begin_polygon; + end Begin_Polygon; + + + procedure Arc + (X, Y, R, Start, Finish : in Long_Float) is + begin + fl_draw_arc + (Interfaces.C.double (X), + Interfaces.C.double (Y), + Interfaces.C.double (R), + Interfaces.C.double (Start), + Interfaces.C.double (Finish)); + end Arc; + + + procedure Arc + (X, Y, W, H : in Integer; + Start, Finish : in Long_Float) is + begin + fl_draw_arc2 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.double (Start), + Interfaces.C.double (Finish)); + end Arc; + + + procedure Chord + (X, Y, W, H : in Integer; + Angle1, Angle2 : in Long_Float) is + begin + null; + -- this function does not yet exist + -- fl_draw_chord + -- (Interfaces.C.int (X), + -- Interfaces.C.int (Y), + -- Interfaces.C.int (W), + -- Interfaces.C.int (H), + -- Interfaces.C.double (Angle1), + -- Interfaces.C.double (Angle2)); + end Chord; + + + procedure Circle + (X, Y, R : in Long_Float) is + begin + fl_draw_circle + (Interfaces.C.double (X), + Interfaces.C.double (Y), + Interfaces.C.double (R)); + end Circle; + + + procedure Curve + (X0, Y0 : in Long_Float; + X1, Y1 : in Long_Float; + X2, Y2 : in Long_Float; + X3, Y3 : in Long_Float) is + begin + fl_draw_curve + (Interfaces.C.double (X0), Interfaces.C.double (Y0), + Interfaces.C.double (X1), Interfaces.C.double (Y1), + Interfaces.C.double (X2), Interfaces.C.double (Y2), + Interfaces.C.double (X3), Interfaces.C.double (Y3)); + end Curve; + + + procedure Frame + (X, Y, W, H : in Integer; + Top, Left, Bottom, Right : in Greyscale) is + begin + fl_draw_frame + (Interfaces.C.To_C + (Character (Top) & Character (Left) & Character (Bottom) & Character (Right)), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Frame; + + + procedure Gap is + begin + fl_draw_gap; + end Gap; + + + procedure Line + (X0, Y0 : in Integer; + X1, Y1 : in Integer) is + begin + fl_draw_line + (Interfaces.C.int (X0), Interfaces.C.int (Y0), + Interfaces.C.int (X1), Interfaces.C.int (Y1)); + end Line; + + + procedure Line + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer) is + begin + fl_draw_line2 + (Interfaces.C.int (X0), Interfaces.C.int (Y0), + Interfaces.C.int (X1), Interfaces.C.int (Y1), + Interfaces.C.int (X2), Interfaces.C.int (Y2)); + end Line; + + + procedure Outline + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer) is + begin + fl_draw_loop + (Interfaces.C.int (X0), Interfaces.C.int (Y0), + Interfaces.C.int (X1), Interfaces.C.int (Y1), + Interfaces.C.int (X2), Interfaces.C.int (Y2)); + end Outline; + + + procedure Outline + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer; + X3, Y3 : in Integer) is + begin + fl_draw_loop2 + (Interfaces.C.int (X0), Interfaces.C.int (Y0), + Interfaces.C.int (X1), Interfaces.C.int (Y1), + Interfaces.C.int (X2), Interfaces.C.int (Y2), + Interfaces.C.int (X3), Interfaces.C.int (Y3)); + end Outline; + + + procedure Pie + (X, Y, W, H : in Integer; + Angle1, Angle2 : in Long_Float) is + begin + fl_draw_pie + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.double (Angle1), + Interfaces.C.double (Angle2)); + end Pie; + + + procedure Point + (X, Y : in Integer) is + begin + fl_draw_point + (Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Point; + + + procedure Polygon + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer) is + begin + fl_draw_polygon + (Interfaces.C.int (X0), Interfaces.C.int (Y0), + Interfaces.C.int (X1), Interfaces.C.int (Y1), + Interfaces.C.int (X2), Interfaces.C.int (Y2)); + end Polygon; + + + procedure Polygon + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer; + X3, Y3 : in Integer) is + begin + fl_draw_polygon2 + (Interfaces.C.int (X0), Interfaces.C.int (Y0), + Interfaces.C.int (X1), Interfaces.C.int (Y1), + Interfaces.C.int (X2), Interfaces.C.int (Y2), + Interfaces.C.int (X3), Interfaces.C.int (Y3)); + end Polygon; + + + procedure Rect + (X, Y, W, H : in Integer) is + begin + fl_draw_rect + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Rect; + + + procedure Rect + (X, Y, W, H : in Integer; + Hue : in Color) is + begin + fl_draw_rect2 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.unsigned (Hue)); + end Rect; + + + procedure Rect_Fill + (X, Y, W, H : in Integer) is + begin + fl_draw_rect_fill + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Rect_Fill; + + + procedure Rect_Fill + (X, Y, W, H : in Integer; + Hue : in Color) is + begin + fl_draw_rect_fill2 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.unsigned (Hue)); + end Rect_Fill; + + + procedure Rect_Fill + (X, Y, W, H : in Integer; + R, G, B : in Color_Component) is + begin + fl_draw_rect_fill3 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.unsigned_char (R), + Interfaces.C.unsigned_char (G), + Interfaces.C.unsigned_char (B)); + end Rect_Fill; + + + procedure Ecks_Why_Line + (X0, Y0, X1 : in Integer) is + begin + fl_draw_xy_line + (Interfaces.C.int (X0), + Interfaces.C.int (Y0), + Interfaces.C.int (X1)); + end Ecks_Why_Line; + + + procedure Ecks_Why_Line + (X0, Y0, X1, Y2 : in Integer) is + begin + fl_draw_xy_line2 + (Interfaces.C.int (X0), + Interfaces.C.int (Y0), + Interfaces.C.int (X1), + Interfaces.C.int (Y2)); + end Ecks_Why_Line; + + + procedure Ecks_Why_Line + (X0, Y0, X1, Y2, X3 : in Integer) is + begin + fl_draw_xy_line3 + (Interfaces.C.int (X0), + Interfaces.C.int (Y0), + Interfaces.C.int (X1), + Interfaces.C.int (Y2), + Interfaces.C.int (X3)); + end Ecks_Why_Line; + + + procedure Why_Ecks_Line + (X0, Y0, Y1 : in Integer) is + begin + fl_draw_yx_line + (Interfaces.C.int (X0), + Interfaces.C.int (Y0), + Interfaces.C.int (Y1)); + end Why_Ecks_Line; + + + procedure Why_Ecks_Line + (X0, Y0, Y1, X2 : in Integer) is + begin + fl_draw_yx_line2 + (Interfaces.C.int (X0), + Interfaces.C.int (Y0), + Interfaces.C.int (Y1), + Interfaces.C.int (X2)); + end Why_Ecks_Line; + + + procedure Why_Ecks_Line + (X0, Y0, Y1, X2, Y3 : in Integer) is + begin + fl_draw_yx_line3 + (Interfaces.C.int (X0), + Interfaces.C.int (Y0), + Interfaces.C.int (Y1), + Interfaces.C.int (X2), + Interfaces.C.int (Y3)); + end Why_Ecks_Line; + + + procedure End_Complex_Polygon is + begin + fl_draw_end_complex_polygon; + end End_Complex_Polygon; + + procedure End_Line is + begin + fl_draw_end_line; + end End_Line; + + procedure End_Loop is + begin + fl_draw_end_loop; + end End_Loop; + + procedure End_Points is + begin + fl_draw_end_points; + end End_Points; + + procedure End_Polygon is + begin + fl_draw_end_polygon; + end End_Polygon; + + +end FLTK.Draw; + + diff --git a/src/fltk-draw.ads b/src/fltk-draw.ads new file mode 100644 index 0000000..b4e14ee --- /dev/null +++ b/src/fltk-draw.ads @@ -0,0 +1,617 @@ + + +with + + FLTK.Images, + FLTK.Widgets.Groups.Windows; + + +package FLTK.Draw is + + + -------------------------- + -- Types and Constants -- + -------------------------- + + type Line_Kind is + (Solid_Line, + Dash_Line, + Dot_Line, + Dashdot_Line, + Dashdotdot_Line); + + type Cap_Kind is + (Default_Cap, + Flat_Cap, + Round_Cap, + Square_Cap); + + type Join_Kind is + (Default_Join, + Miter_Join, + Round_Join, + Bevel_Join); + + type Dash_Length is new Integer range 1 .. 255; + + type Dash_Gap is record + Solid : Dash_Length; + Blank : Dash_Length; + end record; + + type Dash_Gap_Array is array (Positive range <>) of Dash_Gap; + + Empty_Dashes : constant Dash_Gap_Array (1 .. 0) := (others => (1, 1)); + + type Image_Draw_Function is access procedure + (X, Y : in Natural; + Data : out Color_Component_Array); + + type Symbol_Draw_Function is access procedure + (Hue : in Color); + + type Text_Draw_Function is access procedure + (X, Y : in Integer; + Text : in String); + + type Area_Draw_Function is access procedure + (X, Y, W, H : in Integer); + + Draw_Error : exception; + + + + + ------------------------ + -- No Documentation -- + ------------------------ + + procedure Reset_Spot; + + procedure Set_Spot + (X, Y, W, H : in Integer; + Font : in Font_Kind; + Size : in Font_Size); + + procedure Set_Spot + (X, Y, W, H : in Integer; + Font : in Font_Kind; + Size : in Font_Size; + Pane : in FLTK.Widgets.Groups.Windows.Window'Class); + + procedure Set_Status + (X, Y, W, H : in Integer); + + + + + --------------- + -- Utility -- + --------------- + + function Can_Do_Alpha_Blending + return Boolean; + + function Shortcut_Label + (Keys : in Key_Combo) + return String; + + + + + -------------------------- + -- Charset Conversion -- + -------------------------- + + function Latin1_To_Local + (From : in String) + return String; + + function Local_To_Latin1 + (From : in String) + return String; + + function Mac_Roman_To_Local + (From : in String) + return String; + + function Local_To_Mac_Roman + (From : in String) + return String; + + + + + ---------------- + -- Clipping -- + ---------------- + + function Clip_Box + (X, Y, W, H : in Integer; + BX, BY, BW, BH : out Integer) + return Boolean; + + function Clip_Intersects + (X, Y, W, H : in Integer) + return Boolean; + + procedure Pop_Clip; + + procedure Push_Clip + (X, Y, W, H : in Integer); + + procedure Push_No_Clip; + + procedure Restore_Clip; + + + + + --------------- + -- Overlay -- + --------------- + + procedure Overlay_Clear; + + procedure Overlay_Rect + (X, Y, W, H : in Integer); + + + + + ---------------- + -- Settings -- + ---------------- + + function Get_Color + return Color; + + procedure Set_Color + (To : in Color); + + procedure Set_Color + (R, G, B : in Color_Component); + + procedure Set_Cursor + (To : in Mouse_Cursor_Kind); + + procedure Set_Cursor + (To : in Mouse_Cursor_Kind; + Fore : in Color; + Back : in Color := White_Color); + + function Get_Font + return Font_Kind; + + function Get_Font_Size + return Font_Size; + + procedure Set_Font + (Kind : in Font_Kind; + Size : in Font_Size); + + function Font_Line_Spacing + return Integer; + + function Font_Descent + return Integer; + + function Font_Height + (Kind : in Font_Kind; + Size : in Font_Size) + return Natural; + + procedure Set_Line_Style + (Line : in Line_Kind := Solid_Line; + Cap : in Cap_Kind := Default_Cap; + Join : in Join_Kind := Default_Join; + Width : in Natural := 0; + Dashes : in Dash_Gap_Array := Empty_Dashes); + + + + + ------------------------- + -- Matrix Operations -- + ------------------------- + + procedure Mult_Matrix + (A, B, C, D, X, Y : in Long_Float); + + procedure Pop_Matrix; + + procedure Push_Matrix; + + procedure Rotate + (Angle : in Long_Float); + + procedure Scale + (Factor : in Long_Float); + + procedure Scale + (Factor_X, Factor_Y : in Long_Float); + + function Transform_DX + (X, Y : in Long_Float) + return Long_Float; + + function Transform_DY + (X, Y : in Long_Float) + return Long_Float; + + function Transform_X + (X, Y : in Long_Float) + return Long_Float; + + function Transform_Y + (X, Y : in Long_Float) + return Long_Float; + + procedure Transformed_Vertex + (XF, YF : in Long_Float); + + procedure Translate + (X, Y : in Long_Float); + + procedure Vertex + (X, Y : in Long_Float); + + + + + --------------------- + -- Image Drawing -- + --------------------- + + procedure Draw_Image + (X, Y, W, H : in Integer; + Data : in Color_Component_Array; + Depth : in Positive := 3; + Line_Data : in Natural := 0; + Flip_Horizontal : in Boolean := False; + Flip_Vertical : in Boolean := False); + + procedure Draw_Image + (X, Y, W, H : in Integer; + Callback : in Image_Draw_Function; + Depth : in Positive := 3); + + procedure Draw_Image_Mono + (X, Y, W, H : in Integer; + Data : in Color_Component_Array; + Depth : in Positive := 1; + Line_Data : in Natural := 0; + Flip_Horizontal : Boolean := False; + Flip_Vertical : Boolean := False); + + procedure Draw_Image_Mono + (X, Y, W, H : in Integer; + Callback : in Image_Draw_Function; + Depth : in Positive := 1); + + function Read_Image + (X, Y, W, H : in Integer; + Alpha : in Integer := 0) + return Color_Component_Array + with Post => + (if Alpha = 0 + then Read_Image'Result'Length = W * H * 3 + else Read_Image'Result'Length = W * H * 4); + + + + + ----------------------- + -- Special Drawing -- + ----------------------- + + procedure Add_Symbol + (Text : in String; + Callback : in Symbol_Draw_Function; + Scalable : in Boolean); + + procedure Draw_Text + (X, Y : in Integer; + Text : in String) + with Pre => Text'Length > 0; + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Symbols : in Boolean := True); + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Picture : in FLTK.Images.Image'Class; + Symbols : in Boolean := True); + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Callback : in Text_Draw_Function; + Symbols : in Boolean := True); + + procedure Draw_Text + (X, Y, W, H : in Integer; + Text : in String; + Align : in Alignment; + Callback : in Text_Draw_Function; + Picture : in FLTK.Images.Image'Class; + Symbols : in Boolean := True); + + procedure Draw_Text + (X, Y : in Integer; + Text : in String; + Angle : in Integer); + + procedure Draw_Text_Right_Left + (X, Y : in Integer; + Text : in String); + + procedure Draw_Box + (X, Y, W, H : in Integer; + Kind : in Box_Kind; + Hue : in Color); + + procedure Draw_Symbol + (X, Y, W, H : in Integer; + Name : in String; + Hue : in Color); + + procedure Measure + (Text : in String; + W, H : out Natural; + Symbols : in Boolean := True; + Wrap : in Natural := 0); + + procedure Scroll + (X, Y, W, H : in Integer; + DX, DY : in Integer; + Callback : in Area_Draw_Function); + + procedure Text_Extents + (Text : in String; + DX, DY, W, H : out Integer); + + function Width + (Text : in String) + return Long_Float; + + function Width + (Glyph : in Character) + return Long_Float; + + function Width + (Glyph : in Wide_Character) + return Long_Float; + + function Width + (Glyph : in Wide_Wide_Character) + return Long_Float; + + + + + ---------------------- + -- Manual Drawing -- + ---------------------- + + procedure Begin_Complex_Polygon; + procedure Begin_Line; + procedure Begin_Loop; + procedure Begin_Points; + procedure Begin_Polygon; + + procedure Arc + (X, Y, R, Start, Finish : in Long_Float); + + procedure Arc + (X, Y, W, H : in Integer; + Start, Finish : in Long_Float); + + -- As per 1.3.9 docs, currently a placeholder + procedure Chord + (X, Y, W, H : in Integer; + Angle1, Angle2 : in Long_Float); + + procedure Circle + (X, Y, R : in Long_Float); + + procedure Curve + (X0, Y0 : in Long_Float; + X1, Y1 : in Long_Float; + X2, Y2 : in Long_Float; + X3, Y3 : in Long_Float); + + procedure Frame + (X, Y, W, H : in Integer; + Top, Left, Bottom, Right : in Greyscale); + + procedure Gap; + + procedure Line + (X0, Y0 : in Integer; + X1, Y1 : in Integer); + + procedure Line + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer); + + procedure Outline + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer); + + procedure Outline + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer; + X3, Y3 : in Integer); + + procedure Pie + (X, Y, W, H : in Integer; + Angle1, Angle2 : in Long_Float); + + procedure Point + (X, Y : in Integer); + + procedure Polygon + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer); + + procedure Polygon + (X0, Y0 : in Integer; + X1, Y1 : in Integer; + X2, Y2 : in Integer; + X3, Y3 : in Integer); + + procedure Rect + (X, Y, W, H : in Integer); + + procedure Rect + (X, Y, W, H : in Integer; + Hue : in Color); + + procedure Rect_Fill + (X, Y, W, H : in Integer); + + procedure Rect_Fill + (X, Y, W, H : in Integer; + Hue : in Color); + + procedure Rect_Fill + (X, Y, W, H : in Integer; + R, G, B : in Color_Component); + + procedure Ecks_Why_Line + (X0, Y0, X1 : in Integer); + + procedure Ecks_Why_Line + (X0, Y0, X1, Y2 : in Integer); + + procedure Ecks_Why_Line + (X0, Y0, X1, Y2, X3 : in Integer); + + procedure Why_Ecks_Line + (X0, Y0, Y1 : in Integer); + + procedure Why_Ecks_Line + (X0, Y0, Y1, X2 : in Integer); + + procedure Why_Ecks_Line + (X0, Y0, Y1, X2, Y3 : in Integer); + + procedure End_Complex_Polygon; + procedure End_Line; + procedure End_Loop; + procedure End_Points; + procedure End_Polygon; + + +private + + + pragma Convention (C, Symbol_Draw_Function); + + + pragma Inline (Reset_Spot); + pragma Inline (Set_Spot); + pragma Inline (Set_Status); + + + pragma Inline (Can_Do_Alpha_Blending); + pragma Inline (Shortcut_Label); + + + pragma Inline (Latin1_To_Local); + pragma Inline (Local_To_Latin1); + pragma Inline (Mac_Roman_To_Local); + pragma Inline (Local_To_Mac_Roman); + + + pragma Inline (Clip_Intersects); + pragma Inline (Pop_Clip); + pragma Inline (Push_Clip); + pragma Inline (Push_No_Clip); + pragma Inline (Restore_Clip); + + + pragma Inline (Overlay_Clear); + pragma Inline (Overlay_Rect); + + + pragma Inline (Get_Color); + pragma Inline (Set_Color); + pragma Inline (Get_Font); + pragma Inline (Get_Font_Size); + pragma Inline (Set_Font); + pragma Inline (Font_Line_Spacing); + pragma Inline (Font_Descent); + pragma Inline (Font_Height); + + + pragma Inline (Mult_Matrix); + pragma Inline (Pop_Matrix); + pragma Inline (Push_Matrix); + pragma Inline (Rotate); + pragma Inline (Scale); + pragma Inline (Transform_DX); + pragma Inline (Transform_DY); + pragma Inline (Transform_X); + pragma Inline (Transform_Y); + pragma Inline (Transformed_Vertex); + pragma Inline (Translate); + pragma Inline (Vertex); + + + pragma Inline (Add_Symbol); + pragma Inline (Draw_Text); + pragma Inline (Draw_Text_Right_Left); + pragma Inline (Draw_Box); + pragma Inline (Draw_Symbol); + pragma Inline (Measure); + pragma Inline (Scroll); + pragma Inline (Text_Extents); + pragma Inline (Width); + + + pragma Inline (Begin_Complex_Polygon); + pragma Inline (Begin_Line); + pragma Inline (Begin_Loop); + pragma Inline (Begin_Points); + pragma Inline (Begin_Polygon); + + + pragma Inline (Arc); + pragma Inline (Chord); + pragma Inline (Circle); + pragma Inline (Curve); + pragma Inline (Frame); + pragma Inline (Gap); + pragma Inline (Line); + pragma Inline (Outline); + pragma Inline (Pie); + pragma Inline (Point); + pragma Inline (Polygon); + pragma Inline (Rect); + pragma Inline (Rect_Fill); + pragma Inline (Ecks_Why_Line); + pragma Inline (Why_Ecks_Line); + + + pragma Inline (End_Complex_Polygon); + pragma Inline (End_Line); + pragma Inline (End_Loop); + pragma Inline (End_Points); + pragma Inline (End_Polygon); + + +end FLTK.Draw; + + diff --git a/src/fltk-images-bitmaps-xbm.adb b/src/fltk-images-bitmaps-xbm.adb index 1ab0904..d8059ff 100644 --- a/src/fltk-images-bitmaps-xbm.adb +++ b/src/fltk-images-bitmaps-xbm.adb @@ -42,6 +42,10 @@ package body FLTK.Images.Bitmaps.XBM is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -53,13 +57,14 @@ package body FLTK.Images.Bitmaps.XBM is (Interfaces.C.To_C (Filename)); case fl_image_fail (This.Void_Ptr) is when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => + -- raise No_Image_Error; null; + -- Since the image depth and line data are both zero here, + -- the fail method will think there's no image even though + -- nothing is wrong. This is a bug in FLTK. + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; diff --git a/src/fltk-images-bitmaps-xbm.ads b/src/fltk-images-bitmaps-xbm.ads index a242538..f39589f 100644 --- a/src/fltk-images-bitmaps-xbm.ads +++ b/src/fltk-images-bitmaps-xbm.ads @@ -3,6 +3,10 @@ package FLTK.Images.Bitmaps.XBM is + ------------- + -- Types -- + ------------- + type XBM_Image is new Bitmap with private; type XBM_Image_Reference (Data : not null access XBM_Image'Class) is limited null record @@ -11,6 +15,10 @@ package FLTK.Images.Bitmaps.XBM is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create diff --git a/src/fltk-images-bitmaps.adb b/src/fltk-images-bitmaps.adb index ac4bf1e..3ddfa93 100644 --- a/src/fltk-images-bitmaps.adb +++ b/src/fltk-images-bitmaps.adb @@ -13,6 +13,13 @@ use type package body FLTK.Images.Bitmaps is + function new_fl_bitmap + (D : in System.Address; + W, H : in Interfaces.C.int) + return System.Address; + pragma Import (C, new_fl_bitmap, "new_fl_bitmap"); + pragma Inline (new_fl_bitmap); + procedure free_fl_bitmap (I : in System.Address); pragma Import (C, free_fl_bitmap, "free_fl_bitmap"); @@ -34,6 +41,14 @@ package body FLTK.Images.Bitmaps is + procedure fl_bitmap_uncache + (I : in System.Address); + pragma Import (C, fl_bitmap_uncache, "fl_bitmap_uncache"); + pragma Inline (fl_bitmap_uncache); + + + + procedure fl_bitmap_draw2 (I : in System.Address; X, Y : in Interfaces.C.int); @@ -64,6 +79,39 @@ package body FLTK.Images.Bitmaps is + -------------------- + -- Construction -- + -------------------- + + package body Forge is + + function Create + (Data : in Color_Component_Array; + Width, Height : in Natural) + return Bitmap is + begin + return This : Bitmap do + This.Void_Ptr := new_fl_bitmap + (Data (Data'First)'Address, + Interfaces.C.int (Width), + Interfaces.C.int (Height)); + case fl_image_fail (This.Void_Ptr) is + when 1 => + -- raise No_Image_Error; + null; + -- Since the image depth and line data are both zero here, + -- the fail method will think there's no image even though + -- nothing is wrong. This is a bug in FLTK. + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; + end case; + end return; + end Create; + + end Forge; + + function Copy (This : in Bitmap; Width, Height : in Natural) @@ -71,9 +119,9 @@ package body FLTK.Images.Bitmaps is begin return Copied : Bitmap do Copied.Void_Ptr := fl_bitmap_copy - (This.Void_Ptr, - Interfaces.C.int (Width), - Interfaces.C.int (Height)); + (This.Void_Ptr, + Interfaces.C.int (Width), + Interfaces.C.int (Height)); end return; end Copy; @@ -90,14 +138,30 @@ package body FLTK.Images.Bitmaps is + ---------------- + -- Activity -- + ---------------- + + procedure Uncache + (This : in out Bitmap) is + begin + fl_bitmap_uncache (This.Void_Ptr); + end Uncache; + + + + --------------- + -- Drawing -- + --------------- + procedure Draw (This : in Bitmap; X, Y : in Integer) is begin fl_bitmap_draw2 - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); end Draw; @@ -107,13 +171,13 @@ package body FLTK.Images.Bitmaps is CX, CY : in Integer := 0) is begin fl_bitmap_draw - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y), - Interfaces.C.int (W), - Interfaces.C.int (H), - Interfaces.C.int (CX), - Interfaces.C.int (CY)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (CX), + Interfaces.C.int (CY)); end Draw; diff --git a/src/fltk-images-bitmaps.ads b/src/fltk-images-bitmaps.ads index 14df718..cf35396 100644 --- a/src/fltk-images-bitmaps.ads +++ b/src/fltk-images-bitmaps.ads @@ -3,6 +3,10 @@ package FLTK.Images.Bitmaps is + ------------- + -- Types -- + ------------- + type Bitmap is new Image with private; type Bitmap_Reference (Data : not null access Bitmap'Class) is limited null record @@ -11,6 +15,22 @@ package FLTK.Images.Bitmaps is + -------------------- + -- Construction -- + -------------------- + + package Forge is + + -- Please note that I'm pretty sure (?) input data here should be some + -- declared item that lives at least as long as the resulting Bitmap + + function Create + (Data : in Color_Component_Array; + Width, Height : in Natural) + return Bitmap; + + end Forge; + function Copy (This : in Bitmap; Width, Height : in Natural) @@ -23,6 +43,20 @@ package FLTK.Images.Bitmaps is + ---------------- + -- Activity -- + ---------------- + + procedure Uncache + (This : in out Bitmap); + + + + + --------------- + -- Drawing -- + --------------- + procedure Draw (This : in Bitmap; X, Y : in Integer); @@ -42,9 +76,8 @@ private (This : in out Bitmap); - - pragma Inline (Copy); + pragma Inline (Uncache); pragma Inline (Draw); diff --git a/src/fltk-images-pixmaps-gif.adb b/src/fltk-images-pixmaps-gif.adb index 579d8b7..546ed3e 100644 --- a/src/fltk-images-pixmaps-gif.adb +++ b/src/fltk-images-pixmaps-gif.adb @@ -42,6 +42,10 @@ package body FLTK.Images.Pixmaps.GIF is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -50,16 +54,12 @@ package body FLTK.Images.Pixmaps.GIF is begin return This : GIF_Image do This.Void_Ptr := new_fl_gif_image - (Interfaces.C.To_C (Filename)); + (Interfaces.C.To_C (Filename)); case fl_image_fail (This.Void_Ptr) is - when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => - null; + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; diff --git a/src/fltk-images-pixmaps-gif.ads b/src/fltk-images-pixmaps-gif.ads index 18e31b9..4936617 100644 --- a/src/fltk-images-pixmaps-gif.ads +++ b/src/fltk-images-pixmaps-gif.ads @@ -3,6 +3,10 @@ package FLTK.Images.Pixmaps.GIF is + ------------- + -- Types -- + ------------- + type GIF_Image is new Pixmap with private; type GIF_Image_Reference (Data : not null access GIF_Image'Class) is @@ -11,6 +15,10 @@ package FLTK.Images.Pixmaps.GIF is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create diff --git a/src/fltk-images-pixmaps-xpm.adb b/src/fltk-images-pixmaps-xpm.adb index 36c4180..136aee9 100644 --- a/src/fltk-images-pixmaps-xpm.adb +++ b/src/fltk-images-pixmaps-xpm.adb @@ -42,6 +42,10 @@ package body FLTK.Images.Pixmaps.XPM is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -50,16 +54,12 @@ package body FLTK.Images.Pixmaps.XPM is begin return This : XPM_Image do This.Void_Ptr := new_fl_xpm_image - (Interfaces.C.To_C (Filename)); + (Interfaces.C.To_C (Filename)); case fl_image_fail (This.Void_Ptr) is - when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => - null; + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; diff --git a/src/fltk-images-pixmaps-xpm.ads b/src/fltk-images-pixmaps-xpm.ads index e888632..004e2a4 100644 --- a/src/fltk-images-pixmaps-xpm.ads +++ b/src/fltk-images-pixmaps-xpm.ads @@ -3,6 +3,10 @@ package FLTK.Images.Pixmaps.XPM is + ------------- + -- Types -- + ------------- + type XPM_Image is new Pixmap with private; type XPM_Image_Reference (Data : not null access XPM_Image'Class) is @@ -11,6 +15,10 @@ package FLTK.Images.Pixmaps.XPM is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create diff --git a/src/fltk-images-pixmaps.adb b/src/fltk-images-pixmaps.adb index dc77d24..c8db506 100644 --- a/src/fltk-images-pixmaps.adb +++ b/src/fltk-images-pixmaps.adb @@ -49,6 +49,14 @@ package body FLTK.Images.Pixmaps is + procedure fl_pixmap_uncache + (I : in System.Address); + pragma Import (C, fl_pixmap_uncache, "fl_pixmap_uncache"); + pragma Inline (fl_pixmap_uncache); + + + + procedure fl_pixmap_draw2 (I : in System.Address; X, Y : in Interfaces.C.int); @@ -79,6 +87,10 @@ package body FLTK.Images.Pixmaps is + -------------------- + -- Construction -- + -------------------- + function Copy (This : in Pixmap; Width, Height : in Natural) @@ -86,9 +98,9 @@ package body FLTK.Images.Pixmaps is begin return Copied : Pixmap do Copied.Void_Ptr := fl_pixmap_copy - (This.Void_Ptr, - Interfaces.C.int (Width), - Interfaces.C.int (Height)); + (This.Void_Ptr, + Interfaces.C.int (Width), + Interfaces.C.int (Height)); end return; end Copy; @@ -105,15 +117,19 @@ package body FLTK.Images.Pixmaps is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out Pixmap; Col : in Color; Amount : in Blend) is begin fl_pixmap_color_average - (This.Void_Ptr, - Interfaces.C.int (Col), - Interfaces.C.C_float (Amount)); + (This.Void_Ptr, + Interfaces.C.int (Col), + Interfaces.C.C_float (Amount)); end Color_Average; @@ -126,14 +142,31 @@ package body FLTK.Images.Pixmaps is + ---------------- + -- Activity -- + ---------------- + + procedure Uncache + (This : in out Pixmap) is + begin + fl_pixmap_uncache (This.Void_Ptr); + end Uncache; + + + + + --------------- + -- Drawing -- + --------------- + procedure Draw (This : in Pixmap; X, Y : in Integer) is begin fl_pixmap_draw2 - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); end Draw; @@ -143,13 +176,13 @@ package body FLTK.Images.Pixmaps is CX, CY : in Integer := 0) is begin fl_pixmap_draw - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y), - Interfaces.C.int (W), - Interfaces.C.int (H), - Interfaces.C.int (CX), - Interfaces.C.int (CY)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (CX), + Interfaces.C.int (CY)); end Draw; diff --git a/src/fltk-images-pixmaps.ads b/src/fltk-images-pixmaps.ads index b72c382..a935e72 100644 --- a/src/fltk-images-pixmaps.ads +++ b/src/fltk-images-pixmaps.ads @@ -3,6 +3,10 @@ package FLTK.Images.Pixmaps is + ------------- + -- Types -- + ------------- + type Pixmap is new Image with private; type Pixmap_Reference (Data : not null access Pixmap'Class) is limited null record @@ -11,6 +15,10 @@ package FLTK.Images.Pixmaps is + -------------------- + -- Construction -- + -------------------- + function Copy (This : in Pixmap; Width, Height : in Natural) @@ -23,6 +31,10 @@ package FLTK.Images.Pixmaps is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out Pixmap; Col : in Color; @@ -34,6 +46,20 @@ package FLTK.Images.Pixmaps is + ---------------- + -- Activity -- + ---------------- + + procedure Uncache + (This : in out Pixmap); + + + + + --------------- + -- Drawing -- + --------------- + procedure Draw (This : in Pixmap; X, Y : in Integer); @@ -53,12 +79,13 @@ private (This : in out Pixmap); - - pragma Inline (Color_Average); pragma Inline (Desaturate); + pragma Inline (Uncache); + + pragma Inline (Copy); pragma Inline (Draw); diff --git a/src/fltk-images-rgb-bmp.adb b/src/fltk-images-rgb-bmp.adb index 31162f9..6a982d0 100644 --- a/src/fltk-images-rgb-bmp.adb +++ b/src/fltk-images-rgb-bmp.adb @@ -42,6 +42,10 @@ package body FLTK.Images.RGB.BMP is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -50,16 +54,12 @@ package body FLTK.Images.RGB.BMP is begin return This : BMP_Image do This.Void_Ptr := new_fl_bmp_image - (Interfaces.C.To_C (Filename)); + (Interfaces.C.To_C (Filename)); case fl_image_fail (This.Void_Ptr) is - when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => - null; + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; diff --git a/src/fltk-images-rgb-bmp.ads b/src/fltk-images-rgb-bmp.ads index bb4fa48..dbbeea1 100644 --- a/src/fltk-images-rgb-bmp.ads +++ b/src/fltk-images-rgb-bmp.ads @@ -3,6 +3,10 @@ package FLTK.Images.RGB.BMP is + ------------- + -- Types -- + ------------- + type BMP_Image is new RGB_Image with private; type BMP_Image_Reference (Data : not null access BMP_Image'Class) is limited null record @@ -11,6 +15,10 @@ package FLTK.Images.RGB.BMP is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create diff --git a/src/fltk-images-rgb-jpeg.adb b/src/fltk-images-rgb-jpeg.adb index 9448570..9d7afe1 100644 --- a/src/fltk-images-rgb-jpeg.adb +++ b/src/fltk-images-rgb-jpeg.adb @@ -19,6 +19,13 @@ package body FLTK.Images.RGB.JPEG is pragma Import (C, new_fl_jpeg_image, "new_fl_jpeg_image"); pragma Inline (new_fl_jpeg_image); + function new_fl_jpeg_image2 + (N : in Interfaces.C.char_array; + D : in System.Address) + return System.Address; + pragma Import (C, new_fl_jpeg_image2, "new_fl_jpeg_image2"); + pragma Inline (new_fl_jpeg_image2); + procedure free_fl_jpeg_image (P : in System.Address); pragma Import (C, free_fl_jpeg_image, "free_fl_jpeg_image"); @@ -42,6 +49,10 @@ package body FLTK.Images.RGB.JPEG is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -50,16 +61,30 @@ package body FLTK.Images.RGB.JPEG is begin return This : JPEG_Image do This.Void_Ptr := new_fl_jpeg_image - (Interfaces.C.To_C (Filename)); + (Interfaces.C.To_C (Filename)); + case fl_image_fail (This.Void_Ptr) is + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; + end case; + end return; + end Create; + + function Create + (Name : in String := ""; + Data : in Color_Component_Array) + return JPEG_Image is + begin + return This : JPEG_Image do + This.Void_Ptr := new_fl_jpeg_image2 + (Interfaces.C.To_C (Name), + Data (Data'First)'Address); case fl_image_fail (This.Void_Ptr) is - when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => - null; + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; diff --git a/src/fltk-images-rgb-jpeg.ads b/src/fltk-images-rgb-jpeg.ads index c7fafd8..742ae4e 100644 --- a/src/fltk-images-rgb-jpeg.ads +++ b/src/fltk-images-rgb-jpeg.ads @@ -3,6 +3,10 @@ package FLTK.Images.RGB.JPEG is + ------------- + -- Types -- + ------------- + type JPEG_Image is new RGB_Image with private; type JPEG_Image_Reference (Data : not null access JPEG_Image'Class) is @@ -11,12 +15,21 @@ package FLTK.Images.RGB.JPEG is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create (Filename : in String) return JPEG_Image; + function Create + (Name : in String := ""; + Data : in Color_Component_Array) + return JPEG_Image; + end Forge; diff --git a/src/fltk-images-rgb-png.adb b/src/fltk-images-rgb-png.adb index 8cb97ce..6023f82 100644 --- a/src/fltk-images-rgb-png.adb +++ b/src/fltk-images-rgb-png.adb @@ -19,6 +19,14 @@ package body FLTK.Images.RGB.PNG is pragma Import (C, new_fl_png_image, "new_fl_png_image"); pragma Inline (new_fl_png_image); + function new_fl_png_image2 + (N : in Interfaces.C.char_array; + D : in System.Address; + S : in Interfaces.C.int) + return System.Address; + pragma Import (C, new_fl_png_image2, "new_fl_png_image2"); + pragma Inline (new_fl_png_image2); + procedure free_fl_png_image (P : in System.Address); pragma Import (C, free_fl_png_image, "free_fl_png_image"); @@ -42,6 +50,10 @@ package body FLTK.Images.RGB.PNG is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -50,16 +62,31 @@ package body FLTK.Images.RGB.PNG is begin return This : PNG_Image do This.Void_Ptr := new_fl_png_image - (Interfaces.C.To_C (Filename)); + (Interfaces.C.To_C (Filename)); + case fl_image_fail (This.Void_Ptr) is + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; + end case; + end return; + end Create; + + function Create + (Name : in String := ""; + Data : in Color_Component_Array) + return PNG_Image is + begin + return This : PNG_Image do + This.Void_Ptr := new_fl_png_image2 + (Interfaces.C.To_C (Name), + Data (Data'First)'Address, + Data'Length); case fl_image_fail (This.Void_Ptr) is - when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => - null; + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; diff --git a/src/fltk-images-rgb-png.ads b/src/fltk-images-rgb-png.ads index 760f84d..a4c270a 100644 --- a/src/fltk-images-rgb-png.ads +++ b/src/fltk-images-rgb-png.ads @@ -3,6 +3,10 @@ package FLTK.Images.RGB.PNG is + ------------- + -- Types -- + ------------- + type PNG_Image is new RGB_Image with private; type PNG_Image_Reference (Data : not null access PNG_Image'Class) is limited null record @@ -11,12 +15,21 @@ package FLTK.Images.RGB.PNG is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create (Filename : in String) return PNG_Image; + function Create + (Name : in String := ""; + Data : in Color_Component_Array) + return PNG_Image; + end Forge; diff --git a/src/fltk-images-rgb-pnm.adb b/src/fltk-images-rgb-pnm.adb index 95247a1..6b0e515 100644 --- a/src/fltk-images-rgb-pnm.adb +++ b/src/fltk-images-rgb-pnm.adb @@ -42,6 +42,10 @@ package body FLTK.Images.RGB.PNM is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -50,16 +54,12 @@ package body FLTK.Images.RGB.PNM is begin return This : PNM_Image do This.Void_Ptr := new_fl_pnm_image - (Interfaces.C.To_C (Filename)); + (Interfaces.C.To_C (Filename)); case fl_image_fail (This.Void_Ptr) is - when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => - null; + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; diff --git a/src/fltk-images-rgb-pnm.ads b/src/fltk-images-rgb-pnm.ads index 92743ea..f895d73 100644 --- a/src/fltk-images-rgb-pnm.ads +++ b/src/fltk-images-rgb-pnm.ads @@ -3,6 +3,10 @@ package FLTK.Images.RGB.PNM is + ------------- + -- Types -- + ------------- + type PNM_Image is new RGB_Image with private; type PNM_Image_Reference (Data : not null access PNM_Image'Class) is limited null record @@ -11,6 +15,10 @@ package FLTK.Images.RGB.PNM is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create diff --git a/src/fltk-images-rgb.adb b/src/fltk-images-rgb.adb index 8e3e36f..4382e93 100644 --- a/src/fltk-images-rgb.adb +++ b/src/fltk-images-rgb.adb @@ -13,11 +13,35 @@ use type package body FLTK.Images.RGB is + function new_fl_rgb_image + (Data : in System.Address; + W, H, D, L : in Interfaces.C.int) + return System.Address; + pragma Import (C, new_fl_rgb_image, "new_fl_rgb_image"); + pragma Inline (new_fl_rgb_image); + + function new_fl_rgb_image2 + (P : in System.Address; + C : in Interfaces.C.unsigned) + return System.Address; + pragma Import (C, new_fl_rgb_image2, "new_fl_rgb_image2"); + pragma Inline (new_fl_rgb_image2); + procedure free_fl_rgb_image (I : in System.Address); pragma Import (C, free_fl_rgb_image, "free_fl_rgb_image"); pragma Inline (free_fl_rgb_image); + function fl_rgb_image_get_max_size + return Interfaces.C.size_t; + pragma Import (C, fl_rgb_image_get_max_size, "fl_rgb_image_get_max_size"); + pragma Inline (fl_rgb_image_get_max_size); + + procedure fl_rgb_image_set_max_size + (V : in Interfaces.C.size_t); + pragma Import (C, fl_rgb_image_set_max_size, "fl_rgb_image_set_max_size"); + pragma Inline (fl_rgb_image_set_max_size); + function fl_rgb_image_copy (I : in System.Address; W, H : in Interfaces.C.int) @@ -49,6 +73,14 @@ package body FLTK.Images.RGB is + procedure fl_rgb_image_uncache + (I : in System.Address); + pragma Import (C, fl_rgb_image_uncache, "fl_rgb_image_uncache"); + pragma Inline (fl_rgb_image_uncache); + + + + procedure fl_rgb_image_draw2 (I : in System.Address; X, Y : in Interfaces.C.int); @@ -79,6 +111,70 @@ package body FLTK.Images.RGB is + -------------------- + -- Construction -- + -------------------- + + package body Forge is + + function Create + (Data : in Color_Component_Array; + Width, Height : in Natural; + Depth : in Natural := 3; + Line_Data : in Natural := 0) + return RGB_Image is + begin + return This : RGB_Image do + This.Void_Ptr := new_fl_rgb_image + (Data (Data'First)'Address, + Interfaces.C.int (Width), + Interfaces.C.int (Height), + Interfaces.C.int (Depth), + Interfaces.C.int (Line_Data)); + case fl_image_fail (This.Void_Ptr) is + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; + end case; + end return; + end Create; + + function Create + (Data : in FLTK.Images.Pixmaps.Pixmap'Class; + Background : in Color := Background_Color) + return RGB_Image is + begin + return This : RGB_Image do + This.Void_Ptr := new_fl_rgb_image2 + (Wrapper (Data).Void_Ptr, + Interfaces.C.unsigned (Background)); + case fl_image_fail (This.Void_Ptr) is + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; + end case; + end return; + end Create; + + end Forge; + + + function Get_Max_Size + return Natural is + begin + return Natural (fl_rgb_image_get_max_size); + end Get_Max_Size; + + + procedure Set_Max_Size + (Value : in Natural) is + begin + fl_rgb_image_set_max_size (Interfaces.C.size_t (Value)); + end Set_Max_Size; + + function Copy (This : in RGB_Image; Width, Height : in Natural) @@ -105,15 +201,19 @@ package body FLTK.Images.RGB is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out RGB_Image; Col : in Color; Amount : in Blend) is begin fl_rgb_image_color_average - (This.Void_Ptr, - Interfaces.C.int (Col), - Interfaces.C.C_float (Amount)); + (This.Void_Ptr, + Interfaces.C.int (Col), + Interfaces.C.C_float (Amount)); end Color_Average; @@ -126,14 +226,31 @@ package body FLTK.Images.RGB is + ---------------- + -- Activity -- + ---------------- + + procedure Uncache + (This : in out RGB_Image) is + begin + fl_rgb_image_uncache (This.Void_Ptr); + end Uncache; + + + + + --------------- + -- Drawing -- + --------------- + procedure Draw (This : in RGB_Image; X, Y : in Integer) is begin fl_rgb_image_draw2 - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); end Draw; @@ -143,13 +260,13 @@ package body FLTK.Images.RGB is CX, CY : in Integer := 0) is begin fl_rgb_image_draw - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y), - Interfaces.C.int (W), - Interfaces.C.int (H), - Interfaces.C.int (CX), - Interfaces.C.int (CY)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (CX), + Interfaces.C.int (CY)); end Draw; diff --git a/src/fltk-images-rgb.ads b/src/fltk-images-rgb.ads index 3aa3de0..67518c3 100644 --- a/src/fltk-images-rgb.ads +++ b/src/fltk-images-rgb.ads @@ -1,8 +1,17 @@ +with + + FLTK.Images.Pixmaps; + + package FLTK.Images.RGB is + ------------- + -- Types -- + ------------- + type RGB_Image is new Image with private; type RGB_Image_Reference (Data : not null access RGB_Image'Class) is limited null record @@ -11,6 +20,32 @@ package FLTK.Images.RGB is + -------------------- + -- Construction -- + -------------------- + + package Forge is + + function Create + (Data : in Color_Component_Array; + Width, Height : in Natural; + Depth : in Natural := 3; + Line_Data : in Natural := 0) + return RGB_Image; + + function Create + (Data : in FLTK.Images.Pixmaps.Pixmap'Class; + Background : in Color := Background_Color) + return RGB_Image; + + end Forge; + + function Get_Max_Size + return Natural; + + procedure Set_Max_Size + (Value : in Natural); + function Copy (This : in RGB_Image; Width, Height : in Natural) @@ -23,6 +58,10 @@ package FLTK.Images.RGB is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out RGB_Image; Col : in Color; @@ -34,6 +73,20 @@ package FLTK.Images.RGB is + ---------------- + -- Activity -- + ---------------- + + procedure Uncache + (This : in out RGB_Image); + + + + + --------------- + -- Drawing -- + --------------- + procedure Draw (This : in RGB_Image; X, Y : in Integer); @@ -53,8 +106,8 @@ private (This : in out RGB_Image); - - + pragma Inline (Get_Max_Size); + pragma Inline (Set_Max_Size); pragma Inline (Copy); @@ -62,6 +115,9 @@ private pragma Inline (Desaturate); + pragma Inline (Uncache); + + pragma Inline (Draw); diff --git a/src/fltk-images-shared.adb b/src/fltk-images-shared.adb index 2d20e3c..24bc014 100644 --- a/src/fltk-images-shared.adb +++ b/src/fltk-images-shared.adb @@ -7,6 +7,7 @@ with use type + Interfaces.C.int, Interfaces.C.Strings.chars_ptr, System.Address; @@ -70,17 +71,39 @@ package body FLTK.Images.Shared is + function fl_shared_image_num_images + return Interfaces.C.int; + pragma Import (C, fl_shared_image_num_images, "fl_shared_image_num_images"); + pragma Inline (fl_shared_image_num_images); + function fl_shared_image_name (I : in System.Address) return Interfaces.C.Strings.chars_ptr; pragma Import (C, fl_shared_image_name, "fl_shared_image_name"); pragma Inline (fl_shared_image_name); + function fl_shared_image_original + (I : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_shared_image_original, "fl_shared_image_original"); + pragma Inline (fl_shared_image_original); + + function fl_shared_image_refcount + (I : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_shared_image_refcount, "fl_shared_image_refcount"); + pragma Inline (fl_shared_image_refcount); + procedure fl_shared_image_reload (I : in System.Address); pragma Import (C, fl_shared_image_reload, "fl_shared_image_reload"); pragma Inline (fl_shared_image_reload); + procedure fl_shared_image_uncache + (I : in System.Address); + pragma Import (C, fl_shared_image_uncache, "fl_shared_image_uncache"); + pragma Inline (fl_shared_image_uncache); + @@ -95,9 +118,6 @@ package body FLTK.Images.Shared is pragma Import (C, fl_shared_image_scale, "fl_shared_image_scale"); pragma Inline (fl_shared_image_scale); - - - procedure fl_shared_image_draw (I : in System.Address; X, Y, W, H, CX, CY : in Interfaces.C.int); @@ -128,6 +148,10 @@ package body FLTK.Images.Shared is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -173,8 +197,6 @@ package body FLTK.Images.Shared is end Forge; - - function Copy (This : in Shared_Image; Width, Height : in Natural) @@ -201,6 +223,10 @@ package body FLTK.Images.Shared is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out Shared_Image; Col : in Color; @@ -222,6 +248,17 @@ package body FLTK.Images.Shared is + ---------------- + -- Activity -- + ---------------- + + function Number_Of_Images + return Natural is + begin + return Natural (fl_shared_image_num_images); + end Number_Of_Images; + + function Name (This : in Shared_Image) return String @@ -236,6 +273,22 @@ package body FLTK.Images.Shared is end Name; + function Original + (This : in Shared_Image) + return Boolean is + begin + return fl_shared_image_original (This.Void_Ptr) /= 0; + end Original; + + + function Reference_Count + (This : in Shared_Image) + return Natural is + begin + return Natural (fl_shared_image_refcount (This.Void_Ptr)); + end Reference_Count; + + procedure Reload (This : in out Shared_Image) is begin @@ -243,7 +296,18 @@ package body FLTK.Images.Shared is end Reload; + procedure Uncache + (This : in out Shared_Image) is + begin + fl_shared_image_uncache (This.Void_Ptr); + end Uncache; + + + + --------------- + -- Drawing -- + --------------- procedure Set_Scaling_Algorithm (To : in Scaling_Kind) is @@ -267,8 +331,6 @@ package body FLTK.Images.Shared is end Scale; - - procedure Draw (This : in Shared_Image; X, Y, W, H : in Integer; diff --git a/src/fltk-images-shared.ads b/src/fltk-images-shared.ads index a6810f8..ff12457 100644 --- a/src/fltk-images-shared.ads +++ b/src/fltk-images-shared.ads @@ -8,6 +8,10 @@ with package FLTK.Images.Shared is + ------------- + -- Types -- + ------------- + type Shared_Image is new Image with private; type Shared_Image_Reference (Data : not null access Shared_Image'Class) is @@ -16,6 +20,10 @@ package FLTK.Images.Shared is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create @@ -34,9 +42,6 @@ package FLTK.Images.Shared is end Forge; - - - function Copy (This : in Shared_Image; Width, Height : in Natural) @@ -49,6 +54,10 @@ package FLTK.Images.Shared is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out Shared_Image; Col : in Color; @@ -60,16 +69,38 @@ package FLTK.Images.Shared is + ---------------- + -- Activity -- + ---------------- + + function Number_Of_Images + return Natural; + function Name (This : in Shared_Image) return String; + function Original + (This : in Shared_Image) + return Boolean; + + function Reference_Count + (This : in Shared_Image) + return Natural; + procedure Reload (This : in out Shared_Image); + procedure Uncache + (This : in out Shared_Image); + + --------------- + -- Drawing -- + --------------- + procedure Set_Scaling_Algorithm (To : in Scaling_Kind); @@ -79,9 +110,6 @@ package FLTK.Images.Shared is Proportional : in Boolean := True; Can_Expand : in Boolean := False); - - - procedure Draw (This : in Shared_Image; X, Y, W, H : in Integer; @@ -101,8 +129,6 @@ private (This : in out Shared_Image); - - pragma Inline (Copy); @@ -110,14 +136,16 @@ private pragma Inline (Desaturate); + pragma Inline (Number_Of_Images); pragma Inline (Name); + pragma Inline (Original); + pragma Inline (Reference_Count); pragma Inline (Reload); + pragma Inline (Uncache); pragma Inline (Set_Scaling_Algorithm); pragma Inline (Scale); - - pragma Inline (Draw); diff --git a/src/fltk-images-tiled.adb b/src/fltk-images-tiled.adb new file mode 100644 index 0000000..fd4b9ed --- /dev/null +++ b/src/fltk-images-tiled.adb @@ -0,0 +1,233 @@ + + +with + + Interfaces.C, + System; + +use type + + System.Address; + + +package body FLTK.Images.Tiled is + + + function new_fl_tiled_image + (T : in System.Address; + W, H : in Interfaces.C.int) + return System.Address; + pragma Import (C, new_fl_tiled_image, "new_fl_tiled_image"); + pragma Inline (new_fl_tiled_image); + + procedure free_fl_tiled_image + (T : in System.Address); + pragma Import (C, free_fl_tiled_image, "free_fl_tiled_image"); + pragma Inline (free_fl_tiled_image); + + function fl_tiled_image_copy + (T : in System.Address; + W, H : in Interfaces.C.int) + return System.Address; + pragma Import (C, fl_tiled_image_copy, "fl_tiled_image_copy"); + pragma Inline (fl_tiled_image_copy); + + function fl_tiled_image_copy2 + (T : in System.Address) + return System.Address; + pragma Import (C, fl_tiled_image_copy2, "fl_tiled_image_copy2"); + pragma Inline (fl_tiled_image_copy2); + + + + + function fl_tiled_image_get_image + (T : in System.Address) + return System.Address; + pragma Import (C, fl_tiled_image_get_image, "fl_tiled_image_get_image"); + pragma Inline (fl_tiled_image_get_image); + + + + + procedure fl_tiled_image_color_average + (T : in System.Address; + C : in Interfaces.C.int; + B : in Interfaces.C.C_float); + pragma Import (C, fl_tiled_image_color_average, "fl_tiled_image_color_average"); + pragma Inline (fl_tiled_image_color_average); + + procedure fl_tiled_image_desaturate + (T : in System.Address); + pragma Import (C, fl_tiled_image_desaturate, "fl_tiled_image_desaturate"); + pragma Inline (fl_tiled_image_desaturate); + + + + + procedure fl_tiled_image_draw + (T : in System.Address; + X, Y : in Interfaces.C.int); + pragma Import (C, fl_tiled_image_draw, "fl_tiled_image_draw"); + pragma Inline (fl_tiled_image_draw); + + procedure fl_tiled_image_draw2 + (T : in System.Address; + X, Y, W, H : in Interfaces.C.int; + CX, CY : in Interfaces.C.int); + pragma Import (C, fl_tiled_image_draw2, "fl_tiled_image_draw2"); + pragma Inline (fl_tiled_image_draw2); + + + + + overriding procedure Finalize + (This : in out Tiled_Image) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in Tiled_Image'Class + then + free_fl_tiled_image (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (Image (This)); + end Finalize; + + + + + -------------------- + -- Construction -- + -------------------- + + package body Forge is + + function Create + (From : in out Image'Class; + W, H : in Integer := 0) + return Tiled_Image is + begin + return This : Tiled_Image do + This.Void_Ptr := new_fl_tiled_image + (From.Void_Ptr, + Interfaces.C.int (W), + Interfaces.C.int (H)); + This.Dummy.Void_Ptr := fl_tiled_image_get_image (This.Void_Ptr); + This.Dummy.Needs_Dealloc := False; + end return; + end Create; + + end Forge; + + + function Copy + (This : in Tiled_Image; + Width, Height : in Natural) + return Tiled_Image'Class is + begin + return Copied : Tiled_Image do + Copied.Void_Ptr := fl_tiled_image_copy + (This.Void_Ptr, + Interfaces.C.int (Width), + Interfaces.C.int (Height)); + Copied.Dummy.Void_Ptr := fl_tiled_image_get_image (Copied.Void_Ptr); + Copied.Dummy.Needs_Dealloc := False; + end return; + end Copy; + + + function Copy + (This : in Tiled_Image) + return Tiled_Image'Class is + begin + return Copied : Tiled_Image do + Copied.Void_Ptr := fl_tiled_image_copy2 (This.Void_Ptr); + Copied.Dummy.Void_Ptr := fl_tiled_image_get_image (Copied.Void_Ptr); + Copied.Dummy.Needs_Dealloc := False; + end return; + end Copy; + + + + + --------------------- + -- Miscellaneous -- + --------------------- + + procedure Inactive + (This : in out Tiled_Image) is + begin + This.Dummy.Void_Ptr := fl_tiled_image_get_image (This.Void_Ptr); + This.Dummy.Needs_Dealloc := False; + Image (This).Inactive; + end Inactive; + + + function Tile + (This : in out Tiled_Image) + return Image_Reference is + begin + return (Data => This.Dummy'Unchecked_Access); + end Tile; + + + + + -------------- + -- Colors -- + -------------- + + procedure Color_Average + (This : in out Tiled_Image; + Hue : in Color; + Amount : in Blend) is + begin + This.Dummy.Void_Ptr := fl_tiled_image_get_image (This.Void_Ptr); + This.Dummy.Needs_Dealloc := False; + fl_tiled_image_color_average + (This.Void_Ptr, + Interfaces.C.int (Hue), + Interfaces.C.C_float (Amount)); + end Color_Average; + + + procedure Desaturate + (This : in out Tiled_Image) is + begin + This.Dummy.Void_Ptr := fl_tiled_image_get_image (This.Void_Ptr); + This.Dummy.Needs_Dealloc := False; + fl_tiled_image_desaturate (This.Void_Ptr); + end Desaturate; + + + + + procedure Draw + (This : in Tiled_Image; + X, Y : in Integer) is + begin + fl_tiled_image_draw + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Draw; + + + procedure Draw + (This : in Tiled_Image; + X, Y, W, H : in Integer; + CX, CY : in Integer) is + begin + fl_tiled_image_draw2 + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (CX), + Interfaces.C.int (CY)); + end Draw; + + +end FLTK.Images.Tiled; + diff --git a/src/fltk-images-tiled.ads b/src/fltk-images-tiled.ads new file mode 100644 index 0000000..cf3ee13 --- /dev/null +++ b/src/fltk-images-tiled.ads @@ -0,0 +1,112 @@ + + +package FLTK.Images.Tiled is + + + ------------- + -- Types -- + ------------- + + type Tiled_Image is new Image with private; + + type Tiled_Image_Reference (Data : not null access Tiled_Image'Class) is + limited null record with Implicit_Dereference => Data; + + + + + -------------------- + -- Construction -- + -------------------- + + package Forge is + + function Create + (From : in out Image'Class; + W, H : in Integer := 0) + return Tiled_Image; + + end Forge; + + function Copy + (This : in Tiled_Image; + Width, Height : in Natural) + return Tiled_Image'Class; + + function Copy + (This : in Tiled_Image) + return Tiled_Image'Class; + + + + + --------------------- + -- Miscellaneous -- + --------------------- + + procedure Inactive + (This : in out Tiled_Image); + + function Tile + (This : in out Tiled_Image) + return Image_Reference; + + + + + -------------- + -- Colors -- + -------------- + + procedure Color_Average + (This : in out Tiled_Image; + Hue : in Color; + Amount : in Blend); + + procedure Desaturate + (This : in out Tiled_Image); + + + + + --------------- + -- Drawing -- + --------------- + + procedure Draw + (This : in Tiled_Image; + X, Y : in Integer); + + procedure Draw + (This : in Tiled_Image; + X, Y, W, H : in Integer; + CX, CY : in Integer); + + +private + + + type Tiled_Image is new Image with record + Dummy : aliased Image; + end record; + + overriding procedure Finalize + (This : in out Tiled_Image); + + + pragma Inline (Copy); + + + pragma Inline (Inactive); + pragma Inline (Tile); + + + pragma Inline (Color_Average); + pragma Inline (Desaturate); + + + pragma Inline (Draw); + + +end FLTK.Images.Tiled; + diff --git a/src/fltk-images.adb b/src/fltk-images.adb index 008e0b2..f86071e 100644 --- a/src/fltk-images.adb +++ b/src/fltk-images.adb @@ -2,7 +2,7 @@ with - Interfaces.C, + Interfaces.C.Strings, System; use type @@ -74,6 +74,11 @@ package body FLTK.Images is pragma Import (C, fl_image_inactive, "fl_image_inactive"); pragma Inline (fl_image_inactive); + procedure fl_image_uncache + (I : in System.Address); + pragma Import (C, fl_image_uncache, "fl_image_uncache"); + pragma Inline (fl_image_uncache); + @@ -95,6 +100,41 @@ package body FLTK.Images is pragma Import (C, fl_image_d, "fl_image_d"); pragma Inline (fl_image_d); + function fl_image_ld + (I : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_image_ld, "fl_image_ld"); + pragma Inline (fl_image_ld); + + function fl_image_count + (I : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_image_count, "fl_image_count"); + pragma Inline (fl_image_count); + + + + + function fl_image_data + (I : in System.Address) + return System.Address; + pragma Import (C, fl_image_data, "fl_image_data"); + pragma Inline (fl_image_data); + + function fl_image_get_pixel + (C : in Interfaces.C.Strings.chars_ptr; + O : in Interfaces.C.int) + return Interfaces.C.unsigned_char; + pragma Import (C, fl_image_get_pixel, "fl_image_get_pixel"); + pragma Inline (fl_image_get_pixel); + + procedure fl_image_set_pixel + (C : in Interfaces.C.Strings.chars_ptr; + O : in Interfaces.C.int; + V : in Interfaces.C.unsigned_char); + pragma Import (C, fl_image_set_pixel, "fl_image_set_pixel"); + pragma Inline (fl_image_set_pixel); + @@ -125,7 +165,9 @@ package body FLTK.Images is if This.Void_Ptr /= System.Null_Address and then This in Image'Class then - free_fl_image (This.Void_Ptr); + if This.Needs_Dealloc then + free_fl_image (This.Void_Ptr); + end if; This.Void_Ptr := System.Null_Address; end if; end Finalize; @@ -133,6 +175,10 @@ package body FLTK.Images is + -------------------- + -- Construction -- + -------------------- + package body Forge is function Create @@ -141,18 +187,14 @@ package body FLTK.Images is begin return This : Image do This.Void_Ptr := new_fl_image - (Interfaces.C.int (Width), - Interfaces.C.int (Height), - Interfaces.C.int (Depth)); + (Interfaces.C.int (Width), + Interfaces.C.int (Height), + Interfaces.C.int (Depth)); case fl_image_fail (This.Void_Ptr) is - when 1 => - raise No_Image_Error; - when 2 => - raise File_Access_Error; - when 3 => - raise Format_Error; - when others => - null; + when 1 => raise No_Image_Error; + when 2 => raise File_Access_Error; + when 3 => raise Format_Error; + when others => null; end case; end return; end Create; @@ -160,8 +202,6 @@ package body FLTK.Images is end Forge; - - function Get_Copy_Algorithm return Scaling_Kind is begin @@ -183,9 +223,9 @@ package body FLTK.Images is begin return Copied : Image do Copied.Void_Ptr := fl_image_copy - (This.Void_Ptr, - Interfaces.C.int (Width), - Interfaces.C.int (Height)); + (This.Void_Ptr, + Interfaces.C.int (Width), + Interfaces.C.int (Height)); end return; end Copy; @@ -202,15 +242,19 @@ package body FLTK.Images is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out Image; Col : in Color; Amount : in Blend) is begin fl_image_color_average - (This.Void_Ptr, - Interfaces.C.int (Col), - Interfaces.C.C_float (Amount)); + (This.Void_Ptr, + Interfaces.C.int (Col), + Interfaces.C.C_float (Amount)); end Color_Average; @@ -223,6 +267,10 @@ package body FLTK.Images is + ---------------- + -- Activity -- + ---------------- + procedure Inactive (This : in out Image) is begin @@ -238,8 +286,19 @@ package body FLTK.Images is end Is_Empty; + procedure Uncache + (This : in out Image) is + begin + fl_image_uncache (This.Void_Ptr); + end Uncache; + + + ------------------ + -- Dimensions -- + ------------------ + function Get_W (This : in Image) return Natural is @@ -264,16 +323,140 @@ package body FLTK.Images is end Get_D; + function Get_Line_Data + (This : in Image) + return Natural is + begin + return Natural (fl_image_ld (This.Void_Ptr)); + end Get_Line_Data; + + + function Get_Data_Count + (This : in Image) + return Natural is + begin + return Natural (fl_image_count (This.Void_Ptr)); + end Get_Data_Count; + + + function Get_Data_Size + (This : in Image) + return Natural + is + My_Depth : Natural := This.Get_D; + My_Line_Data : Natural := This.Get_Line_Data; + begin + if My_Line_Data > 0 then + return My_Line_Data * This.Get_H; + elsif My_Depth = 0 then + return Integer (Float'Ceiling (Float (This.Get_W) / 8.0)) * This.Get_H; + else + return This.Get_W * My_Depth * This.Get_H; + end if; + end Get_Data_Size; + + + + + ------------------ + -- Pixel Data -- + ------------------ + function Get_Datum + (This : in Image; + Data : in Positive; + Position : in Positive) + return Color_Component + is + Pointers : array (1 .. This.Get_Data_Count) of Interfaces.C.Strings.chars_ptr; + for Pointers'Address use fl_image_data (This.Void_Ptr); + pragma Import (Ada, Pointers); + begin + return Color_Component + (fl_image_get_pixel (Pointers (Data), Interfaces.C.int (Position) - 1)); + end Get_Datum; + + + procedure Set_Datum + (This : in out Image; + Data : in Positive; + Position : in Positive; + Value : in Color_Component) + is + Pointers : array (1 .. This.Get_Data_Count) of Interfaces.C.Strings.chars_ptr; + for Pointers'Address use fl_image_data (This.Void_Ptr); + pragma Import (Ada, Pointers); + begin + fl_image_set_pixel + (Pointers (Data), + Interfaces.C.int (Position) - 1, + Interfaces.C.unsigned_char (Value)); + end Set_Datum; + + + function Get_Data + (This : in Image; + Data : in Positive; + Position : in Positive; + Count : in Natural) + return Color_Component_Array + is + Pointers : array (1 .. This.Get_Data_Count) of Interfaces.C.Strings.chars_ptr; + for Pointers'Address use fl_image_data (This.Void_Ptr); + pragma Import (Ada, Pointers); + Result : Color_Component_Array := (1 .. Count => 0); + begin + for Index in Result'Range loop + Result (Index) := Color_Component (fl_image_get_pixel + (Pointers (Data), + Interfaces.C.int (Index - 1 + Position - 1))); + end loop; + return Result; + end Get_Data; + + + function All_Data + (This : in Image; + Data : in Positive) + return Color_Component_Array is + begin + return This.Get_Data (Data, 1, This.Get_Data_Size); + end All_Data; + + + procedure Update_Data + (This : in out Image; + Data : in Positive; + Position : in Positive; + Values : in Color_Component_Array) + is + Pointers : array (1 .. This.Get_Data_Count) of Interfaces.C.Strings.chars_ptr; + for Pointers'Address use fl_image_data (This.Void_Ptr); + pragma Import (Ada, Pointers); + begin + for Counter in Integer range 0 .. Values'Length - 1 loop + fl_image_set_pixel + (Pointers (Data), + Interfaces.C.int (Position - 1 + Counter), + Interfaces.C.unsigned_char (Values (Values'First + Counter))); + end loop; + end Update_Data; + + + + + --------------- + -- Drawing -- + --------------- procedure Draw (This : in Image; X, Y : in Integer) is begin fl_image_draw - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); end Draw; @@ -283,13 +466,13 @@ package body FLTK.Images is CX, CY : in Integer := 0) is begin fl_image_draw2 - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y), - Interfaces.C.int (W), - Interfaces.C.int (H), - Interfaces.C.int (CX), - Interfaces.C.int (CY)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (CX), + Interfaces.C.int (CY)); end Draw; @@ -298,9 +481,9 @@ package body FLTK.Images is X, Y : in Integer) is begin fl_image_draw_empty - (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y)); + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); end Draw_Empty; diff --git a/src/fltk-images.ads b/src/fltk-images.ads index 053ed19..0ee31d5 100644 --- a/src/fltk-images.ads +++ b/src/fltk-images.ads @@ -3,6 +3,10 @@ package FLTK.Images is + ------------- + -- Types -- + ------------- + type Image is new Wrapper with private; type Image_Reference (Data : not null access Image'Class) is limited null record @@ -17,6 +21,10 @@ package FLTK.Images is + -------------------- + -- Construction -- + -------------------- + package Forge is function Create @@ -25,9 +33,6 @@ package FLTK.Images is end Forge; - - - function Get_Copy_Algorithm return Scaling_Kind; @@ -46,6 +51,10 @@ package FLTK.Images is + -------------- + -- Colors -- + -------------- + procedure Color_Average (This : in out Image; Col : in Color; @@ -57,6 +66,10 @@ package FLTK.Images is + ---------------- + -- Activity -- + ---------------- + procedure Inactive (This : in out Image); @@ -64,8 +77,15 @@ package FLTK.Images is (This : in Image) return Boolean; + procedure Uncache + (This : in out Image); + + + ------------------ + -- Dimensions -- + ------------------ function Get_W (This : in Image) @@ -79,8 +99,77 @@ package FLTK.Images is (This : in Image) return Natural; + function Get_Line_Data + (This : in Image) + return Natural; + + function Get_Data_Count + (This : in Image) + return Natural; + + function Get_Data_Size + (This : in Image) + return Natural; + + + + + ------------------ + -- Pixel Data -- + ------------------ + + function Get_Datum + (This : in Image; + Data : in Positive; + Position : in Positive) + return Color_Component + with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This); + + procedure Set_Datum + (This : in out Image; + Data : in Positive; + Position : in Positive; + Value : in Color_Component) + with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This); + + function Get_Data + (This : in Image; + Data : in Positive; + Position : in Positive; + Count : in Natural) + return Color_Component_Array + with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This) and + Count <= Get_Data_Size (This) - Position + 1; + + function All_Data + (This : in Image; + Data : in Positive) + return Color_Component_Array + with Pre => + Data <= Get_Data_Count (This); + + procedure Update_Data + (This : in out Image; + Data : in Positive; + Position : in Positive; + Values : in Color_Component_Array) + with Pre => + Data <= Get_Data_Count (This) and + Position <= Get_Data_Size (This) and + Values'Length <= Get_Data_Size (This) - Position + 1; + + + --------------- + -- Drawing -- + --------------- procedure Draw (This : in Image; @@ -107,6 +196,8 @@ private + pragma Inline (Get_Copy_Algorithm); + pragma Inline (Set_Copy_Algorithm); pragma Inline (Copy); @@ -116,11 +207,14 @@ private pragma Inline (Inactive); pragma Inline (Is_Empty); + pragma Inline (Uncache); pragma Inline (Get_W); pragma Inline (Get_H); pragma Inline (Get_D); + pragma Inline (Get_Line_Data); + pragma Inline (Get_Data_Count); pragma Inline (Draw); diff --git a/src/fltk-text_buffers.adb b/src/fltk-text_buffers.adb index 5fec63b..d41e4fe 100644 --- a/src/fltk-text_buffers.adb +++ b/src/fltk-text_buffers.adb @@ -910,24 +910,34 @@ package body FLTK.Text_Buffers is function Get_Selection (This : in Text_Buffer; Start, Finish : out Position) - return Boolean is + return Boolean + is + S, F : Interfaces.C.int; begin - return fl_text_buffer_selection_position - (This.Void_Ptr, - Interfaces.C.int (Start), - Interfaces.C.int (Finish)) /= 0; + if fl_text_buffer_selection_position (This.Void_Ptr, S, F) /= 0 then + Start := Position (S); + Finish := Position (F); + return True; + else + return False; + end if; end Get_Selection; function Get_Secondary_Selection (This : in Text_Buffer; Start, Finish : out Position) - return Boolean is + return Boolean + is + S, F : Interfaces.C.int; begin - return fl_text_buffer_secondary_selection_position - (This.Void_Ptr, - Interfaces.C.int (Start), - Interfaces.C.int (Finish)) /= 0; + if fl_text_buffer_secondary_selection_position (This.Void_Ptr, S, F) /= 0 then + Start := Position (S); + Finish := Position (F); + return True; + else + return False; + end if; end Get_Secondary_Selection; @@ -1111,13 +1121,21 @@ package body FLTK.Text_Buffers is Start_At : in Position; Item : in Character; Found_At : out Position) - return Boolean is + return Boolean + is + Place : Interfaces.C.int; begin - return fl_text_buffer_findchar_forward + if fl_text_buffer_findchar_forward (This.Void_Ptr, Interfaces.C.int (Start_At), Character'Pos (Item), - Interfaces.C.int (Found_At)) /= 0; + Place) /= 0 + then + Found_At := Position (Place); + return True; + else + return False; + end if; end Findchar_Forward; @@ -1126,13 +1144,21 @@ package body FLTK.Text_Buffers is Start_At : in Position; Item : in Character; Found_At : out Position) - return Boolean is + return Boolean + is + Place : Interfaces.C.int; begin - return fl_text_buffer_findchar_backward + if fl_text_buffer_findchar_backward (This.Void_Ptr, Interfaces.C.int (Start_At), Character'Pos (Item), - Interfaces.C.int (Found_At)) /= 0; + Place) /= 0 + then + Found_At := Position (Place); + return True; + else + return False; + end if; end Findchar_Backward; @@ -1142,14 +1168,22 @@ package body FLTK.Text_Buffers is Item : in String; Found_At : out Position; Match_Case : in Boolean := False) - return Boolean is + return Boolean + is + Place : Interfaces.C.int; begin - return fl_text_buffer_search_forward - (This.Void_Ptr, - Interfaces.C.int (Start_At), - Interfaces.C.To_C (Item), - Interfaces.C.int (Found_At), - Boolean'Pos (Match_Case)) /= 0; + if fl_text_buffer_search_forward + (This.Void_Ptr, + Interfaces.C.int (Start_At), + Interfaces.C.To_C (Item), + Place, + Boolean'Pos (Match_Case)) /= 0 + then + Found_At := Position (Place); + return True; + else + return False; + end if; end Search_Forward; @@ -1159,14 +1193,22 @@ package body FLTK.Text_Buffers is Item : in String; Found_At : out Position; Match_Case : in Boolean := False) - return Boolean is + return Boolean + is + Place : Interfaces.C.int; begin - return fl_text_buffer_search_backward - (This.Void_Ptr, - Interfaces.C.int (Start_At), - Interfaces.C.To_C (Item), - Interfaces.C.int (Found_At), - Boolean'Pos (Match_Case)) /= 0; + if fl_text_buffer_search_backward + (This.Void_Ptr, + Interfaces.C.int (Start_At), + Interfaces.C.To_C (Item), + Place, + Boolean'Pos (Match_Case)) /= 0 + then + Found_At := Position (Place); + return True; + else + return False; + end if; end Search_Backward; diff --git a/src/fltk-widgets-charts.adb b/src/fltk-widgets-charts.adb index 63bd604..573a011 100644 --- a/src/fltk-widgets-charts.adb +++ b/src/fltk-widgets-charts.adb @@ -231,7 +231,7 @@ package body FLTK.Widgets.Charts is (This : in out Chart; Data_Value : in Long_Float; Data_Label : in String := ""; - Data_Color : in Color := No_Color) is + Data_Color : in Color := Foreground_Color) is begin fl_chart_add (This.Void_Ptr, @@ -246,7 +246,7 @@ package body FLTK.Widgets.Charts is Position : in Natural; Data_Value : in Long_Float; Data_Label : in String := ""; - Data_Color : in Color := No_Color) is + Data_Color : in Color := Foreground_Color) is begin fl_chart_insert (This.Void_Ptr, @@ -262,7 +262,7 @@ package body FLTK.Widgets.Charts is Position : in Natural; Data_Value : in Long_Float; Data_Label : in String := ""; - Data_Color : in Color := No_Color) is + Data_Color : in Color := Foreground_Color) is begin fl_chart_replace (This.Void_Ptr, diff --git a/src/fltk-widgets-charts.ads b/src/fltk-widgets-charts.ads index 1369c4f..dad0f9f 100644 --- a/src/fltk-widgets-charts.ads +++ b/src/fltk-widgets-charts.ads @@ -27,21 +27,21 @@ package FLTK.Widgets.Charts is (This : in out Chart; Data_Value : in Long_Float; Data_Label : in String := ""; - Data_Color : in Color := No_Color); + Data_Color : in Color := Foreground_Color); procedure Insert (This : in out Chart; Position : in Natural; Data_Value : in Long_Float; Data_Label : in String := ""; - Data_Color : in Color := No_Color); + Data_Color : in Color := Foreground_Color); procedure Replace (This : in out Chart; Position : in Natural; Data_Value : in Long_Float; Data_Label : in String := ""; - Data_Color : in Color := No_Color); + Data_Color : in Color := Foreground_Color); procedure Clear (This : in out Chart); diff --git a/src/fltk-widgets-groups-text_displays-text_editors.adb b/src/fltk-widgets-groups-text_displays-text_editors.adb index 7c692c7..17776c4 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.adb +++ b/src/fltk-widgets-groups-text_displays-text_editors.adb @@ -362,8 +362,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is Ada_Editor : access Text_Editor'Class := Editor_Convert.To_Pointer (fl_widget_get_user_data (E)); Modi : Modifier := FLTK.Event.Last_Modifier; - Ada_Key : Key_Combo := - To_Ada (Interfaces.C.unsigned_long (K) + To_C (Modi)); + Actual_Key : Keypress := FLTK.Event.Last_Key; -- fuck you FLTK, give me the real code + Ada_Key : Key_Combo := To_Ada (To_C (Actual_Key) + To_C (Modi)); Found_Binding : Boolean := False; begin diff --git a/src/fltk-widgets-groups-windows-double-overlay.adb b/src/fltk-widgets-groups-windows-double-overlay.adb new file mode 100644 index 0000000..e61782a --- /dev/null +++ b/src/fltk-widgets-groups-windows-double-overlay.adb @@ -0,0 +1,262 @@ + + +with + + Interfaces.C, + System.Address_To_Access_Conversions; + +use type + + Interfaces.C.int, + System.Address; + + +package body FLTK.Widgets.Groups.Windows.Double.Overlay is + + + procedure overlay_window_set_draw_hook + (W, D : in System.Address); + pragma Import (C, overlay_window_set_draw_hook, "overlay_window_set_draw_hook"); + pragma Inline (overlay_window_set_draw_hook); + + procedure overlay_window_set_draw_overlay_hook + (W, D : in System.Address); + pragma Import (C, overlay_window_set_draw_overlay_hook, + "overlay_window_set_draw_overlay_hook"); + pragma Inline (overlay_window_set_draw_overlay_hook); + + procedure overlay_window_set_handle_hook + (W, H : in System.Address); + pragma Import (C, overlay_window_set_handle_hook, "overlay_window_set_handle_hook"); + pragma Inline (overlay_window_set_handle_hook); + + + + + function new_fl_overlay_window + (X, Y, W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_overlay_window, "new_fl_overlay_window"); + pragma Inline (new_fl_overlay_window); + + function new_fl_overlay_window2 + (W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_overlay_window2, "new_fl_overlay_window2"); + pragma Inline (new_fl_overlay_window2); + + procedure free_fl_overlay_window + (S : in System.Address); + pragma Import (C, free_fl_overlay_window, "free_fl_overlay_window"); + pragma Inline (free_fl_overlay_window); + + + + + procedure fl_overlay_window_show + (W : in System.Address); + pragma Import (C, fl_overlay_window_show, "fl_overlay_window_show"); + pragma Inline (fl_overlay_window_show); + + procedure fl_overlay_window_hide + (W : in System.Address); + pragma Import (C, fl_overlay_window_hide, "fl_overlay_window_hide"); + pragma Inline (fl_overlay_window_hide); + + procedure fl_overlay_window_flush + (W : in System.Address); + pragma Import (C, fl_overlay_window_flush, "fl_overlay_window_flush"); + pragma Inline (fl_overlay_window_flush); + + + + + function fl_overlay_window_can_do_overlay + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_overlay_window_can_do_overlay, "fl_overlay_window_can_do_overlay"); + pragma Inline (fl_overlay_window_can_do_overlay); + + + + + procedure fl_overlay_window_draw + (W : in System.Address); + pragma Import (C, fl_overlay_window_draw, "fl_overlay_window_draw"); + pragma Inline (fl_overlay_window_draw); + + procedure fl_overlay_window_redraw_overlay + (W : in System.Address); + pragma Import (C, fl_overlay_window_redraw_overlay, "fl_overlay_window_redraw_overlay"); + pragma Inline (fl_overlay_window_redraw_overlay); + + function fl_overlay_window_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_overlay_window_handle, "fl_overlay_window_handle"); + pragma Inline (fl_overlay_window_handle); + + + + + package Over_Convert is new System.Address_To_Access_Conversions (Overlay_Window'Class); + + + procedure Draw_Overlay_Hook + (U : in System.Address) + is + Overlay_Widget : access Overlay_Window'Class := + Over_Convert.To_Pointer (U); + begin + Overlay_Widget.Draw_Overlay; + end Draw_Overlay_Hook; + + + + + procedure Finalize + (This : in out Overlay_Window) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in Overlay_Window'Class + then + This.Clear; + free_fl_overlay_window (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (Double_Window (This)); + end Finalize; + + + + + -------------------- + -- Constructors -- + -------------------- + + package body Forge is + + function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return Overlay_Window is + begin + return This : Overlay_Window do + This.Void_Ptr := new_fl_overlay_window + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); + fl_group_end (This.Void_Ptr); + fl_widget_set_user_data + (This.Void_Ptr, + Widget_Convert.To_Address (This'Unchecked_Access)); + overlay_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + overlay_window_set_draw_overlay_hook (This.Void_Ptr, Draw_Overlay_Hook'Address); + overlay_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); + fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); + end return; + end Create; + + + function Create + (W, H : in Integer; + Text : in String := "") + return Overlay_Window is + begin + return This : Overlay_Window do + This.Void_Ptr := new_fl_overlay_window2 + (Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); + fl_group_end (This.Void_Ptr); + fl_widget_set_user_data + (This.Void_Ptr, + Widget_Convert.To_Address (This'Unchecked_Access)); + overlay_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + overlay_window_set_draw_overlay_hook (This.Void_Ptr, Draw_Overlay_Hook'Address); + overlay_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); + fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); + end return; + end Create; + + end Forge; + + + + + --------------- + -- Display -- + --------------- + + procedure Show + (This : in out Overlay_Window) is + begin + fl_overlay_window_show (This.Void_Ptr); + end Show; + + + procedure Hide + (This : in out Overlay_Window) is + begin + fl_overlay_window_hide (This.Void_Ptr); + end Hide; + + + procedure Flush + (This : in out Overlay_Window) is + begin + fl_overlay_window_flush (This.Void_Ptr); + end Flush; + + + + + ------------- + -- Other -- + ------------- + + function Can_Do_Overlay + (This : in Overlay_Window) + return Boolean is + begin + return fl_overlay_window_can_do_overlay (This.Void_Ptr) /= 0; + end Can_Do_Overlay; + + + + + ---------------------------------- + -- Drawing and Event Handling -- + ---------------------------------- + + procedure Draw + (This : in out Overlay_Window) is + begin + fl_overlay_window_draw (This.Void_Ptr); + end Draw; + + + procedure Redraw_Overlay + (This : in out Overlay_Window) is + begin + fl_overlay_window_redraw_overlay (This.Void_Ptr); + end Redraw_Overlay; + + + function Handle + (This : in out Overlay_Window; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_overlay_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + +end FLTK.Widgets.Groups.Windows.Double.Overlay; + diff --git a/src/fltk-widgets-groups-windows-double-overlay.ads b/src/fltk-widgets-groups-windows-double-overlay.ads new file mode 100644 index 0000000..fa7fe1d --- /dev/null +++ b/src/fltk-widgets-groups-windows-double-overlay.ads @@ -0,0 +1,110 @@ + + +package FLTK.Widgets.Groups.Windows.Double.Overlay is + + + ------------- + -- Types -- + ------------- + + type Overlay_Window is new Double_Window with private; + + type Overlay_Window_Reference (Data : not null access Overlay_Window'Class) is + limited null record with Implicit_Dereference => Data; + + + + + -------------------- + -- Constructors -- + -------------------- + + package Forge is + + function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return Overlay_Window; + + function Create + (W, H : in Integer; + Text : in String := "") + return Overlay_Window; + + end Forge; + + + + + --------------- + -- Display -- + --------------- + + procedure Show + (This : in out Overlay_Window); + + procedure Hide + (This : in out Overlay_Window); + + procedure Flush + (This : in out Overlay_Window); + + + + + ------------- + -- Other -- + ------------- + + function Can_Do_Overlay + (This : in Overlay_Window) + return Boolean; + + + + + ---------------------------------- + -- Drawing and Event Handling -- + ---------------------------------- + + procedure Draw + (This : in out Overlay_Window); + + procedure Draw_Overlay + (This : in out Overlay_Window) is null; + + procedure Redraw_Overlay + (This : in out Overlay_Window); + + function Handle + (This : in out Overlay_Window; + Event : in Event_Kind) + return Event_Outcome; + + +private + + + type Overlay_Window is new Double_Window with null record; + + overriding procedure Finalize + (This : in out Overlay_Window); + + + + + pragma Inline (Show); + pragma Inline (Hide); + pragma Inline (Flush); + + + pragma Inline (Can_Do_Overlay); + + + pragma Inline (Draw); + pragma Inline (Redraw_Overlay); + pragma Inline (Handle); + + +end FLTK.Widgets.Groups.Windows.Double.Overlay; + diff --git a/src/fltk-widgets-groups-windows-opengl.adb b/src/fltk-widgets-groups-windows-opengl.adb new file mode 100644 index 0000000..c877497 --- /dev/null +++ b/src/fltk-widgets-groups-windows-opengl.adb @@ -0,0 +1,502 @@ + + +with + + Interfaces.C, + System; + +use type + + Interfaces.C.int, + Interfaces.C.signed_char, + Interfaces.C.unsigned, + System.Address; + + +package body FLTK.Widgets.Groups.Windows.OpenGL is + + + procedure gl_window_set_draw_hook + (W, D : in System.Address); + pragma Import (C, gl_window_set_draw_hook, "gl_window_set_draw_hook"); + pragma Inline (gl_window_set_draw_hook); + + procedure gl_window_set_handle_hook + (W, H : in System.Address); + pragma Import (C, gl_window_set_handle_hook, "gl_window_set_handle_hook"); + pragma Inline (gl_window_set_handle_hook); + + + + + function new_fl_gl_window + (X, Y, W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_gl_window, "new_fl_gl_window"); + pragma Inline (new_fl_gl_window); + + function new_fl_gl_window2 + (W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_gl_window2, "new_fl_gl_window2"); + pragma Inline (new_fl_gl_window2); + + procedure free_fl_gl_window + (S : in System.Address); + pragma Import (C, free_fl_gl_window, "free_fl_gl_window"); + pragma Inline (free_fl_gl_window); + + + + + procedure fl_gl_window_show + (S : in System.Address); + pragma Import (C, fl_gl_window_show, "fl_gl_window_show"); + pragma Inline (fl_gl_window_show); + + procedure fl_gl_window_hide + (S : in System.Address); + pragma Import (C, fl_gl_window_hide, "fl_gl_window_hide"); + pragma Inline (fl_gl_window_hide); + + procedure fl_gl_window_hide_overlay + (S : in System.Address); + pragma Import (C, fl_gl_window_hide_overlay, "fl_gl_window_hide_overlay"); + pragma Inline (fl_gl_window_hide_overlay); + + procedure fl_gl_window_flush + (S : in System.Address); + pragma Import (C, fl_gl_window_flush, "fl_gl_window_flush"); + pragma Inline (fl_gl_window_flush); + + + + + function fl_gl_window_pixel_h + (S : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_gl_window_pixel_h, "fl_gl_window_pixel_h"); + pragma Inline (fl_gl_window_pixel_h); + + function fl_gl_window_pixel_w + (S : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_gl_window_pixel_w, "fl_gl_window_pixel_w"); + pragma Inline (fl_gl_window_pixel_w); + + function fl_gl_window_pixels_per_unit + (S : in System.Address) + return Interfaces.C.C_float; + pragma Import (C, fl_gl_window_pixels_per_unit, "fl_gl_window_pixels_per_unit"); + pragma Inline (fl_gl_window_pixels_per_unit); + + + + + function fl_gl_window_get_mode + (S : in System.Address) + return Mode_Mask; + pragma Import (C, fl_gl_window_get_mode, "fl_gl_window_get_mode"); + pragma Inline (fl_gl_window_get_mode); + + procedure fl_gl_window_set_mode + (S : in System.Address; + M : in Mode_Mask); + pragma Import (C, fl_gl_window_set_mode, "fl_gl_window_set_mode"); + pragma Inline (fl_gl_window_set_mode); + + function fl_gl_window_static_can_do + (M : in Mode_Mask) + return Interfaces.C.int; + pragma Import (C, fl_gl_window_static_can_do, "fl_gl_window_static_can_do"); + pragma Inline (fl_gl_window_static_can_do); + + function fl_gl_window_can_do + (S : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_gl_window_can_do, "fl_gl_window_can_do"); + pragma Inline (fl_gl_window_can_do); + + function fl_gl_window_can_do_overlay + (S : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_gl_window_can_do_overlay, "fl_gl_window_can_do_overlay"); + pragma Inline (fl_gl_window_can_do_overlay); + + + + + function fl_gl_window_get_context + (S : in System.Address) + return System.Address; + pragma Import (C, fl_gl_window_get_context, "fl_gl_window_get_context"); + pragma Inline (fl_gl_window_get_context); + + procedure fl_gl_window_set_context + (S, P : in System.Address; + D : in Interfaces.C.int); + pragma Import (C, fl_gl_window_set_context, "fl_gl_window_set_context"); + pragma Inline (fl_gl_window_set_context); + + function fl_gl_window_context_valid + (S : in System.Address) + return Interfaces.C.signed_char; + pragma Import (C, fl_gl_window_context_valid, "fl_gl_window_context_valid"); + pragma Inline (fl_gl_window_context_valid); + + procedure fl_gl_window_set_context_valid + (S : in System.Address; + V : in Interfaces.C.signed_char); + pragma Import (C, fl_gl_window_set_context_valid, "fl_gl_window_set_context_valid"); + pragma Inline (fl_gl_window_set_context_valid); + + function fl_gl_window_valid + (S : in System.Address) + return Interfaces.C.signed_char; + pragma Import (C, fl_gl_window_valid, "fl_gl_window_valid"); + pragma Inline (fl_gl_window_valid); + + procedure fl_gl_window_set_valid + (S : in System.Address; + V : in Interfaces.C.signed_char); + pragma Import (C, fl_gl_window_set_valid, "fl_gl_window_set_valid"); + pragma Inline (fl_gl_window_set_valid); + + procedure fl_gl_window_make_current + (S : in System.Address); + pragma Import (C, fl_gl_window_make_current, "fl_gl_window_make_current"); + pragma Inline (fl_gl_window_make_current); + + procedure fl_gl_window_make_overlay_current + (S : in System.Address); + pragma Import (C, fl_gl_window_make_overlay_current, "fl_gl_window_make_overlay_current"); + pragma Inline (fl_gl_window_make_overlay_current); + + + + + procedure fl_gl_window_ortho + (W : in System.Address); + pragma Import (C, fl_gl_window_ortho, "fl_gl_window_ortho"); + pragma Inline (fl_gl_window_ortho); + + procedure fl_gl_window_redraw_overlay + (W : in System.Address); + pragma Import (C, fl_gl_window_redraw_overlay, "fl_gl_window_redraw_overlay"); + pragma Inline (fl_gl_window_redraw_overlay); + + procedure fl_gl_window_swap_buffers + (W : in System.Address); + pragma Import (C, fl_gl_window_swap_buffers, "fl_gl_window_swap_buffers"); + pragma Inline (fl_gl_window_swap_buffers); + + procedure fl_gl_window_draw + (W : in System.Address); + pragma Import (C, fl_gl_window_draw, "fl_gl_window_draw"); + pragma Inline (fl_gl_window_draw); + + function fl_gl_window_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_gl_window_handle, "fl_gl_window_handle"); + pragma Inline (fl_gl_window_handle); + + + + + procedure Finalize + (This : in out GL_Window) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in GL_Window'Class + then + This.Clear; + free_fl_gl_window (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (Window (This)); + end Finalize; + + + + + -------------------- + -- Constructors -- + -------------------- + + package body Forge is + + function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return GL_Window is + begin + return This : GL_Window do + This.Void_Ptr := new_fl_gl_window + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); + fl_group_end (This.Void_Ptr); + fl_widget_set_user_data + (This.Void_Ptr, + Widget_Convert.To_Address (This'Unchecked_Access)); + gl_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + gl_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); + fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); + end return; + end Create; + + + function Create + (W, H : in Integer; + Text : in String := "") + return GL_Window is + begin + return This : GL_Window do + This.Void_Ptr := new_fl_gl_window2 + (Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); + fl_group_end (This.Void_Ptr); + fl_widget_set_user_data + (This.Void_Ptr, + Widget_Convert.To_Address (This'Unchecked_Access)); + gl_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + gl_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); + fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); + end return; + end Create; + + end Forge; + + + + + --------------- + -- Display -- + --------------- + + procedure Show + (This : in out GL_Window) is + begin + fl_gl_window_show (This.Void_Ptr); + end Show; + + + procedure Hide + (This : in out GL_Window) is + begin + fl_gl_window_hide (This.Void_Ptr); + end Hide; + + + procedure Hide_Overlay + (This : in out GL_Window) is + begin + fl_gl_window_hide_overlay (This.Void_Ptr); + end Hide_Overlay; + + + procedure Flush + (This : in out GL_Window) is + begin + fl_gl_window_flush (This.Void_Ptr); + end Flush; + + + + + ------------------ + -- Dimensions -- + ------------------ + + function Pixel_H + (This : in GL_Window) + return Integer is + begin + return Integer (fl_gl_window_pixel_h (This.Void_Ptr)); + end Pixel_H; + + + function Pixel_W + (This : in GL_Window) + return Integer is + begin + return Integer (fl_gl_window_pixel_w (This.Void_Ptr)); + end Pixel_W; + + + function Pixels_Per_Unit + (This : in GL_Window) + return Float is + begin + return Float (fl_gl_window_pixels_per_unit (This.Void_Ptr)); + end Pixels_Per_Unit; + + + + + -------------------- + -- OpenGL Modes -- + -------------------- + + function Get_Mode + (This : in GL_Window) + return Mode_Mask is + begin + return fl_gl_window_get_mode (This.Void_Ptr); + end Get_Mode; + + + procedure Set_Mode + (This : in out GL_Window; + Mask : in Mode_Mask) is + begin + fl_gl_window_set_mode (This.Void_Ptr, Mask); + end Set_Mode; + + + function Can_Do + (Mask : in Mode_Mask) + return Boolean is + begin + return fl_gl_window_static_can_do (Mask) /= 0; + end Can_Do; + + + function Can_Do + (This : in GL_Window) + return Boolean is + begin + return fl_gl_window_can_do (This.Void_Ptr) /= 0; + end Can_Do; + + + function Can_Do_Overlay + (This : in GL_Window) + return Boolean is + begin + return fl_gl_window_can_do_overlay (This.Void_Ptr) /= 0; + end Can_Do_Overlay; + + + + + ----------------------- + -- OpenGL Contexts -- + ----------------------- + + function Get_Context + (This : in GL_Window) + return System.Address is + begin + return fl_gl_window_get_context (This.Void_Ptr); + end Get_Context; + + + procedure Set_Context + (This : in out GL_Window; + Struct : in System.Address; + Destroy : in Boolean := False) is + begin + fl_gl_window_set_context (This.Void_Ptr, Struct, Boolean'Pos (Destroy)); + end Set_Context; + + + function Get_Context_Valid + (This : in GL_Window) + return Boolean is + begin + return fl_gl_window_context_valid (This.Void_Ptr) /= 0; + end Get_Context_Valid; + + + procedure Set_Context_Valid + (This : in out GL_Window; + Value : in Boolean) is + begin + fl_gl_window_set_context_valid (This.Void_Ptr, Boolean'Pos (Value)); + end Set_Context_Valid; + + + function Get_Valid + (This : in GL_Window) + return Boolean is + begin + return fl_gl_window_valid (This.Void_Ptr) /= 0; + end Get_Valid; + + + procedure Set_Valid + (This : in out GL_Window; + Value : in Boolean) is + begin + fl_gl_window_set_valid (This.Void_Ptr, Boolean'Pos (Value)); + end Set_Valid; + + + procedure Make_Current + (This : in out GL_Window) is + begin + fl_gl_window_make_current (This.Void_Ptr); + end Make_Current; + + + procedure Make_Overlay_Current + (This : in out GL_Window) is + begin + fl_gl_window_make_overlay_current (This.Void_Ptr); + end Make_Overlay_Current; + + + + + ---------------------------------- + -- Drawing and Event Handling -- + ---------------------------------- + + procedure Ortho + (This : in out GL_Window) is + begin + fl_gl_window_ortho (This.Void_Ptr); + end Ortho; + + + procedure Redraw_Overlay + (This : in out GL_Window) is + begin + fl_gl_window_redraw_overlay (This.Void_Ptr); + end Redraw_Overlay; + + + procedure Swap_Buffers + (This : in out GL_Window) is + begin + fl_gl_window_swap_buffers (This.Void_Ptr); + end Swap_Buffers; + + + procedure Draw + (This : in out GL_Window) is + begin + fl_gl_window_draw (This.Void_Ptr); + end Draw; + + + function Handle + (This : in out GL_Window; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_gl_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + +end FLTK.Widgets.Groups.Windows.OpenGL; + diff --git a/src/fltk-widgets-groups-windows-opengl.ads b/src/fltk-widgets-groups-windows-opengl.ads new file mode 100644 index 0000000..8d76884 --- /dev/null +++ b/src/fltk-widgets-groups-windows-opengl.ads @@ -0,0 +1,252 @@ + + +with + + System; + +private with + + Interfaces.C; + + +package FLTK.Widgets.Groups.Windows.OpenGL is + + + ------------- + -- Types -- + ------------- + + type GL_Window is new Window with private; + + type GL_Window_Reference (Data : not null access GL_Window'Class) is + limited null record with Implicit_Dereference => Data; + + -- RGB mode is achieved by Index being set to False + -- Single buffer mode is achieved by Double being set to False + type Mode_Mask is record + Index : Boolean := False; + Double : Boolean := False; + Accum : Boolean := False; + Alpha : Boolean := False; + Depth : Boolean := False; + Stencil : Boolean := False; + RGB8 : Boolean := False; + Multisample : Boolean := False; + Stereo : Boolean := False; + Fake_Single : Boolean := False; + OpenGL3 : Boolean := False; + end record; + + + + + -------------------- + -- Constructors -- + -------------------- + + package Forge is + + function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return GL_Window; + + function Create + (W, H : in Integer; + Text : in String := "") + return GL_Window; + + end Forge; + + + + + --------------- + -- Display -- + --------------- + + procedure Show + (This : in out GL_Window); + + procedure Hide + (This : in out GL_Window); + + procedure Hide_Overlay + (This : in out GL_Window); + + procedure Flush + (This : in out GL_Window); + + + + + ------------------ + -- Dimensions -- + ------------------ + + function Pixel_H + (This : in GL_Window) + return Integer; + + function Pixel_W + (This : in GL_Window) + return Integer; + + function Pixels_Per_Unit + (This : in GL_Window) + return Float; + + + + + -------------------- + -- OpenGL Modes -- + -------------------- + + function Get_Mode + (This : in GL_Window) + return Mode_Mask; + + procedure Set_Mode + (This : in out GL_Window; + Mask : in Mode_Mask); + + function Can_Do + (Mask : in Mode_Mask) + return Boolean; + + function Can_Do + (This : in GL_Window) + return Boolean; + + function Can_Do_Overlay + (This : in GL_Window) + return Boolean; + + + + + ----------------------- + -- OpenGL Contexts -- + ----------------------- + + function Get_Context + (This : in GL_Window) + return System.Address; + + procedure Set_Context + (This : in out GL_Window; + Struct : in System.Address; + Destroy : in Boolean := False); + + function Get_Context_Valid + (This : in GL_Window) + return Boolean; + + procedure Set_Context_Valid + (This : in out GL_Window; + Value : in Boolean); + + function Get_Valid + (This : in GL_Window) + return Boolean; + + procedure Set_Valid + (This : in out GL_Window; + Value : in Boolean); + + procedure Make_Current + (This : in out GL_Window); + + procedure Make_Overlay_Current + (This : in out GL_Window); + + + + + ---------------------------------- + -- Drawing and Event Handling -- + ---------------------------------- + + procedure Ortho + (This : in out GL_Window); + + procedure Redraw_Overlay + (This : in out GL_Window); + + procedure Swap_Buffers + (This : in out GL_Window); + + procedure Draw + (This : in out GL_Window); + + function Handle + (This : in out GL_Window; + Event : in Event_Kind) + return Event_Outcome; + + +private + + + type GL_Window is new Window with null record; + + overriding procedure Finalize + (This : in out GL_Window); + + + for Mode_Mask use record + Index at 0 range 0 .. 0; + Double at 0 range 1 .. 1; + Accum at 0 range 2 .. 2; + Alpha at 0 range 3 .. 3; + Depth at 0 range 4 .. 4; + Stencil at 0 range 5 .. 5; + RGB8 at 0 range 6 .. 6; + Multisample at 0 range 7 .. 7; + Stereo at 0 range 8 .. 8; + Fake_Single at 0 range 9 .. 9; + OpenGL3 at 0 range 10 .. Interfaces.C.unsigned'Size - 1; + end record; + + for Mode_Mask'Size use Interfaces.C.unsigned'Size; + + pragma Convention (C_Pass_By_Copy, Mode_Mask); + + + pragma Inline (Show); + pragma Inline (Hide); + pragma Inline (Hide_Overlay); + pragma Inline (Flush); + + + pragma Inline (Pixel_H); + pragma Inline (Pixel_W); + pragma Inline (Pixels_Per_Unit); + + + pragma Inline (Get_Mode); + pragma Inline (Set_Mode); + pragma Inline (Can_Do); + pragma Inline (Can_Do_Overlay); + + + pragma Inline (Get_Context); + pragma Inline (Set_Context); + pragma Inline (Get_Context_Valid); + pragma Inline (Set_Context_Valid); + pragma Inline (Get_Valid); + pragma Inline (Set_Valid); + pragma Inline (Make_Current); + pragma Inline (Make_Overlay_Current); + + + pragma Inline (Ortho); + pragma Inline (Redraw_Overlay); + pragma Inline (Swap_Buffers); + pragma Inline (Draw); + pragma Inline (Handle); + + +end FLTK.Widgets.Groups.Windows.OpenGL; + diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb index 08becbc..68b2301 100644 --- a/src/fltk-widgets-groups-windows.adb +++ b/src/fltk-widgets-groups-windows.adb @@ -516,7 +516,7 @@ package body FLTK.Widgets.Groups.Windows is procedure Set_Cursor (This : in out Window; - To : in Cursor) is + To : in Mouse_Cursor_Kind) is begin fl_window_set_cursor (This.Void_Ptr, Cursor_Values (To)); end Set_Cursor; @@ -537,7 +537,7 @@ package body FLTK.Widgets.Groups.Windows is procedure Set_Default_Cursor (This : in out Window; - To : in Cursor) is + To : in Mouse_Cursor_Kind) is begin fl_window_set_default_cursor (This.Void_Ptr, Cursor_Values (To)); end Set_Default_Cursor; diff --git a/src/fltk-widgets-groups-windows.ads b/src/fltk-widgets-groups-windows.ads index 5eac154..176aced 100644 --- a/src/fltk-widgets-groups-windows.ads +++ b/src/fltk-widgets-groups-windows.ads @@ -21,13 +21,6 @@ package FLTK.Widgets.Groups.Windows is type Modal_State is (Normal, Non_Modal, Modal); - type Cursor is - (Default, Arrow, Crosshair, Wait, - Insert, Hand, Help, Move, - NS, WE, NWSE, NESW, - N, NE, E, SE, S, SW, W, NW, - None); - @@ -114,7 +107,7 @@ package FLTK.Widgets.Groups.Windows is procedure Set_Cursor (This : in out Window; - To : in Cursor); + To : in Mouse_Cursor_Kind); procedure Set_Cursor (This : in out Window; @@ -123,7 +116,7 @@ package FLTK.Widgets.Groups.Windows is procedure Set_Default_Cursor (This : in out Window; - To : in Cursor); + To : in Mouse_Cursor_Kind); @@ -275,34 +268,6 @@ private - -- What delightful magic numbers FLTK cursors are! - -- (These correspond to the enum found in Enumerations.H) - Cursor_Values : array (Cursor) of Interfaces.C.int := - (Default => 0, - Arrow => 35, - Crosshair => 66, - Wait => 76, - Insert => 77, - Hand => 31, - Help => 47, - Move => 27, - NS => 78, - WE => 79, - NWSE => 80, - NESW => 81, - N => 70, - NE => 69, - E => 49, - SE => 8, - S => 9, - SW => 7, - W => 36, - NW => 68, - None => 255); - - - - Last_Current : access Window'Class := null; diff --git a/src/fltk-widgets-inputs-float.adb b/src/fltk-widgets-inputs-float.adb index f62fd00..b278b14 100644 --- a/src/fltk-widgets-inputs-float.adb +++ b/src/fltk-widgets-inputs-float.adb @@ -106,7 +106,9 @@ package body FLTK.Widgets.Inputs.Float is is Ptr : Interfaces.C.Strings.chars_ptr := fl_input_get_value (This.Void_Ptr); begin - if Ptr = Interfaces.C.Strings.Null_Ptr then + if Ptr = Interfaces.C.Strings.Null_Ptr or else + Interfaces.C.Strings.Value (Ptr) = "" + then return 0.0; else return Standard.Float'Value (Interfaces.C.Strings.Value (Ptr)); diff --git a/src/fltk-widgets-inputs-integer.adb b/src/fltk-widgets-inputs-integer.adb index d214a56..bc794e4 100644 --- a/src/fltk-widgets-inputs-integer.adb +++ b/src/fltk-widgets-inputs-integer.adb @@ -106,7 +106,9 @@ package body FLTK.Widgets.Inputs.Integer is is Ptr : Interfaces.C.Strings.chars_ptr := fl_input_get_value (This.Void_Ptr); begin - if Ptr = Interfaces.C.Strings.Null_Ptr then + if Ptr = Interfaces.C.Strings.Null_Ptr or else + Interfaces.C.Strings.Value (Ptr) = "" + then return 0; else return Standard.Integer'Value (Interfaces.C.Strings.Value (Ptr)); diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb index babf75f..890d847 100644 --- a/src/fltk-widgets-menus-menu_buttons.adb +++ b/src/fltk-widgets-menus-menu_buttons.adb @@ -53,6 +53,12 @@ package body FLTK.Widgets.Menus.Menu_Buttons is pragma Import (C, fl_menu_button_popup, "fl_menu_button_popup"); pragma Inline (fl_menu_button_popup); + function fl_menu_find_index2 + (M, I : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_menu_find_index2, "fl_menu_find_index2"); + pragma Inline (fl_menu_find_index2); + @@ -126,11 +132,12 @@ package body FLTK.Widgets.Menus.Menu_Buttons is function Popup (This : in out Menu_Button) - return FLTK.Menu_Items.Menu_Item is + return Extended_Index + is + use type Interfaces.C.int; + Ptr : System.Address := fl_menu_button_popup (This.Void_Ptr); begin - return Item : FLTK.Menu_Items.Menu_Item do - Wrapper (Item).Void_Ptr := fl_menu_button_popup (This.Void_Ptr); - end return; + return Extended_Index (fl_menu_find_index2 (This.Void_Ptr, Ptr) + 1); end Popup; diff --git a/src/fltk-widgets-menus-menu_buttons.ads b/src/fltk-widgets-menus-menu_buttons.ads index 31e4347..bccb8f7 100644 --- a/src/fltk-widgets-menus-menu_buttons.ads +++ b/src/fltk-widgets-menus-menu_buttons.ads @@ -37,7 +37,7 @@ package FLTK.Widgets.Menus.Menu_Buttons is function Popup (This : in out Menu_Button) - return FLTK.Menu_Items.Menu_Item; + return Extended_Index; diff --git a/src/fltk-widgets-menus.adb b/src/fltk-widgets-menus.adb index a4e3c01..d2bf2ff 100644 --- a/src/fltk-widgets-menus.adb +++ b/src/fltk-widgets-menus.adb @@ -333,27 +333,26 @@ package body FLTK.Widgets.Menus is Shortcut : in Key_Combo := No_Key; Flags : in Menu_Flag := Flag_Normal) is - Place : Interfaces.C.int; + Ret_Place : Interfaces.C.int; Callback, User_Data : System.Address := System.Null_Address; - New_Item : Item_Access; begin if Action /= null then Callback := Item_Hook'Address; User_Data := Callback_Convert.To_Address (Action); end if; - - Place := fl_menu_add + Ret_Place := fl_menu_add (This.Void_Ptr, Interfaces.C.To_C (Text), To_C (Shortcut), Callback, User_Data, Interfaces.C.unsigned_long (Flags)); - - New_Item := new FLTK.Menu_Items.Menu_Item; - Wrapper (New_Item.all).Void_Ptr := fl_menu_get_item (This.Void_Ptr, Place); - Wrapper (New_Item.all).Needs_Dealloc := False; - This.My_Items.Append (New_Item); + This.My_Items.Append (new FLTK.Menu_Items.Menu_Item); + Wrapper (This.My_Items.Last_Element.all).Needs_Dealloc := False; + if Flags + Flag_Submenu = Flags then + This.My_Items.Append (new FLTK.Menu_Items.Menu_Item); + Wrapper (This.My_Items.Last_Element.all).Needs_Dealloc := False; + end if; end Add; @@ -367,13 +366,11 @@ package body FLTK.Widgets.Menus is is Ret_Place : Interfaces.C.int; Callback, User_Data : System.Address := System.Null_Address; - New_Item : Item_Access; begin if Action /= null then Callback := Item_Hook'Address; User_Data := Callback_Convert.To_Address (Action); end if; - Ret_Place := fl_menu_insert (This.Void_Ptr, Interfaces.C.int (Place) - 1, @@ -382,11 +379,12 @@ package body FLTK.Widgets.Menus is Callback, User_Data, Interfaces.C.unsigned_long (Flags)); - - New_Item := new FLTK.Menu_Items.Menu_Item; - Wrapper (New_Item.all).Void_Ptr := fl_menu_get_item (This.Void_Ptr, Ret_Place); - Wrapper (New_Item.all).Needs_Dealloc := False; - This.My_Items.Insert (Positive (Ret_Place + 1), New_Item); + This.My_Items.Append (new FLTK.Menu_Items.Menu_Item); + Wrapper (This.My_Items.Last_Element.all).Needs_Dealloc := False; + if Flags + Flag_Submenu = Flags then + This.My_Items.Append (new FLTK.Menu_Items.Menu_Item); + Wrapper (This.My_Items.Last_Element.all).Needs_Dealloc := False; + end if; end Insert; @@ -406,7 +404,7 @@ package body FLTK.Widgets.Menus is for Item of This.My_Items loop Free_Item (Item); end loop; - This.My_Items := Item_Vectors.Empty_Vector; + This.My_Items.Clear; fl_menu_clear (This.Void_Ptr); end Clear; @@ -435,7 +433,11 @@ package body FLTK.Widgets.Menus is Place : in Index) return FLTK.Menu_Items.Menu_Item_Reference is begin - return (Data => This.My_Items.Element (Place)); + Wrapper (This.My_Items (Place).all).Void_Ptr := + fl_menu_get_item (This.Void_Ptr, Interfaces.C.int (Place) - 1); + return R : FLTK.Menu_Items.Menu_Item_Reference := (Data => This.My_Items (Place)) do + null; + end return; end Item; @@ -451,18 +453,36 @@ package body FLTK.Widgets.Menus is function Find_Item (This : in Menu; Name : in String) - return FLTK.Menu_Items.Menu_Item_Reference is + return FLTK.Menu_Items.Menu_Item_Reference + is + Place : Extended_Index := This.Find_Index (Name); begin - return (Data => This.My_Items.Element (This.Find_Index (Name))); + if Place = No_Index then + raise No_Reference; + end if; + Wrapper (This.My_Items (Place).all).Void_Ptr := + fl_menu_find_item (This.Void_Ptr, Interfaces.C.To_C (Name)); + return R : FLTK.Menu_Items.Menu_Item_Reference := (Data => This.My_Items (Place)) do + null; + end return; end Find_Item; function Find_Item (This : in Menu; Action : in Widget_Callback) - return FLTK.Menu_Items.Menu_Item_Reference is + return FLTK.Menu_Items.Menu_Item_Reference + is + Place : Extended_Index := This.Find_Index (Action); begin - return (Data => This.My_Items.Element (This.Find_Index (Action))); + if Place = No_Index then + raise No_Reference; + end if; + Wrapper (This.My_Items (Place).all).Void_Ptr := + fl_menu_find_item2 (This.Void_Ptr, Callback_Convert.To_Address (Action)); + return R : FLTK.Menu_Items.Menu_Item_Reference := (Data => This.My_Items (Place)) do + null; + end return; end Find_Item; @@ -568,9 +588,17 @@ package body FLTK.Widgets.Menus is function Chosen (This : in Menu) - return FLTK.Menu_Items.Menu_Item_Reference is + return FLTK.Menu_Items.Menu_Item_Reference + is + Place : Extended_Index := This.Chosen_Index; begin - return (Data => This.My_Items.Element (This.Chosen_Index)); + if Place = No_Index then + raise No_Reference; + end if; + Wrapper (This.My_Items (Place).all).Void_Ptr := fl_menu_mvalue (This.Void_Ptr); + return R : FLTK.Menu_Items.Menu_Item_Reference := (Data => This.My_Items (Place)) do + null; + end return; end Chosen; @@ -711,7 +739,7 @@ package body FLTK.Widgets.Menus is X, Y : in Integer; Title : in String := ""; Initial : in Extended_Index := No_Index) - return FLTK.Menu_Items.Menu_Item_Reference + return Extended_Index is Ptr : System.Address := fl_menu_popup (This.Void_Ptr, @@ -719,9 +747,8 @@ package body FLTK.Widgets.Menus is Interfaces.C.int (Y), Interfaces.C.To_C (Title), Interfaces.C.int (Initial) - 1); - Place : Index := Index (fl_menu_find_index2 (This.Void_Ptr, Ptr) + 1); begin - return (Data => This.My_Items.Element (Place)); + return Extended_Index (fl_menu_find_index2 (This.Void_Ptr, Ptr) + 1); end Popup; @@ -729,7 +756,7 @@ package body FLTK.Widgets.Menus is (This : in Menu; X, Y, W, H : in Integer; Initial : in Extended_Index := No_Index) - return FLTK.Menu_Items.Menu_Item_Reference + return Extended_Index is Ptr : System.Address := fl_menu_pulldown (This.Void_Ptr, @@ -738,9 +765,8 @@ package body FLTK.Widgets.Menus is Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.int (Initial) - 1); - Place : Index := Index (fl_menu_find_index2 (This.Void_Ptr, Ptr) + 1); begin - return (Data => This.My_Items.Element (Place)); + return Extended_Index (fl_menu_find_index2 (This.Void_Ptr, Ptr) + 1); end Pulldown; diff --git a/src/fltk-widgets-menus.ads b/src/fltk-widgets-menus.ads index 41eda3a..7eb56d2 100644 --- a/src/fltk-widgets-menus.ads +++ b/src/fltk-widgets-menus.ads @@ -25,7 +25,9 @@ package FLTK.Widgets.Menus is subtype Index is Positive; subtype Extended_Index is Natural; + No_Index : constant Extended_Index := Extended_Index'First; + No_Reference : exception; type Cursor is private; @@ -204,13 +206,13 @@ package FLTK.Widgets.Menus is X, Y : in Integer; Title : in String := ""; Initial : in Extended_Index := No_Index) - return FLTK.Menu_Items.Menu_Item_Reference; + return Extended_Index; function Pulldown (This : in Menu; X, Y, W, H : in Integer; Initial : in Extended_Index := No_Index) - return FLTK.Menu_Items.Menu_Item_Reference; + return Extended_Index; @@ -241,7 +243,8 @@ private type Item_Access is access FLTK.Menu_Items.Menu_Item; package Item_Vectors is new Ada.Containers.Vectors - (Index_Type => Positive, Element_Type => Item_Access); + (Index_Type => Positive, + Element_Type => Item_Access); type Menu is new Widget with record My_Items : Item_Vectors.Vector; diff --git a/src/fltk.ads b/src/fltk.ads index d71b399..1bacd6e 100644 --- a/src/fltk.ads +++ b/src/fltk.ads @@ -26,9 +26,52 @@ package FLTK is - type Color is new Natural; + -- Values scale from A/Black to X/White + type Greyscale is new Character range 'A' .. 'X'; + + type Color is mod 2**32; + type Color_Component is mod 256; - No_Color : constant Color; + type Color_Component_Array is array (Positive range <>) of aliased Color_Component; + + -- Examples of RGB colors + -- The lowest byte has to be 00 for the color to be RGB + RGB_Red_Color : constant Color := 16#ff000000#; + RGB_Green_Color : constant Color := 16#00ff0000#; + RGB_Blue_Color : constant Color := 16#0000ff00#; + RGB_White_Color : constant Color := 16#ffffff00#; + + -- Standard colors used in widgets + Foreground_Color : constant Color := 0; + Background2_Color : constant Color := 7; + Inactive_Color : constant Color := 8; + Selection_Color : constant Color := 15; + + -- Standard boxtype colors + Grey0_Color : constant Color := 32; + Dark3_Color : constant Color := 39; + Dark2_Color : constant Color := 45; + Dark1_Color : constant Color := 47; + Background_Color : constant Color := 49; + Light1_Color : constant Color := 50; + Light2_Color : constant Color := 52; + Light3_Color : constant Color := 54; + + -- Color cube colors + Black_Color : constant Color := 56; + Red_Color : constant Color := 88; + Green_Color : constant Color := 63; + Yellow_Color : constant Color := 95; + Blue_Color : constant Color := 216; + Magenta_Color : constant Color := 248; + Cyan_Color : constant Color := 223; + Dark_Red_Color : constant Color := 72; + Dark_Green_Color : constant Color := 60; + Dark_Yellow_Color : constant Color := 76; + Dark_Blue_Color : constant Color := 136; + Dark_Magenta_Color : constant Color := 152; + Dark_Cyan_Color : constant Color := 140; + White_Color : constant Color := 255; @@ -43,6 +86,32 @@ package FLTK is + type Mouse_Cursor_Kind is + (Default_Mouse, + Arrow_Mouse, + Crosshair_Mouse, + Wait_Mouse, + Insert_Mouse, + Hand_Mouse, + Help_Mouse, + Move_Mouse, + NS_Mouse, + WE_Mouse, + NWSE_Mouse, + NESW_Mouse, + N_Mouse, + NE_Mouse, + E_Mouse, + SE_Mouse, + S_Mouse, + SW_Mouse, + W_Mouse, + NW_Mouse, + None_Mouse); + + + + type Keypress is private; subtype Pressable_Key is Character range Character'Val (32) .. Character'Val (126); function Press (Key : in Pressable_Key) return Keypress; @@ -298,6 +367,7 @@ private pragma Linker_Options ("-lfltk"); pragma Linker_Options ("-lfltk_images"); + pragma Linker_Options ("-lfltk_gl"); @@ -314,7 +384,8 @@ private - No_Color : constant Color := 0; + for Color_Component_Array'Component_Size use Interfaces.C.CHAR_BIT; + pragma Convention (C, Color_Component_Array); @@ -329,6 +400,34 @@ private + -- What delightful magic numbers FLTK cursors are! + -- (These correspond to the enum found in Enumerations.H) + Cursor_Values : array (Mouse_Cursor_Kind) of Interfaces.C.int := + (Default_Mouse => 0, + Arrow_Mouse => 35, + Crosshair_Mouse => 66, + Wait_Mouse => 76, + Insert_Mouse => 77, + Hand_Mouse => 31, + Help_Mouse => 47, + Move_Mouse => 27, + NS_Mouse => 78, + WE_Mouse => 79, + NWSE_Mouse => 80, + NESW_Mouse => 81, + N_Mouse => 70, + NE_Mouse => 69, + E_Mouse => 49, + SE_Mouse => 8, + S_Mouse => 9, + SW_Mouse => 7, + W_Mouse => 36, + NW_Mouse => 68, + None_Mouse => 255); + + + + type Keypress is new Interfaces.Unsigned_16; type Modifier is new Interfaces.Unsigned_16; type Key_Combo is |