1 | /* |
---|
2 | * CuculSharp .NET bindings for libcucul |
---|
3 | * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id: Cucul.cs 1428 2006-11-23 20:22:03Z jylam $ |
---|
7 | * |
---|
8 | * This library is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the Do What The Fuck You Want To |
---|
10 | * Public License, Version 2, as published by Sam Hocevar. See |
---|
11 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
12 | */ |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | using System; |
---|
17 | using System.Runtime.InteropServices; |
---|
18 | using System.Security; |
---|
19 | |
---|
20 | |
---|
21 | namespace libCucul |
---|
22 | { |
---|
23 | |
---|
24 | public unsafe class Cucul : IDisposable |
---|
25 | { |
---|
26 | /* Fixme */ |
---|
27 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
28 | public static extern IntPtr cucul_create_canvas(int w, int h); |
---|
29 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
30 | public static extern Int32 cucul_get_canvas_width(IntPtr qq); |
---|
31 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
32 | public static extern Int32 cucul_get_canvas_height(IntPtr qq); |
---|
33 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
34 | public static extern Int32 cucul_set_canvas_size(IntPtr qq, int w, int h); |
---|
35 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
36 | public static extern Int32 cucul_rand(int min, int max); |
---|
37 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
38 | public static extern Int32 cucul_free_canvas(IntPtr qq); |
---|
39 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
40 | public static extern Int32 cucul_set_color(IntPtr qq, int fg, int bg); |
---|
41 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
42 | public static extern Int32 cucul_set_truecolor(IntPtr qq, Int32 fg, Int32 bg); |
---|
43 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
44 | public static extern Int32 cucul_putchar(IntPtr qq, int x, int y, char c); |
---|
45 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
46 | public static extern Int32 cucul_putstr(IntPtr qq, int x , int y, String c); |
---|
47 | |
---|
48 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
49 | public static extern Int32 cucul_clear_canvas(IntPtr qq); |
---|
50 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
51 | public static extern Int32 cucul_blit(IntPtr qq, Int32 x, Int32 y, IntPtr qq1, IntPtr qq2); |
---|
52 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
53 | public static extern Int32 cucul_draw_line(IntPtr qq, Int32 x1, Int32 y1, Int32 x2, Int32 y2, Int32 c); |
---|
54 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
55 | public static extern Int32 cucul_draw_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n, IntPtr c); |
---|
56 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
57 | public static extern Int32 cucul_draw_thin_line(IntPtr qq, Int32 x1, Int32 y1, Int32 x2, Int32 y2); |
---|
58 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
59 | public static extern Int32 cucul_draw_thin_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n); |
---|
60 | |
---|
61 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
62 | public static extern Int32 cucul_gotoxy(IntPtr qq, Int32 x, Int32 y); |
---|
63 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
64 | public static extern Int32 cucul_get_cursor_x(IntPtr qq); |
---|
65 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
66 | public static extern Int32 cucul_get_cursor_y(IntPtr qq); |
---|
67 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
68 | public static extern Int32 cucul_put_char(IntPtr qq, Int32 x, Int32 y, Int32 c); |
---|
69 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
70 | public static extern Int32 cucul_get_char(IntPtr qq, Int32 x, Int32 y); |
---|
71 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
72 | public static extern Int32 cucul_put_str(IntPtr qq, Int32 x, Int32 y, string c); |
---|
73 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
74 | public static extern Int32 cucul_get_attr(IntPtr qq, Int32 x, Int32 y); |
---|
75 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
76 | public static extern Int32 cucul_set_attr(IntPtr qq, Int32 a); |
---|
77 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
78 | public static extern Int32 cucul_put_attr(IntPtr qq, Int32 x, Int32 y, Int32 a); |
---|
79 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
80 | public static extern Int32 cucul_set_color_ansi(IntPtr qq, Int32 fg, Int32 bg); |
---|
81 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
82 | public static extern Int32 cucul_set_color_argb(IntPtr qq, Int32 fg, Int32 bg); |
---|
83 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
84 | public static extern Int32 cucul_set_canvas_handle(IntPtr qq, Int32 x, Int32 y); |
---|
85 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
86 | public static extern Int32 cucul_get_canvas_handle_x(IntPtr qq); |
---|
87 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
88 | public static extern Int32 cucul_get_canvas_handle_y(IntPtr qq); |
---|
89 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
90 | public static extern Int32 cucul_set_canvas_boundaries(IntPtr qq, Int32 x, Int32 y, |
---|
91 | Int32 h, Int32 w); |
---|
92 | |
---|
93 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
94 | public static extern Int32 cucul_invert(IntPtr qq); |
---|
95 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
96 | public static extern Int32 cucul_flip(IntPtr qq); |
---|
97 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
98 | public static extern Int32 cucul_flop(IntPtr qq); |
---|
99 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
100 | public static extern Int32 cucul_rotate(IntPtr qq); |
---|
101 | |
---|
102 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
103 | public static extern Int32 cucul_attr_to_ansi(Int64 a); |
---|
104 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
105 | public static extern Int32 cucul_attr_to_ansi_fg(Int64 a); |
---|
106 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
107 | public static extern Int32 cucul_attr_to_ansi_bg(Int64 a); |
---|
108 | |
---|
109 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
110 | public static extern Int32 cucul_get_frame_count(IntPtr qq); |
---|
111 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
112 | public static extern Int32 cucul_set_frame(IntPtr qq, Int32 f); |
---|
113 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
114 | public static extern string cucul_get_frame_name(IntPtr qq); |
---|
115 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
116 | public static extern Int32 cucul_set_frame_name(IntPtr qq, string n); |
---|
117 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
118 | public static extern Int32 cucul_create_frame(IntPtr qq, Int32 f); |
---|
119 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
120 | public static extern Int32 cucul_free_frame(IntPtr qq, Int32 f); |
---|
121 | |
---|
122 | |
---|
123 | /* Constants */ |
---|
124 | |
---|
125 | public const Int32 CUCUL_BLACK = 0x00; /**< The colour index for black. */ |
---|
126 | public const Int32 CUCUL_BLUE = 0x01; /**< The colour index for blue. */ |
---|
127 | public const Int32 CUCUL_GREEN = 0x02; /**< The colour index for green. */ |
---|
128 | public const Int32 CUCUL_CYAN = 0x03; /**< The colour index for cyan. */ |
---|
129 | public const Int32 CUCUL_RED = 0x04; /**< The colour index for red. */ |
---|
130 | public const Int32 CUCUL_MAGENTA = 0x05; /**< The colour index for magenta. */ |
---|
131 | public const Int32 CUCUL_BROWN = 0x06; /**< The colour index for brown. */ |
---|
132 | public const Int32 CUCUL_LIGHTGRAY = 0x07; /**< The colour index for light gray. */ |
---|
133 | public const Int32 CUCUL_DARKGRAY = 0x08; /**< The colour index for dark gray. */ |
---|
134 | public const Int32 CUCUL_LIGHTBLUE = 0x09; /**< The colour index for blue. */ |
---|
135 | public const Int32 CUCUL_LIGHTGREEN = 0x0a; /**< The colour index for light green. */ |
---|
136 | public const Int32 CUCUL_LIGHTCYAN = 0x0b; /**< The colour index for light cyan. */ |
---|
137 | public const Int32 CUCUL_LIGHTRED = 0x0c; /**< The colour index for light red. */ |
---|
138 | public const Int32 CUCUL_LIGHTMAGENTA = 0x0d; /**< The colour index for light magenta. */ |
---|
139 | public const Int32 CUCUL_YELLOW = 0x0e; /**< The colour index for yellow. */ |
---|
140 | public const Int32 CUCUL_WHITE = 0x0f; /**< The colour index for white. */ |
---|
141 | public const Int32 CUCUL_DEFAULT = 0x10; /**< The output driver's default colour. */ |
---|
142 | public const Int32 CUCUL_TRANSPARENT = 0x20; /**< The transparent colour. */ |
---|
143 | |
---|
144 | public const Int32 CUCUL_BOLD = 0x01; /**< The style mask for bold. */ |
---|
145 | public const Int32 CUCUL_ITALICS = 0x02; /**< The style mask for italics. */ |
---|
146 | public const Int32 CUCUL_UNDERLINE = 0x04; /**< The style mask for underline. */ |
---|
147 | public const Int32 CUCUL_BLINK = 0x08; /**< The style mask for blink. */ |
---|
148 | |
---|
149 | |
---|
150 | IntPtr qq; |
---|
151 | |
---|
152 | public Cucul() |
---|
153 | { |
---|
154 | qq = cucul_create_canvas(0, 0); |
---|
155 | } |
---|
156 | public void Dispose() |
---|
157 | { |
---|
158 | cucul_free_canvas(qq); |
---|
159 | GC.SuppressFinalize(this); |
---|
160 | } |
---|
161 | public Cucul(Int32 w, Int32 h) |
---|
162 | { |
---|
163 | qq = cucul_create_canvas(w, h); |
---|
164 | } |
---|
165 | public Int32 getWidth() |
---|
166 | { |
---|
167 | return cucul_get_canvas_width(qq); |
---|
168 | } |
---|
169 | public Int32 getHeight() |
---|
170 | { |
---|
171 | return cucul_get_canvas_height(qq); |
---|
172 | } |
---|
173 | public Int32 setSize(Int32 w, Int32 h) |
---|
174 | { |
---|
175 | return cucul_set_canvas_size(qq, w, h); |
---|
176 | } |
---|
177 | public static Int32 Rand(Int32 min, Int32 max) |
---|
178 | { |
---|
179 | return cucul_rand(min, max); |
---|
180 | } |
---|
181 | public Int32 setColor(int fg, int bg) |
---|
182 | { |
---|
183 | return cucul_set_color(qq, fg, bg); |
---|
184 | } |
---|
185 | public Int32 setTruecolor(Int32 fg, Int32 bg) |
---|
186 | { |
---|
187 | return cucul_set_truecolor(qq, fg, bg); |
---|
188 | } |
---|
189 | public Int32 putChar(int x, int y, char c) |
---|
190 | { |
---|
191 | return cucul_putchar(qq, x, y, c); |
---|
192 | } |
---|
193 | public Int32 Clear() |
---|
194 | { |
---|
195 | return cucul_clear_canvas(qq); |
---|
196 | } |
---|
197 | public Int32 Blit(int x, int y, Cucul qq1, Cucul qq2) |
---|
198 | { |
---|
199 | return cucul_blit(qq, x, y, qq1.get_cucul_t(), qq2.get_cucul_t()); |
---|
200 | } |
---|
201 | public Int32 drawLine(Int32 x1, Int32 y1, Int32 x2, Int32 y2, Int32 c) |
---|
202 | { |
---|
203 | return cucul_draw_line(qq, x1, y1, x2, y2, c); |
---|
204 | } |
---|
205 | public Int32 putStr(Int32 x, Int32 y, string c) |
---|
206 | { |
---|
207 | return cucul_putstr(qq, x, y, c); |
---|
208 | } |
---|
209 | public Int32 gotoXY(Int32 x, Int32 y) |
---|
210 | { |
---|
211 | return cucul_gotoxy(qq, x, y); |
---|
212 | } |
---|
213 | public Int32 getCursorX() |
---|
214 | { |
---|
215 | return cucul_get_cursor_x(qq); |
---|
216 | } |
---|
217 | public Int32 getCursorY() |
---|
218 | { |
---|
219 | return cucul_get_cursor_y(qq); |
---|
220 | } |
---|
221 | public Int32 getChar(Int32 x, Int32 y) |
---|
222 | { |
---|
223 | return cucul_get_char(qq, x, y); |
---|
224 | } |
---|
225 | public Int32 getAttr(Int32 x, Int32 y) |
---|
226 | { |
---|
227 | return cucul_get_attr(qq, x, y); |
---|
228 | } |
---|
229 | public Int32 setAttr(Int32 a) |
---|
230 | { |
---|
231 | return cucul_set_attr(qq, a); |
---|
232 | } |
---|
233 | public Int32 setAttr(Int32 x, Int32 y, Int32 a) |
---|
234 | { |
---|
235 | return cucul_put_attr(qq, x, y, a); |
---|
236 | } |
---|
237 | public Int32 setColorANSI(Int32 fg, Int32 bg) |
---|
238 | { |
---|
239 | return cucul_set_color_ansi(qq, fg, bg); |
---|
240 | } |
---|
241 | public Int32 setColorARGB(Int32 fg, Int32 bg) |
---|
242 | { |
---|
243 | return cucul_set_color_ansi(qq, fg, bg); |
---|
244 | } |
---|
245 | public Int32 setCanvasHandle(Int32 x, Int32 y) |
---|
246 | { |
---|
247 | return cucul_set_canvas_handle(qq, x, y); |
---|
248 | } |
---|
249 | public Int32 getCanvasHandleX() |
---|
250 | { |
---|
251 | return cucul_get_canvas_handle_x(qq); |
---|
252 | } |
---|
253 | public Int32 getCanvasHandleY() |
---|
254 | { |
---|
255 | return cucul_get_canvas_handle_y(qq); |
---|
256 | } |
---|
257 | public Int32 setCanvasHandleY(Int32 x, Int32 y, Int32 h, Int32 w) |
---|
258 | { |
---|
259 | return cucul_set_canvas_boundaries(qq, x, y, h, w); |
---|
260 | } |
---|
261 | |
---|
262 | |
---|
263 | public Int32 Invert() |
---|
264 | { |
---|
265 | return cucul_invert(qq); |
---|
266 | } |
---|
267 | public Int32 Flip() |
---|
268 | { |
---|
269 | return cucul_flip(qq); |
---|
270 | } |
---|
271 | public Int32 Flop() |
---|
272 | { |
---|
273 | return cucul_flop(qq); |
---|
274 | } |
---|
275 | public Int32 Rotate() |
---|
276 | { |
---|
277 | return cucul_rotate(qq); |
---|
278 | } |
---|
279 | |
---|
280 | public Int32 AttrToANSI(Int64 a) |
---|
281 | { |
---|
282 | return cucul_attr_to_ansi(a); |
---|
283 | } |
---|
284 | public Int32 AttrToANSIFg(Int64 a) |
---|
285 | { |
---|
286 | return cucul_attr_to_ansi_fg(a); |
---|
287 | } |
---|
288 | public Int32 AttrToANSIBg(Int64 a) |
---|
289 | { |
---|
290 | return cucul_attr_to_ansi_bg(a); |
---|
291 | } |
---|
292 | |
---|
293 | |
---|
294 | |
---|
295 | |
---|
296 | public Int32 getFrameCount() |
---|
297 | { |
---|
298 | return cucul_get_frame_count(qq); |
---|
299 | } |
---|
300 | public Int32 setFrame(Int32 f) |
---|
301 | { |
---|
302 | return cucul_set_frame(qq, f); |
---|
303 | } |
---|
304 | public string getFrameName() |
---|
305 | { |
---|
306 | return cucul_get_frame_name(qq); |
---|
307 | } |
---|
308 | public Int32 setFrameName(string n) |
---|
309 | { |
---|
310 | return cucul_set_frame_name(qq, n); |
---|
311 | } |
---|
312 | public Int32 createFrame(Int32 f) |
---|
313 | { |
---|
314 | return cucul_create_frame(qq, f); |
---|
315 | } |
---|
316 | public Int32 freeFrame(Int32 f) |
---|
317 | { |
---|
318 | return cucul_free_frame(qq, f); |
---|
319 | } |
---|
320 | |
---|
321 | |
---|
322 | /* Privates methods, are not meant to be called by user*/ |
---|
323 | |
---|
324 | public IntPtr get_cucul_t() |
---|
325 | { |
---|
326 | return qq; |
---|
327 | } |
---|
328 | } |
---|
329 | |
---|
330 | |
---|
331 | |
---|
332 | public unsafe class Dither : IDisposable |
---|
333 | { |
---|
334 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
335 | public static extern IntPtr cucul_create_dither(Int32 bpp, Int32 w, |
---|
336 | Int32 h, Int32 pitch, |
---|
337 | Int64 rmask, |
---|
338 | Int64 gmask, |
---|
339 | Int64 bmask, |
---|
340 | Int64 amask); |
---|
341 | |
---|
342 | |
---|
343 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
344 | public static extern Int32 cucul_set_dither_palette(IntPtr d, |
---|
345 | Int32[] r, Int32[] g, |
---|
346 | Int32[] b, Int32[] a); |
---|
347 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
348 | public static extern Int32 cucul_set_dither_brightness(IntPtr d, float b); |
---|
349 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
350 | public static extern Int32 cucul_set_dither_gamma(IntPtr d, float g); |
---|
351 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
352 | public static extern Int32 cucul_set_dither_contrast(IntPtr d, float c); |
---|
353 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
354 | public static extern Int32 cucul_set_dither_invert(IntPtr d, int i); |
---|
355 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
356 | public static extern Int32 cucul_set_dither_antialias(IntPtr d, string s); |
---|
357 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
358 | public static extern string[] cucul_get_dither_antialias_list(IntPtr d); |
---|
359 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
360 | public static extern Int32 cucul_set_dither_color(IntPtr d, string s); |
---|
361 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
362 | public static extern string[] cucul_get_dither_color_list(IntPtr d); |
---|
363 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
364 | public static extern Int32 cucul_set_dither_charset(IntPtr d, string s); |
---|
365 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
366 | public static extern string[] cucul_get_dither_charset_list(IntPtr d); |
---|
367 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
368 | public static extern Int32 cucul_set_dither_mode(IntPtr d, string s); |
---|
369 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
370 | public static extern string[] cucul_get_dither_mode_list(IntPtr d); |
---|
371 | [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
372 | public static extern Int32 cucul_free_dither(IntPtr d); |
---|
373 | |
---|
374 | /* FIXME [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
---|
375 | Int32 cucul_dither_bitmap(Cucul c,Int32 x, Int32 y, Int32 w , Int32 y, |
---|
376 | IntPtr d2, void *);*/ |
---|
377 | |
---|
378 | |
---|
379 | |
---|
380 | IntPtr dither; |
---|
381 | |
---|
382 | public Dither(Int32 bpp, Int32 w,Int32 h, Int32 pitch, |
---|
383 | Int64 rmask, Int64 gmask,Int64 bmask, Int64 amask) |
---|
384 | { |
---|
385 | dither = cucul_create_dither(bpp, w, h, pitch, rmask, gmask, bmask, amask); |
---|
386 | } |
---|
387 | public void Dispose() |
---|
388 | { |
---|
389 | cucul_free_dither(dither); |
---|
390 | GC.SuppressFinalize(this); |
---|
391 | } |
---|
392 | public Int32 setBrightness(float b) |
---|
393 | { |
---|
394 | return cucul_set_dither_brightness(dither, b); |
---|
395 | } |
---|
396 | public Int32 setGamma(float g) |
---|
397 | { |
---|
398 | return cucul_set_dither_gamma(dither, g); |
---|
399 | } |
---|
400 | public Int32 setContrast(float c) |
---|
401 | { |
---|
402 | return cucul_set_dither_contrast(dither, c); |
---|
403 | } |
---|
404 | public Int32 setInvert(Int32 i) |
---|
405 | { |
---|
406 | return cucul_set_dither_invert(dither, i); |
---|
407 | } |
---|
408 | public Int32 setAntialias(string s) |
---|
409 | { |
---|
410 | return cucul_set_dither_antialias(dither, s); |
---|
411 | } |
---|
412 | public Int32 setColor(string s) |
---|
413 | { |
---|
414 | return cucul_set_dither_color(dither, s); |
---|
415 | } |
---|
416 | public Int32 setCharset(string s) |
---|
417 | { |
---|
418 | return cucul_set_dither_charset(dither, s); |
---|
419 | } |
---|
420 | public Int32 setMode(string s) |
---|
421 | { |
---|
422 | return cucul_set_dither_mode(dither, s); |
---|
423 | } |
---|
424 | /* <FIXME> */ |
---|
425 | public string[] getAntialiasList() |
---|
426 | { |
---|
427 | return cucul_get_dither_antialias_list(dither); |
---|
428 | } |
---|
429 | public string[] getColorList() |
---|
430 | { |
---|
431 | return cucul_get_dither_color_list(dither); |
---|
432 | } |
---|
433 | public string[] getCharsetList() |
---|
434 | { |
---|
435 | return cucul_get_dither_charset_list(dither); |
---|
436 | } |
---|
437 | public string[] getModeList() |
---|
438 | { |
---|
439 | return cucul_get_dither_mode_list(dither); |
---|
440 | } |
---|
441 | /* </FIXME> */ |
---|
442 | |
---|
443 | } |
---|
444 | |
---|
445 | |
---|
446 | |
---|
447 | |
---|
448 | |
---|
449 | |
---|
450 | |
---|
451 | |
---|
452 | |
---|
453 | |
---|
454 | |
---|
455 | |
---|
456 | } |
---|
457 | |
---|