From f147871728eda6541e7256ef81dc1a0c77a6dbec Mon Sep 17 00:00:00 2001 From: "Diogo F. S. Ramos" Date: Tue, 4 Sep 2012 18:17:11 -0300 Subject: [PATCH] Add instructions on how to take screen shots This instructs the adventurer on how to take screen shots using the same look and feel used to take the ones that can be found at `collects/scribblings/gui/image'. There are also two scripts that might help automate this process. --- .../gui/taking-screenshots/instructions | 38 +++++++++++++++ .../gui/taking-screenshots/racket-widget.scm | 48 +++++++++++++++++++ .../gui/taking-screenshots/widget.rkt | 18 +++++++ 3 files changed, 104 insertions(+) create mode 100644 collects/scribblings/gui/taking-screenshots/instructions create mode 100644 collects/scribblings/gui/taking-screenshots/racket-widget.scm create mode 100644 collects/scribblings/gui/taking-screenshots/widget.rkt diff --git a/collects/scribblings/gui/taking-screenshots/instructions b/collects/scribblings/gui/taking-screenshots/instructions new file mode 100644 index 0000000000..98167cfd45 --- /dev/null +++ b/collects/scribblings/gui/taking-screenshots/instructions @@ -0,0 +1,38 @@ +-*- org -*- + +* Using GIMP + + To take screen shots of the widgets, you can follow these steps: + + 1. Take a widget screen shot + 2. Open it with GIMP + 3. Cut it to 240 x 73 + 4. Add a border using Filters/Decor/Add Border... + + Border X size :: 1 + + Border Y size :: 1 + + Border color :: black + + Delta value on color :: 25 + 5. Combine all layers + 6. Add a drop shadow using Filters/Light and Shadow/Drop + Shadow... + + Offset X :: 8 + + Offset Y :: 8 + + Blur radius :: 9 + + Color :: black + + Opacity :: 80 + + Allow resizing :: #t + 7. Save as .png + + There are two scripts in this directory that might help in this + process. Keep in mind though that the GIMP script is very fragile + and some tweaking might be necessary to make it work in different + setups. + + + [[file:widget.rkt][widget.rkt]] :: Creates a "canvas" panel with a border, so it is + easier to select the widget area using GIMP's Fuzzy + Select Tool + + [[file:racket-widget.scm][racket-widget.scm]] :: GIMP's script which, when invoked, asks for a + window to take a screen shot and do the post production to the + image. This script should be put inside a specific directory, + here being `~/.gimp-2.6/scripts', and should be invoked at + File/Create/Racket Widget. diff --git a/collects/scribblings/gui/taking-screenshots/racket-widget.scm b/collects/scribblings/gui/taking-screenshots/racket-widget.scm new file mode 100644 index 0000000000..1623e55704 --- /dev/null +++ b/collects/scribblings/gui/taking-screenshots/racket-widget.scm @@ -0,0 +1,48 @@ +;;; -*- scheme -*- + +(script-fu-register "script-fu-racket-widget" + "Racket Widget" + "Take a screen shot of a Racket Widget" + "Diogo F. S. Ramos" + "copyright 2012, Diogo F. S. Ramos" + "August, 2012" + "") +(script-fu-menu-register "script-fu-racket-widget" "/File/Create") + +(define (script-fu-racket-widget) + (define (crop-to-selection selection image) + (let ((x1 (list-ref selection 0)) + (y1 (list-ref selection 1)) + (x2 (list-ref selection 2)) + (y2 (list-ref selection 3))) + (gimp-image-crop image + (- x2 x1) + (- y2 y1) + x1 y1))) + (let ((image (car (plug-in-screenshot RUN-INTERACTIVE 0 0 0 0 0 0)))) + (gimp-fuzzy-select (car (gimp-image-get-active-drawable image)) + (/ (car (gimp-image-width image)) 2) + (/ (car (gimp-image-height image)) 2) + 15.0 + CHANNEL-OP-REPLACE + TRUE + FALSE + 0.0 + TRUE) + (gimp-selection-invert image) + (gimp-selection-shrink image 1.0) + (crop-to-selection (cdr (gimp-selection-bounds image)) image) + (script-fu-addborder image + (car (gimp-image-flatten image)) + 1.0 + 1.0 + '(0 0 0) + 25) + (script-fu-drop-shadow image + (car (gimp-image-flatten image)) + 8.0 + 8.0 + 9.0 + '(0 0 0) + 80.0 + 1))) diff --git a/collects/scribblings/gui/taking-screenshots/widget.rkt b/collects/scribblings/gui/taking-screenshots/widget.rkt new file mode 100644 index 0000000000..fd3cfc2396 --- /dev/null +++ b/collects/scribblings/gui/taking-screenshots/widget.rkt @@ -0,0 +1,18 @@ +#lang racket/gui + +(provide showcase) + +(define showcase (lambda (#:hmult (hmult 1) . name) + (define frame (new frame% (label (if (null? name) + "widget" + (car name))))) + (define panel (new panel% (parent frame))) + (define showcase-panel (new horizontal-panel% + (parent panel) + (alignment '(center center)) + (style '(border)) + (min-width 242) + (min-height (* hmult 75)) + (border 20))) + (send frame show #t) + showcase-panel))