public Puzzle FromImage(Image image) { if (image == null) { throw new ArgumentNullException("image"); } if (image.Width > this.puzzle_max_width || image.Height > this.puzzle_max_height) { throw new NotSupportedException("Image has too large resolution."); } if (image.Width <= 0 || image.Height <= 0) { throw new NotSupportedException("Width or Height of Image is 0."); } Bitmap bitmap = image as Bitmap; if (bitmap != null) { return(new Puzzle(PuzzleNative.puzzle_fill_cvec_from_file(this, bitmap))); } using (bitmap = new Bitmap(image)) return(new Puzzle(PuzzleNative.puzzle_fill_cvec_from_file(this, bitmap))); }
public double GetDistanceFrom(IPuzzle other, bool fixForTexts) { if (other == null) { throw new ArgumentNullException("other"); } return(PuzzleNative.puzzle_vector_normalized_distance(this.GetCvec(), other.GetCvec(), fixForTexts)); }
internal override byte[] GetCompressedCvec() { if (this.m_compressedVec == null) { this.m_compressedVec = PuzzleNative.puzzle_compress_cvec(this.m_vec); } return(this.m_compressedVec); }
public CompressedPuzzle ToCompressedPuzzle() { return(new CompressedPuzzle(PuzzleNative.puzzle_compress_cvec(this.m_vec))); }
public Puzzle ToUncompressedPuzzle() { return(new Puzzle(PuzzleNative.puzzle_uncompress_cvec(this.m_vec))); }