{"size": 2307, "ext": "scrbl", "max_stars_repo_path": "gui-doc/mrlib/scribblings/image-core.scrbl", "max_stars_repo_name": "jjsimpso/gui", "max_stars_repo_stars_event_min_datetime": "2015-03-17T22:11:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T15:09:34.000Z", "max_issues_repo_path": "gui-doc/mrlib/scribblings/image-core.scrbl", "max_issues_repo_name": "jjsimpso/gui", "max_issues_repo_issues_event_min_datetime": "2015-01-09T15:53:25.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T16:21:29.000Z", "max_forks_repo_path": "gui-doc/mrlib/scribblings/image-core.scrbl", "max_forks_repo_name": "jjsimpso/gui", "max_forks_repo_forks_event_min_datetime": "2015-01-08T13:03:07.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-26T21:49:09.000Z"}
{"max_stars_count": 65, "max_issues_count": 231, "max_forks_count": 89, "avg_line_length": 37.2096774194, "max_line_length": 97, "alphanum_fraction": 0.7039445167}
#lang scribble/doc
@(require "common.rkt" (for-label mrlib/image-core))

@title{Image Core}

@defmodule[mrlib/image-core]

This library is the core part of the @racketmodname[2htdp/image #:indirect] library that DrRacket
links into the namespace of all languages that it runs. This ensures that minimal
support for these images are the same in all languages, specifically including
support for printing the images and constructing the core data structures making
up an image.

@defproc[(render-image [image image?]
                       [dc (is-a?/c dc<%>)]
                       [dx real?]
                       [dy real?])
         void?]{
  Draws @racket[image] in @racket[dc] at the position (@racket[dx],@racket[dy]).
}

@defproc[(image? [v any/c]) boolean?]{
 Recognizes the images that library handles.
}

@defproc[(un/cache-image [image image?] [b any/c]) image?]{
  Returns an image that either caches its drawing in the 
  snip @method[snip% draw] method or doesn't, depending on @racket[b].
  
  Not all @racket[image?] values have special caching capabilities;
  in those cases, this returns a copy of the value if it is a 
  @racket[snip%]; otherwise it returns the value itself (if it 
  isn't a @racket[snip%]).
}

@defproc[(compute-image-cache [image image?]) void?]{
  When the image has a bitmap-cache (which it does by default,
  although @racket[un/cache-image] can disable it), this function
  fills in the bitmap, doing the work to draw image into the bitmap.
  
  Ordinarily, the image's bitmap cache is computed the first time
  the image is actually rendered.
}

@defproc[(definitely-same-image? [i1 image?] [i2 image?]) boolean?]{
  Returns @racket[#t] if @racket[i1] and @racket[i2] draw identically
  and @racket[#f] if they may draw the same or may draw differently. 
  
  This test is intended to be cheaper than a full equality comparison.
  It is also used by the implementation of @racket[equal?] on images
  to short-circuit the full check. (The full check draws the two images
  and then compares the resulting bitmaps.)
}


@defthing[snip-class (is-a?/c snip-class%)]{
 The snipclass used by images (which are @racket[snip%]s) created by this library.

 Not all @racket[image?] values are @racket[snip%]s, but those that are use this as
 their @racket[snip-class%].
}
