<commit_before>/* This file is part of magic-sdk, an sdk for the open source programming language magic.
 *
 * Copyright (C) 2016 magic-lang
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

use draw
use geometry
use base
use concurrent
import GpuContext, GpuCanvas

version(!gpuOff) {
GpuImageType: enum {
	Monochrome
	Rgba
	Rgb
	Uv
	YuvSemiplanar
	YuvPlanar
	Yuv422
}

GpuImage: abstract class extends Image {
	_context: GpuContext
	filter: Bool { get set }
	canvas: GpuCanvas { get {
		if (this _canvas == null)
			this _canvas = this _createCanvas() as GpuCanvas
		this _canvas as GpuCanvas
	}}
	init: func (size: IntVector2D, =_context) { super(size) }
	resizeTo: override func (size: IntVector2D) -> This {
		result := this create(size) as This
		result canvas draw(this, size)
		result
	}
	copy: override func -> This { this resizeTo(this size) }
	copy: override func ~fromParams (size: IntVector2D, transform: FloatTransform2D) -> This { raise("Using unimplemented function copy ~fromParams in GpuImage class"); null }
	distance: override func (other: Image) -> Float { raise("Using unimplemented function distance in GpuImage class"); 0.0f }<commit_msg>Using DrawState for resize.<commit_after>/* This file is part of magic-sdk, an sdk for the open source programming language magic.
 *
 * Copyright (C) 2016 magic-lang
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

use draw
use geometry
use base
use concurrent
import GpuContext, GpuCanvas

version(!gpuOff) {
GpuImageType: enum {
	Monochrome
	Rgba
	Rgb
	Uv
	YuvSemiplanar
	YuvPlanar
	Yuv422
}

GpuImage: abstract class extends Image {
	_context: GpuContext
	filter: Bool { get set }
	canvas: GpuCanvas { get {
		if (this _canvas == null)
			this _canvas = this _createCanvas() as GpuCanvas
		this _canvas as GpuCanvas
	}}
	init: func (size: IntVector2D, =_context) { super(size) }
	resizeTo: override func (size: IntVector2D) -> This {
		result := this create(size) as This
		DrawState new(result) setInputImage(this) draw()
		result
	}
	copy: override func -> This { this resizeTo(this size) }
	copy: override func ~fromParams (size: IntVector2D, transform: FloatTransform2D) -> This { raise("Using unimplemented function copy ~fromParams in GpuImage class"); null }
	distance: override func (other: Image) -> Float { raise("Using unimplemented function distance in GpuImage class"); 0.0f }
{'fraction_non_alphanumeric': 0.08816521048451152, 'fraction_numerical': 0.010325655281969817, 'mean_word_length': 4.348195329087049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1978710', 'n_tokens_mistral': 822, 'n_tokens_neox': 782, 'n_words': 303}