...

Для чего программа coil

Getting Started¶

ImageLoader s are service classes that execute ImageRequest s. ImageLoader s handle caching, data fetching, image decoding, request management, bitmap pooling, memory management, and more.

The default Coil artifact ( io.coil-kt:coil ) includes the singleton ImageLoader , which can be accessed using an extension function: context.imageLoader .

The singleton ImageLoader can be configured by implementing ImageLoaderFactory on your Application class:

Implementing ImageLoaderFactory is optional. If you don’t, Coil will lazily create an ImageLoader with the default values.

Check out the full documentation for more info.

Image Requests¶

ImageRequest s are value classes that are executed by ImageLoader s. They describe where an image should be loaded from, how it should be loaded, and any extra parameters. An ImageLoader has two methods that can execute a request:

  • enqueue : Enqueues the ImageRequest to be executed asynchronously on a background thread.
  • execute : Executes the ImageRequest in the current coroutine and returns an ImageResult .

All requests should set data (i.e. url, uri, file, drawable resource, etc.). This is what the ImageLoader will use to decide where to fetch the image data from. If you do not set data , it will default to NullRequestData .

Additionally, you likely want to set a target when enqueuing a request. It’s optional, but the target is what will receive the loaded placeholder/success/error drawables. Executed requests return an ImageResult which has the success/error drawable.

Here’s an example:

ImageView Extension Functions¶

The io.coil-kt:coil artifact provides a set of ImageView extension functions. Here’s an example for loading a URL into an ImageView :

The above call is equivalent to:

ImageView.load calls can be configured with an optional trailing lambda parameter:

See the docs here for more information.

Supported Data Types¶

The base data types that are supported by all ImageLoader instances are:

  • String
  • HttpUrl
  • Uri ( android.resource , content , file , http , and https schemes)
  • File
  • @DrawableRes Int
  • Drawable
  • Bitmap
  • ByteArray
  • ByteBuffer

Supported Image Formats¶

All ImageLoader s support the following non-animated file types:

  • BMP
  • JPEG
  • PNG
  • WebP
  • HEIF (Android 8.0+)
  • AVIF (Android 12.0+)

Additionally, Coil has extension libraries for the following file types:

  • coil-gif : GIF, animated WebP (Android 9.0+), animated HEIF (Android 11.0+)
  • coil-svg : SVG
  • coil-video : Static video frames from any video codec supported by Android

Preloading¶

To preload an image into memory, enqueue or execute an ImageRequest without a Target :

To preload a network image only into the disk cache:

Cancelling Requests¶

ImageRequest s will be automatically cancelled in the following cases:

  • request.lifecycle reaches the DESTROYED state.
  • request.target is a ViewTarget and its View is detached.

Additionally, ImageLoader.enqueue returns a Disposable, which can be used to dispose the request (which cancels it and frees its associated resources):

Overview

An image loading library for Android backed by Kotlin Coroutines. Coil is:

  • Fast: Coil performs a number of optimizations including memory and disk caching, downsampling the image in memory, automatically pausing/cancelling requests, and more.
  • Lightweight: Coil adds ~2000 methods to your APK (for apps that already use OkHttp and Coroutines), which is comparable to Picasso and significantly less than Glide and Fresco.
  • Easy to use: Coil’s API leverages Kotlin’s language features for simplicity and minimal boilerplate.
  • Modern: Coil is Kotlin-first and uses modern libraries including Coroutines, OkHttp, Okio, and AndroidX Lifecycles.

Coil is an acronym for: Coroutine Image Loader.

Download¶

Coil is available on mavenCentral() .

Quick Start¶

ImageViews¶

To load an image into an ImageView , use the load extension function:

Requests can be configured with an optional trailing lambda:

Jetpack Compose¶

Import the Jetpack Compose extension library:

To load an image, use the AsyncImage composable:

Image Loaders¶

Both imageView.load and AsyncImage use the singleton ImageLoader to execute image requests. The singleton ImageLoader can be accessed using a Context extension function:

ImageLoader s are designed to be shareable and are most efficient when you create a single instance and share it throughout your app. That said, you can also create your own ImageLoader instance(s):

If you do not want the singleton ImageLoader , depend on io.coil-kt:coil-base instead of io.coil-kt:coil .

Requests¶

To load an image into a custom target, enqueue an ImageRequest :

To load an image imperatively, execute an ImageRequest :

