У меня есть CPImageView, отображающий изображение с помощью CPImageScaleAxesIndependently.
При увеличении изображение отображается с сглаживанием.
Как отключить сглаживание?
Я прочитал, что могу добиться этого, установив для imageSmoothingEnabled значение «false» для 2-го графического контекста.
Как получить этот контекст?
Спасибо за любыеПомогите.
Вот небольшой фрагмент кода из того, что я пробовал (но возникает исключение)
// Create Image View with size 100x100 and set a image with 16x16
// the displayed image will get scaled with antialiasing
var imageView = [[CPImageView alloc] initWithFrame:CGRectMake(0,0,100,100)];
[imageView setImageScaling:CPImageScaleAxesIndependently];
[imageView setImage:aSmallCPImageWith16x16Pixel];
// get the HTMLImageElement
var imgElement = imageView._DOMImageElement;
CPLog.warn("imgElement = " + imgElement);
// next call will raise exception:
var context = imgElement.getContext("2d");
// This should do the trick, but I do not have a context
context.imageSmoothingEnabled = false;
---------------------------------------------------------
Console output:
imgElement = [object HTMLImageElement]
Exception TypeError: imgElement.getContext is not a function