Re: [racket-users] Web-server and IDN

2016-09-21 Thread Tobias Gerdin

> 20 sep. 2016 kl. 22:47 skrev Jay McCarthy <jay.mccar...@gmail.com>:
> 
> On Wed, Sep 21, 2016 at 5:39 AM, Tobias Gerdin <tger...@gmail.com> wrote:
>> Hello,
>> 
>> Thanks for Racket, it really is great.
>> 
>> Is the web-server of production quality?
> 
> There are commercial sites that are built using it.
> 
>> Does it support IDN[1] hostnames?
> 
> I believe so, as it leaves hostnames uninterpreted and can deliver any
> bytes you tell it to.

Great, thank you!

-Tobias


-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Web-server and IDN

2016-09-20 Thread Tobias Gerdin
Hello,

Thanks for Racket, it really is great.

Is the web-server of production quality?
Does it support IDN[1] hostnames?

-Tobias

[1]: https://en.wikipedia.org/wiki/Internationalized_domain_name

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Scaling image with racket/draw?

2016-08-31 Thread Tobias Gerdin
By visual inspection of an 1200 pixels image scaled to 0.5 using the above
code any diferences are indistinguishable to my eye.

2016-08-31 22:40 GMT+02:00 Jens Axel Søgaard <jensaxelsoega...@gmail.com>:

> Is the result as good as ImageMagick?
>
> Den 31. aug. 2016 kl. 22.25 skrev Tobias Gerdin <tger...@gmail.com>:
>
> Right, that did it, thanks!
>
> 2016-08-31 14:19 GMT+02:00 WarGrey Gyoudmon Ju <juzhenli...@gmail.com>:
>
>> Try this example,
>>
>> (require racket/draw)
>>
>> (define bitmap-blank
>>   (lambda [[w 0] [h #false] #:backing-scale [backing-scale 2.0]]
>> (define width  (max 1 (exact-ceiling w)))
>> (define height (max 1 (exact-ceiling (or h w
>> (make-bitmap width height #:backing-scale backing-scale)))
>>
>> (define bitmap-scale
>>   (case-lambda
>> [(bmp scale)
>>  (if (= scale 1.0) bmp (bitmap-scale bmp scale scale))]
>> [(bmp scale-x scale-y)
>>  (cond [(and (= scale-x 1.0) (= scale-y 1.0)) bmp]
>>[else (let ([w (max 1 (exact-ceiling (* (send bmp get-width)
>> scale-x)))]
>>[h (max 1 (exact-ceiling (* (send bmp get-height)
>> scale-y)))])
>>(define dc (make-object bitmap-dc% (bitmap-blank w h)))
>>(send dc set-smoothing 'aligned)
>>(send dc set-scale scale-x scale-y)
>>(send dc draw-bitmap bmp 0 0)
>>(or (send dc get-bitmap) (bitmap-blank)))])]))
>>
>> I use it in my project.
>> The algorithm is exact what Jens says.
>>
>> On Wed, Aug 31, 2016 at 5:17 AM, Jens Axel Søgaard <jensa...@soegaard.net
>> > wrote:
>>
>>> Hi Tobias,
>>>
>>> I call the below procedure with `in` equal to a 1300-pixel wide PNG
>>>> image, w=320 and `out` equal to a nice path. Even so, the `out` image
>>>> remains 1300 pixels wide (i.e. it's not resized).
>>>>
>>>> (define (racket-resize in w out)
>>>>   (let ([bitmap (read-bitmap in)])
>>>> (let ([orig-width (send bitmap get-width)])
>>>>   (let ([dc (send bitmap make-dc)]
>>>> [s (/ w orig-width)])
>>>> (send dc scale s s))
>>>>   (send bitmap save-file out 'png
>>>>
>>>> What am I doing wrong?
>>>>
>>>
>>> The problem is that scale doesn't change the bitmap.
>>> The scale affects how the logical coordinates of the drawing context
>>> are translated into bitmap coordinates.
>>>
>>> In order to resize a bitmap:
>>>
>>>1. Create a new bitmap with the new size.
>>>2. Get the dc for the new bitmap
>>>3. Set the scale of dc
>>>4. Use draw-bitmap using the old image as the source
>>>5. Save the new bitmap
>>>
>>> (untested)
>>>
>>> /Jens Axel
>>>
>>>
>>>
>>>
>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Scaling image with racket/draw?

2016-08-31 Thread Tobias Gerdin
Right, that did it, thanks!

2016-08-31 14:19 GMT+02:00 WarGrey Gyoudmon Ju :

> Try this example,
>
> (require racket/draw)
>
> (define bitmap-blank
>   (lambda [[w 0] [h #false] #:backing-scale [backing-scale 2.0]]
> (define width  (max 1 (exact-ceiling w)))
> (define height (max 1 (exact-ceiling (or h w
> (make-bitmap width height #:backing-scale backing-scale)))
>
> (define bitmap-scale
>   (case-lambda
> [(bmp scale)
>  (if (= scale 1.0) bmp (bitmap-scale bmp scale scale))]
> [(bmp scale-x scale-y)
>  (cond [(and (= scale-x 1.0) (= scale-y 1.0)) bmp]
>[else (let ([w (max 1 (exact-ceiling (* (send bmp get-width)
> scale-x)))]
>[h (max 1 (exact-ceiling (* (send bmp get-height)
> scale-y)))])
>(define dc (make-object bitmap-dc% (bitmap-blank w h)))
>(send dc set-smoothing 'aligned)
>(send dc set-scale scale-x scale-y)
>(send dc draw-bitmap bmp 0 0)
>(or (send dc get-bitmap) (bitmap-blank)))])]))
>
> I use it in my project.
> The algorithm is exact what Jens says.
>
> On Wed, Aug 31, 2016 at 5:17 AM, Jens Axel Søgaard 
> wrote:
>
>> Hi Tobias,
>>
>> I call the below procedure with `in` equal to a 1300-pixel wide PNG
>>> image, w=320 and `out` equal to a nice path. Even so, the `out` image
>>> remains 1300 pixels wide (i.e. it's not resized).
>>>
>>> (define (racket-resize in w out)
>>>   (let ([bitmap (read-bitmap in)])
>>> (let ([orig-width (send bitmap get-width)])
>>>   (let ([dc (send bitmap make-dc)]
>>> [s (/ w orig-width)])
>>> (send dc scale s s))
>>>   (send bitmap save-file out 'png
>>>
>>> What am I doing wrong?
>>>
>>
>> The problem is that scale doesn't change the bitmap.
>> The scale affects how the logical coordinates of the drawing context
>> are translated into bitmap coordinates.
>>
>> In order to resize a bitmap:
>>
>>1. Create a new bitmap with the new size.
>>2. Get the dc for the new bitmap
>>3. Set the scale of dc
>>4. Use draw-bitmap using the old image as the source
>>5. Save the new bitmap
>>
>> (untested)
>>
>> /Jens Axel
>>
>>
>>
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.