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