Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. namespace GraphicsHelpers
  18. {
  19. jobject createPaint (Graphics::ResamplingQuality quality)
  20. {
  21. jint constructorFlags = 1 /*ANTI_ALIAS_FLAG*/
  22. | 4 /*DITHER_FLAG*/
  23. | 128 /*SUBPIXEL_TEXT_FLAG*/;
  24. if (quality > Graphics::lowResamplingQuality)
  25. constructorFlags |= 2; /*FILTER_BITMAP_FLAG*/
  26. return getEnv()->NewObject (Paint, Paint.constructor, constructorFlags);
  27. }
  28. const jobject createMatrix (JNIEnv* env, const AffineTransform& t)
  29. {
  30. jobject m = env->NewObject (Matrix, Matrix.constructor);
  31. jfloat values[9] = { t.mat00, t.mat01, t.mat02,
  32. t.mat10, t.mat11, t.mat12,
  33. 0.0f, 0.0f, 1.0f };
  34. jfloatArray javaArray = env->NewFloatArray (9);
  35. env->SetFloatArrayRegion (javaArray, 0, 9, values);
  36. env->CallVoidMethod (m, Matrix.setValues, javaArray);
  37. env->DeleteLocalRef (javaArray);
  38. return m;
  39. }
  40. }
  41. ImagePixelData::Ptr NativeImageType::create (Image::PixelFormat format, int width, int height, bool clearImage) const
  42. {
  43. return SoftwareImageType().create (format, width, height, clearImage);
  44. }