R8 / Proguard¶

Coil is fully compatible with R8 out of the box and doesn’t require adding any extra rules.

If you use Proguard, you may need to add rules for Coroutines and OkHttp.

License¶

Copyright 2023 Coil Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Coil64 (Coil32) – бесплатное приложение для расчета индуктивностей.

Coil64 v2.1.28 – п оследняя версия (опубликовано 2023-08-05) , изменения:

  • Добавлен расчет многослойных катушек с ортоциклической формой намотки.

Новые онлайн калькуляторы:

Программа Coil64 (Coil32)

Программа предназначена для расчета индуктивности катушек, на разных каркасах: одно и многослойных, на ферритовых кольцах, в броневом сердечнике, плоских катушек на печатной плате, а также колебательных контуров.

Программа бесплатна и свободна для использования и распространения.

Надеюсь, что это небольшое приложение поможет радиолюбителям при расчете различных индуктивных элементов.

Программа позволяет рассчитать следующие варианты катушек индуктивности:

  • Однослойная катушка виток к витку.
    В качестве начальных параметров при расчете катушки можно выбрать два варианта:
    1. Известны диаметр каркаса и диаметр провода, длина намотки вычисляется.
    2. Известны диаметр каркаса и длина намотки, диаметр провода вычисляется
  • Однослойная катушка с шагом намотки
  • Однослойная катушка с прямоугольным сечением провода
  • Однослойная катушка с шагом намотки на многоугольном каркасе
  • Многослойная катушка
  • Многослойная катушка с изолирующими межслойными прокладками
  • Многослойная катушка на прямоугольном каркасе
  • Многослойная катушка намотанная фольгой
  • Катушка на ферритовом кольце (только для использования при слабых ВЧ полях)
  • Тонкопленочная катушка на печатной плате
  • Плоская спиральная катушка Теслы
  • Приложение имеет дополнительные модули позволяющие рассчитать:
    • Печатную катушку в форме меандра;
    • Поисковую катушку металлоискателя;
    • Катушку в виде одиночного треугольного, прямоугольного или круглого витка;
    • Тороидальную катушку без сердечника с круглым или прямоугольным поперечным сечением;
    • Приблизительно оценить влияние экрана на величину индуктивности;
    • Катушка на ферритовом стержне;
    • Катушка в броневом сердечнике (ферритовом или из порошкового железа);
    • Катушка на Ш-образном сердечнике;
    • Катушка на П-образном сердечнике;
    • Катушка на RM сердечнике;
    • Найти проницаемость ферритового кольца;
    • Пересчет любой катушки с сердечником путем определения его коэффициента индуктивности AL;
    • Amidon™ сердечники – кольца из порошкового железа и феррита, броневые сердечники , Ш-образные и в форме “бинокля”;
    • Расчет оптимальной многослойной катушки без сердечника для Hi-End аудиофильтров (кроссоверов);
    • Расчет катушки на ферритовом кольце на ВЧ с расчетом добротности и паразитной емкости;
    • Расчет растягивающих контурных конденсаторов;

    В чем преимущества программы перед аналогами?

    • Программа рассчитывает индуктивность многих типов катушек. Можно подобрать оптимальный вариант, либо пересчитать катушку под имеющийся каркас.
    • Coil64 позволяет рассчитать добротность, частоту собственного резонанса и паразитную емкость однослойной катушки.
    • Coil64 позволяет рассчитать добротностьи паразитную емкость катушки на ферритовом кольце на радиочастотах.
    • Можно рассчитать длину провода для намотки однослойной, многослойной катушки и катушки на ферритовом кольце.
    • Результаты всех расчетов выводятся в текстовое поле, откуда их можно сохранить в файл или распечатать.
    • Для плоских катушек на печатной плате программа подскажет оптимальные размеры для достижения наивысшей добротности.
    • Есть возможность переключаться между метрической и дюймовой системами измерений.
    • Поддерживаются метрический стандарт намоточных проводов или AWG.
    • Приложение свободно для распространения и имеет открытый исходный код.
    • Поддерживается мультиязычный интерфейс.
    • Приложение является мультиплатформенным. Доступны версии приложения для операционных систем Windows, Linux, MacOS & Android.

    При подготовке материала использовались источники:
    https://coil-kt.github.io/coil/getting_started/
    https://coil-kt.github.io/coil/
    https://coil32.net/ru/

Добавить комментарий