Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

org_zoy_caca_Attribute.c 1.6 KiB

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