Package org.b3log.latke.image

Examples of org.b3log.latke.image.Image


            final HttpServletRequest request = context.getRequest();
            final HttpServletResponse response = context.getResponse();

            final Random random = new Random();
            final int index = random.nextInt(CAPTCHA_COUNT);
            final Image captchaImg = captchas[index];
            final String captcha = captchaImg.getName();

            final HttpSession httpSession = request.getSession(false);

            if (null != httpSession) {
                LOGGER.log(Level.DEBUG, "Captcha[{0}] for session[id={1}]", new Object[] {captcha, httpSession.getId()});
View Full Code Here


                final byte[] captchaCharData = new byte[bufferedInputStream.available()];

                bufferedInputStream.read(captchaCharData);
                bufferedInputStream.close();

                final Image image = IMAGE_SERVICE.makeImage(captchaCharData);

                image.setName(entry.getName().substring(0, entry.getName().lastIndexOf('.')));

                captchas[i] = image;

                i++;
            }
View Full Code Here

            final List<Image> images = new ArrayList<Image>();
            for (int i = 0; i < LENGTH; i++) {
                final String column = String.valueOf(RANDOM.nextInt(MAX_CAPTCHA_COLUM));
                captcha += column;
                final String imageName = row + "/" + column + ".png";
                final Image captchaChar = CAPTCHAS.get(imageName);

                images.add(captchaChar);
            }

            final Image captchaImage = IMAGE_SERVICE.makeImage(images);

            final HttpServletRequest request = context.getRequest();
            final HttpServletResponse response = context.getResponse();

            final HttpSession httpSession = request.getSession(false);
View Full Code Here

                final BufferedInputStream bufferedInputStream = new BufferedInputStream(zipFile.getInputStream(zipEntry));
                final byte[] captchaCharData = new byte[bufferedInputStream.available()];
                bufferedInputStream.read(captchaCharData);
                bufferedInputStream.close();

                final Image captchaChar = imageService.makeImage(captchaCharData);

                CAPTCHAS.put(imageName, captchaChar);
            }

            zipFile.close();
View Full Code Here

*/
public final class LocalImageService implements ImageService {

    @Override
    public Image makeImage(final byte[] data) {
        final Image ret = new Image();
        ret.setData(data);

        return ret;
    }
View Full Code Here

        if (null == images || images.isEmpty()) {
            return null;
        }

        try {
            final Image firstImage = images.get(0);
            BufferedImage tmp = ImageIO.read(new ByteArrayInputStream(firstImage.getData()));

            for (int i = 1; i < images.size(); i++) {
                final Image image = images.get(i);

                final byte[] data = image.getData();
                final BufferedImage awtImage = ImageIO.read(new ByteArrayInputStream(data));

                tmp = splice(tmp, awtImage);
            }

            final Image ret = new Image();

            final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            ImageIO.write(tmp, "PNG", byteArrayOutputStream);

            final byte[] data = byteArrayOutputStream.toByteArray();
            ret.setData(data);

            return ret;
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

     */
    private static final ImagesService SVC = ImagesServiceFactory.getImagesService();

    @Override
    public Image makeImage(final byte[] data) {
        final Image ret = new Image();
        ret.setData(data);

        return ret;
    }
View Full Code Here

        int width = 0;
        int height = 0;
        final int length = images.size();
        for (int i = 0; i < length; i++) {
            final Image image = images.get(i);
            final byte[] imageData = image.getData();
            final com.google.appengine.api.images.Image gaeImage = ImagesServiceFactory.makeImage(imageData);

            final Composite composite = ImagesServiceFactory.makeComposite(
                    gaeImage, i * gaeImage.getWidth(), 0, 1.0F, Composite.Anchor.TOP_LEFT);
            composites.add(composite);
View Full Code Here

TOP

Related Classes of org.b3log.latke.image.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.