예제 #1
0
        private void LogVersion()
        {
            // test an operation that requires the native library
            SKPMColor.PreMultiply(SKColors.Black);

            _logger.Info("SkiaSharp version: " + GetVersion());
        }
예제 #2
0
        public void CanUnPreultiplyArrays()
        {
            var colors   = new SKColor[] { 0x33008200, 0x33008200, 0x33008200, 0x33008200, 0x33008200 };
            var pmcolors = new SKPMColor[] { 0x33001A00, 0x33001A00, 0x33001A00, 0x33001A00, 0x33001A00 };

            var upm = SKPMColor.UnPreMultiply(pmcolors);

            Assert.Equal(colors, upm);
        }
예제 #3
0
 /// <summary>
 /// Check if the native lib is available.
 /// </summary>
 /// <returns>True if the native lib is available, otherwise false.</returns>
 public static bool IsNativeLibAvailable()
 {
     try
     {
         // test an operation that requires the native library
         SKPMColor.PreMultiply(SKColors.Black);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public void MembersRetrieveSingleColorWithAlpha()
        {
            var c   = (SKColor)0x33008200;
            var pm  = SKPMColor.PreMultiply(c);
            var upm = SKPMColor.UnPreMultiply(pm);

            Assert.AreEqual(new SKColor(0x33008200), c);
            Assert.AreEqual(new SKPMColor(0x33001A00), pm);
            Assert.AreEqual(new SKColor(0x33008200), upm);

            var ctContents = new[] { pm };
            var ct         = new SKColorTable(ctContents, 1);

            Assert.AreEqual(1, ct.Count);

            Assert.AreEqual(new SKPMColor(0x33001A00), ct[0]);
        }
예제 #5
0
 /// <summary>
 /// Test to determine if the native lib is available
 /// </summary>
 public static void TestSkia()
 {
     // test an operation that requires the native library
     SKPMColor.PreMultiply(SKColors.Black);
 }