Re: bitmap% performance

"'racket' via users-redirect" <[email protected]> Thu, 23 Apr 2020 20:08:29 +0200
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <[email protected]>
Hi Sam,
trying your code I get back the following error:

load-file in bitmap%: not available in a canvas-compatible bitmap: (object:quartz-bitmap% ...)


The error I get is expected according to the load-file documentation:

"Loads a bitmap from a file format that read from in, unless the bitmap was produced by make-platform-bitmap, make-screen-bitmap, or make-bitmap in canvas% (in which case an exn:fail:contract exception is raised)"

Which racket version/platform did you use?

Andrea 





On 23 April 2020 at 18:39:08, Sam Tobin-Hochstadt ([email protected](mailto:[email protected])) wrote:

> I'm trying to understand the issue here. You say that you can't use
> `make-platform-bitmap` doesn't work, but this program works for me and
> loads two JPEGs into a platform bitmap.
>  
> #lang racket/base
> (require racket/draw racket/class)
> (define b (make-platform-bitmap 1000 1000))
> (define bs (make-bytes 100))
>  
> (send b load-file "/home/samth/Dropbox/punge-stuff/diploma.jpeg")
> (send b get-argb-pixels 20 20 5 5 bs)
> (bytes->list bs)
>  
> (send b load-file "/usr/share/doc/texlive-doc/dvipdfm/mwicks.jpeg")
> (send b get-argb-pixels 20 20 5 5 bs)
> (bytes->list bs)
>  
> On Wed, Apr 22, 2020 at 4:39 PM 'racket' via users-redirect
> wrote:
> >
> >
> > Hi,
> > I’m writing to the group looking for help with a performance issue.
> > I’m coding a gallery like application, using the racket/draw library, but the bitmap% class seems to be pretty slow. The (make-bitmap 4000 3000) operation takes more than 4 seconds on my computer (a macbook pro with a 3.1GHz dual core i5 and 16GB ram).
> > What I'd need to do is simply read and resize some jpeg files to display them in a canvas. I could use some external program to resize the photos but I would prefer to work with racket only. The make-platform-bitmap is 20 times faster than the make-bitmap, but I didn’t find a way to draw a jpeg on it.
> > Do you have any suggestion?
> >
> > Thanks,
> > Andrea
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
> > To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/etPan.5ea0ab6b.35178ff7.17869%40andreagiardina.com.

-- 
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/etPan.5ea1d99d.2741b08f.17869%40andreagiardina.com.