Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

63 wiersze
1.6 KiB

  1. /*
  2. * libcaca Java bindings for libcaca
  3. * Copyright (c) 2009 Adrien Grand <jpountz@dinauz.org>
  4. *
  5. * $Id$
  6. *
  7. * This library is free software. It comes without any warranty, to
  8. * the extent permitted by applicable law. You can redistribute it
  9. * and/or modify it under the terms of the Do What The Fuck You Want
  10. * To Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "org_zoy_caca_Attribute.h"
  14. #include "caca.h"
  15. JNIEXPORT jbyte JNICALL
  16. Java_org_zoy_caca_Attribute_attributeToAnsi(JNIEnv *env, jclass cls, jint attr)
  17. {
  18. return caca_attr_to_ansi(attr);
  19. }
  20. JNIEXPORT jbyte JNICALL
  21. Java_org_zoy_caca_Attribute_attributeToAnsiForeground(JNIEnv *env, jclass cls, jint attr)
  22. {
  23. return caca_attr_to_ansi_fg(attr);
  24. }
  25. JNIEXPORT jbyte JNICALL
  26. Java_org_zoy_caca_Attribute_attributeToAnsiBackground(JNIEnv *env, jclass cls, jint attr)
  27. {
  28. return caca_attr_to_ansi_bg(attr);
  29. }
  30. JNIEXPORT jshort JNICALL
  31. Java_org_zoy_caca_Attribute_attributeToRgb12Foreground(JNIEnv *env, jclass cls, jint attr)
  32. {
  33. return caca_attr_to_rgb12_fg(attr);
  34. }
  35. JNIEXPORT jshort JNICALL
  36. Java_org_zoy_caca_Attribute_attributeToRgb12Background(JNIEnv *env, jclass cls, jint attr)
  37. {
  38. return caca_attr_to_rgb12_bg(attr);
  39. }
  40. JNIEXPORT jbyteArray JNICALL
  41. Java_org_zoy_caca_Attribute_attributeToArgb64(JNIEnv *env, jclass cls, jint attr)
  42. {
  43. jbyteArray ret;
  44. jbyte *elems;
  45. ret = (*env)->NewByteArray(env, 8);
  46. elems = (*env)->GetByteArrayElements(env, ret, 0);
  47. caca_attr_to_argb64(attr, elems);
  48. (*env)->ReleaseByteArrayElements(env, ret, elems, 0);
  49. return ret;
  50. }