On Jul 6, 1:26 pm, "philip.hazel...@gmail.com"
<philip.hazel...@gmail.com> wrote:
> On Jul 5, 10:31 pm, Mark Triggs <mark.h.tri...@gmail.com> wrote:
>
> > (defn bi-get-pixels
> > [#^BufferedImage bi]
> > (let [raster (.getData bi)
> > pixels (.getPixels raster 0 0 (.getWidth bi) (.getHeight bi)
> > (cast (Class/forName "[I") nil))]
> > (vec pixels)))
>
> This still generates a single reflection warning, but #^ints before
> the cast fixes it. That gave me an idea:
>
> (defn bi-get-pixels
> [#^BufferedImage bi]
> (vec (.. bi (getData)
> (getPixels 0 0 (.getWidth bi) (.getHeight bi)
> #^ints (identity nil)))))
>
> Which does the right thing with no warnings.
>
> Thanks for the help,
>
> -Phil
(ints nil) might also work
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---