kredki 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/kredki/core/application.rb +314 -0
- data/lib/kredki/core/color.rb +100 -0
- data/lib/kredki/core/event/block_event_reaction.rb +44 -0
- data/lib/kredki/core/event/composite_event_manager.rb +37 -0
- data/lib/kredki/core/event/event.rb +91 -0
- data/lib/kredki/core/event/event_manager.rb +60 -0
- data/lib/kredki/core/event/event_manager_jobs.rb +53 -0
- data/lib/kredki/core/event/event_reaction.rb +36 -0
- data/lib/kredki/core/event/family/drop_event.rb +40 -0
- data/lib/kredki/core/event/family/exit_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_enter_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_leave_event.rb +5 -0
- data/lib/kredki/core/event/family/hide_event.rb +5 -0
- data/lib/kredki/core/event/family/joystick_event.rb +102 -0
- data/lib/kredki/core/event/family/key_event.rb +40 -0
- data/lib/kredki/core/event/family/mouse_event.rb +190 -0
- data/lib/kredki/core/event/family/pastele_event.rb +11 -0
- data/lib/kredki/core/event/family/show_event.rb +5 -0
- data/lib/kredki/core/event/family/text_event.rb +23 -0
- data/lib/kredki/core/event/family/tick_event.rb +5 -0
- data/lib/kredki/core/event/family/update_complete_event.rb +5 -0
- data/lib/kredki/core/event/family/window_event.rb +108 -0
- data/lib/kredki/core/event/job_event_reaction.rb +44 -0
- data/lib/kredki/core/event/joystick_event_manager.rb +30 -0
- data/lib/kredki/core/event/keyboard_event_manager.rb +29 -0
- data/lib/kredki/core/event/method_event_reaction.rb +46 -0
- data/lib/kredki/core/event/mouse_event_manager.rb +27 -0
- data/lib/kredki/core/font.rb +53 -0
- data/lib/kredki/core/job/after_job.rb +59 -0
- data/lib/kredki/core/job/job.rb +108 -0
- data/lib/kredki/core/job/loop_job.rb +87 -0
- data/lib/kredki/core/job/play_animation_job.rb +44 -0
- data/lib/kredki/core/job/play_job.rb +41 -0
- data/lib/kredki/core/job/play_loop_animation_job.rb +98 -0
- data/lib/kredki/core/job/play_loop_job.rb +104 -0
- data/lib/kredki/core/job/side_job.rb +62 -0
- data/lib/kredki/core/kernel-path.rb +71 -0
- data/lib/kredki/core/kredki.rb +89 -0
- data/lib/kredki/core/linear_gradient.rb +43 -0
- data/lib/kredki/core/media/clipboard.rb +35 -0
- data/lib/kredki/core/media/joystick.rb +199 -0
- data/lib/kredki/core/media/keyboard.rb +84 -0
- data/lib/kredki/core/media/keyboard_modifiers_decoder.rb +154 -0
- data/lib/kredki/core/media/mouse.rb +197 -0
- data/lib/kredki/core/paint/animation.rb +247 -0
- data/lib/kredki/core/paint/area.rb +67 -0
- data/lib/kredki/core/paint/block_shape_area.rb +102 -0
- data/lib/kredki/core/paint/ellipse.rb +22 -0
- data/lib/kredki/core/paint/paint.rb +392 -0
- data/lib/kredki/core/paint/picture.rb +126 -0
- data/lib/kredki/core/paint/rectangle.rb +202 -0
- data/lib/kredki/core/paint/scene.rb +277 -0
- data/lib/kredki/core/paint/shape.rb +394 -0
- data/lib/kredki/core/paint/shape_area.rb +57 -0
- data/lib/kredki/core/paint/text.rb +222 -0
- data/lib/kredki/core/pastele/pastele-extern.rb +139 -0
- data/lib/kredki/core/pastele/pastele.rb +205 -0
- data/lib/kredki/core/radial_gradient.rb +45 -0
- data/lib/kredki/core/setup.rb +214 -0
- data/lib/kredki/core/window/pane.rb +178 -0
- data/lib/kredki/core/window/pane_event_manager.rb +44 -0
- data/lib/kredki/core/window/pane_events.rb +366 -0
- data/lib/kredki/core/window/window.rb +584 -0
- data/lib/kredki/core.rb +2 -0
- data/lib/kredki/hide.rb +9 -0
- data/lib/kredki/irb.rb +90 -0
- data/lib/kredki/module.rb +3 -0
- data/lib/kredki/pads/application.rb +13 -0
- data/lib/kredki/pads/button.rb +151 -0
- data/lib/kredki/pads/checkbox/checkbox.rb +68 -0
- data/lib/kredki/pads/checkbox/checkbox_button.rb +65 -0
- data/lib/kredki/pads/context/item.rb +65 -0
- data/lib/kredki/pads/context/item_group.rb +10 -0
- data/lib/kredki/pads/context/layer.rb +59 -0
- data/lib/kredki/pads/context/menu.rb +77 -0
- data/lib/kredki/pads/context/pad.rb +26 -0
- data/lib/kredki/pads/context/primary_layer.rb +51 -0
- data/lib/kredki/pads/context/secondary_layer.rb +60 -0
- data/lib/kredki/pads/item/item.rb +140 -0
- data/lib/kredki/pads/item/item_group.rb +44 -0
- data/lib/kredki/pads/item/item_x.rb +22 -0
- data/lib/kredki/pads/item/item_y.rb +31 -0
- data/lib/kredki/pads/label.rb +71 -0
- data/lib/kredki/pads/layer.rb +326 -0
- data/lib/kredki/pads/layout/align.rb +10 -0
- data/lib/kredki/pads/layout/layout.rb +88 -0
- data/lib/kredki/pads/layout/way.rb +99 -0
- data/lib/kredki/pads/layout/x_way.rb +119 -0
- data/lib/kredki/pads/layout/y_way.rb +120 -0
- data/lib/kredki/pads/list/item.rb +117 -0
- data/lib/kredki/pads/list/item_group.rb +36 -0
- data/lib/kredki/pads/list/pad.rb +74 -0
- data/lib/kredki/pads/list/tree/item.rb +138 -0
- data/lib/kredki/pads/list/tree/item_group.rb +86 -0
- data/lib/kredki/pads/list/tree/pad.rb +94 -0
- data/lib/kredki/pads/module.rb +11 -0
- data/lib/kredki/pads/note.rb +212 -0
- data/lib/kredki/pads/notes.rb +32 -0
- data/lib/kredki/pads/option/option.rb +121 -0
- data/lib/kredki/pads/option/option_item.rb +15 -0
- data/lib/kredki/pads/option/option_item_group.rb +16 -0
- data/lib/kredki/pads/option/option_layer.rb +81 -0
- data/lib/kredki/pads/pad/animation_pad.rb +106 -0
- data/lib/kredki/pads/pad/glyph_pad.rb +71 -0
- data/lib/kredki/pads/pad/pad.rb +1290 -0
- data/lib/kredki/pads/pad/pad_events.rb +358 -0
- data/lib/kredki/pads/pad/picture_pad.rb +89 -0
- data/lib/kredki/pads/pad/rectangle_pad.rb +181 -0
- data/lib/kredki/pads/pad/scroll_pad.rb +176 -0
- data/lib/kredki/pads/pad/shape_pad.rb +148 -0
- data/lib/kredki/pads/pad/space_pad.rb +33 -0
- data/lib/kredki/pads/pad/text_pad.rb +310 -0
- data/lib/kredki/pads/pane.rb +267 -0
- data/lib/kredki/pads/portal_layer.rb +94 -0
- data/lib/kredki/pads/radio/group.rb +45 -0
- data/lib/kredki/pads/radio/item.rb +69 -0
- data/lib/kredki/pads/radio/item_button.rb +143 -0
- data/lib/kredki/pads/service/event_queue.rb +79 -0
- data/lib/kredki/pads/service/service.rb +248 -0
- data/lib/kredki/pads/service/service_event_manager.rb +43 -0
- data/lib/kredki/pads/service/service_filter.rb +98 -0
- data/lib/kredki/pads/service/service_inherited.rb +48 -0
- data/lib/kredki/pads/setup.rb +36 -0
- data/lib/kredki/pads/slider/slider.rb +145 -0
- data/lib/kredki/pads/slider/slider_x.rb +41 -0
- data/lib/kredki/pads/slider/slider_y.rb +41 -0
- data/lib/kredki/pads/table/cell.rb +22 -0
- data/lib/kredki/pads/table/column.rb +63 -0
- data/lib/kredki/pads/table/column_layout.rb +88 -0
- data/lib/kredki/pads/table/pad.rb +116 -0
- data/lib/kredki/pads/table/row.rb +24 -0
- data/lib/kredki/pads/table/scroll_rows.rb +50 -0
- data/lib/kredki/pads/text/editable_text_verse.rb +77 -0
- data/lib/kredki/pads/text/editable_text_verses.rb +59 -0
- data/lib/kredki/pads/text/navigable_text_pad.rb +413 -0
- data/lib/kredki/pads/text/text_edition.rb +97 -0
- data/lib/kredki/pads/text/text_navigation.rb +109 -0
- data/lib/kredki/pads/toolbar/item.rb +62 -0
- data/lib/kredki/pads/toolbar/item_group.rb +22 -0
- data/lib/kredki/pads/toolbar/layer.rb +41 -0
- data/lib/kredki/pads/toolbar/pad.rb +51 -0
- data/lib/kredki/pads/toolbar/primary_layer.rb +64 -0
- data/lib/kredki/pads/window.rb +11 -0
- data/lib/kredki/script.rb +29 -0
- data/lib/kredki/setup.rb +2 -0
- data/lib/kredki/test.rb +35 -0
- data/lib/kredki.rb +10 -0
- data/lib/readme.md +31 -0
- data/stuff/config/config.rb +431 -0
- data/stuff/config/pads_config.rb +111 -0
- data/stuff/dll/SDL3.dll +0 -0
- data/stuff/dll/pastele.dll +0 -0
- data/stuff/dll/thorvg-1.dll +0 -0
- data/stuff/font/MartianMono-StdRg.ttf +0 -0
- data/stuff/font/MavenPro-Medium.ttf +0 -0
- data/stuff/font/MavenPro-Regular.ttf +0 -0
- data/stuff/glyph/alert-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/alert-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/archivebox-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-ccw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-cw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-rectangle-path-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-4-way-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-ccw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-cw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-from-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-right-arrow-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-to-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-trend-down-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-trend-up-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-turn-down-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-down-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-up-arrow-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/at-sign-svgrepo-com.svg +4 -0
- data/stuff/glyph/bag-svgrepo-com.svg +4 -0
- data/stuff/glyph/bell-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/bell-svgrepo-com.svg +5 -0
- data/stuff/glyph/book-open-svgrepo-com.svg +5 -0
- data/stuff/glyph/bookmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/box-svgrepo-com.svg +6 -0
- data/stuff/glyph/calendar-svgrepo-com.svg +5 -0
- data/stuff/glyph/camera-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cart-svgrepo-com.svg +6 -0
- data/stuff/glyph/chart-pie-svgrepo-com.svg +5 -0
- data/stuff/glyph/chartbar-2-svgrepo-com.svg +7 -0
- data/stuff/glyph/chartbar-svgrepo-com.svg +7 -0
- data/stuff/glyph/checkmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-double-svgrepo-com.svg +5 -0
- data/stuff/glyph/checkmark-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-left-chevron-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-up-chevron-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/clock-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-download-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-slash-svgrepo-com.svg +5 -0
- data/stuff/glyph/cloud-svgrepo-com.svg +4 -0
- data/stuff/glyph/columns-svgrepo-com.svg +5 -0
- data/stuff/glyph/command-svgrepo-com.svg +4 -0
- data/stuff/glyph/compass-svgrepo-com.svg +5 -0
- data/stuff/glyph/credit-card-svgrepo-com.svg +5 -0
- data/stuff/glyph/crop-svgrepo-com.svg +5 -0
- data/stuff/glyph/crown-svgrepo-com.svg +4 -0
- data/stuff/glyph/delete-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-desktop-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-mobile-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-tablet-svgrepo-com.svg +4 -0
- data/stuff/glyph/doc-svgrepo-com.svg +5 -0
- data/stuff/glyph/dot-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/dots-3-horizontal-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-3-vertical-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-6-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-6-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-9-svgrepo-com.svg +12 -0
- data/stuff/glyph/emoji-frown-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-meh-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-smile-svgrepo-com.svg +4 -0
- data/stuff/glyph/envelope-svgrepo-com.svg +5 -0
- data/stuff/glyph/external-link-svgrepo-com.svg +5 -0
- data/stuff/glyph/eye-slash-svgrepo-com.svg +15 -0
- data/stuff/glyph/eye-svgrepo-com.svg +4 -0
- data/stuff/glyph/filter-svgrepo-com.svg +4 -0
- data/stuff/glyph/flame-svgrepo-com.svg +4 -0
- data/stuff/glyph/floppy-disk-svgrepo-com.svg +4 -0
- data/stuff/glyph/folder-svgrepo-com.svg +4 -0
- data/stuff/glyph/fullscreen-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-svgrepo-com.svg +5 -0
- data/stuff/glyph/fullscreen-svgrepo-com.svg +5 -0
- data/stuff/glyph/gear-svgrepo-com.svg +4 -0
- data/stuff/glyph/giftbox-svgrepo-com.svg +6 -0
- data/stuff/glyph/half-star-svgrepo-com.svg +4 -0
- data/stuff/glyph/hashtag-svgrepo-com.svg +4 -0
- data/stuff/glyph/headphones-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-half-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-svgrepo-com.svg +4 -0
- data/stuff/glyph/house-svgrepo-com.svg +4 -0
- data/stuff/glyph/image-svgrepo-com.svg +4 -0
- data/stuff/glyph/info-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/key-svgrepo-com.svg +4 -0
- data/stuff/glyph/layers-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/layout-svgrepo-com.svg +6 -0
- data/stuff/glyph/line-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/link-alt-svgrepo-com.svg +5 -0
- data/stuff/glyph/link-svgrepo-com.svg +6 -0
- data/stuff/glyph/list-bullet-svgrepo-com.svg +9 -0
- data/stuff/glyph/location-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-open-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-svgrepo-com.svg +4 -0
- data/stuff/glyph/map-pin-svgrepo-com.svg +4 -0
- data/stuff/glyph/medal-svgrepo-com.svg +13 -0
- data/stuff/glyph/media-backward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-backward-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-play-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-play-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-2-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-svgrepo-com.svg +4 -0
- data/stuff/glyph/mic-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/mic-svgrepo-com.svg +5 -0
- data/stuff/glyph/minus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-svgrepo-com.svg +4 -0
- data/stuff/glyph/moon-svgrepo-com.svg +4 -0
- data/stuff/glyph/music-note-svgrepo-com.svg +4 -0
- data/stuff/glyph/nosign-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-clip-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-plane-svgrepo-com.svg +4 -0
- data/stuff/glyph/pen-tool-svgrepo-com.svg +4 -0
- data/stuff/glyph/pencil-svgrepo-com.svg +5 -0
- data/stuff/glyph/percent-svgrepo-com.svg +6 -0
- data/stuff/glyph/phone-incoming-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-missed-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-outgoing-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-slash-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-svgrepo-com.svg +4 -0
- data/stuff/glyph/power-svgrepo-com.svg +5 -0
- data/stuff/glyph/printer-svgrepo-com.svg +5 -0
- data/stuff/glyph/question-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/scissors-svgrepo-com.svg +5 -0
- data/stuff/glyph/search-svgrepo-com.svg +4 -0
- data/stuff/glyph/server-svgrepo-com.svg +5 -0
- data/stuff/glyph/shape-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-rhombus-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/share-svgrepo-com.svg +4 -0
- data/stuff/glyph/shield-slash-svgrepo-com.svg +13 -0
- data/stuff/glyph/shield-svgrepo-com.svg +4 -0
- data/stuff/glyph/shippingbox-svgrepo-com.svg +7 -0
- data/stuff/glyph/slider-3-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/slider-3-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/speaker-svgrepo-com.svg +4 -0
- data/stuff/glyph/speaker-wave-1-svgrepo-com.svg +5 -0
- data/stuff/glyph/speaker-wave-2-svgrepo-com.svg +6 -0
- data/stuff/glyph/speaker-xmark-svgrepo-com.svg +5 -0
- data/stuff/glyph/square-4-grid-svgrepo-com.svg +7 -0
- data/stuff/glyph/square-on-square-svgrepo-com.svg +5 -0
- data/stuff/glyph/star-svgrepo-com.svg +4 -0
- data/stuff/glyph/sun-svgrepo-com.svg +12 -0
- data/stuff/glyph/tag-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-align-center-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-justify-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-left-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-right-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-bold-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-heading-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-italic-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-underline-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/trash-svgrepo-com.svg +5 -0
- data/stuff/glyph/tray-svgrepo-com.svg +4 -0
- data/stuff/glyph/umbrela-svgrepo-com.svg +4 -0
- data/stuff/glyph/user-svgrepo-com.svg +5 -0
- data/stuff/glyph/users-svgrepo-com.svg +7 -0
- data/stuff/glyph/video-svgrepo-com.svg +12 -0
- data/stuff/glyph/waveform-ecg-svgrepo-com.svg +4 -0
- data/stuff/glyph/wi-fi-svgrepo-com.svg +7 -0
- data/stuff/glyph/xmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/zap-svgrepo-com.svg +4 -0
- data/stuff/glyph/zoom-in-svgrepo-com.svg +5 -0
- data/stuff/glyph/zoom-out-svgrepo-com.svg +5 -0
- data/stuff/readme.md +266 -0
- data/stuff/so/libSDL3.so +0 -0
- data/stuff/so/libpastele.so +0 -0
- data/stuff/so/libthorvg-1.so +0 -0
- metadata +427 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
require_relative 'shape_area'
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
class BlockShapeArea < ShapeArea
|
|
5
|
+
|
|
6
|
+
# Helper for creating Shape path.
|
|
7
|
+
class AreaCrayon < Crayon
|
|
8
|
+
|
|
9
|
+
# Set [+x+, +y+] as crayon position.
|
|
10
|
+
def jump x, y = x
|
|
11
|
+
x, y = parse_xy x, y
|
|
12
|
+
super
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Make line from crayon position to [+x+, +y+] then set [+x+, +y+] as crayon position.
|
|
16
|
+
def line x, y
|
|
17
|
+
x, y = parse_xy x, y
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Make bezier curve from crayon position to [+x+, +y+] with leading points [+cx1+, +cy1+] and [+cx2+, +cy2+]. Then set [+x+, +y+] as crayon position.
|
|
22
|
+
def curve x, y, cx1, cy1, cx2, cy2
|
|
23
|
+
x, y = parse_xy x, y
|
|
24
|
+
cx1, cy1 = parse_xy cx1, cy1
|
|
25
|
+
cx2, cy2 = parse_xy cx2, cy2
|
|
26
|
+
super
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Make ellipse of +size_x+ and +size_y+ with the center at crayon position.
|
|
30
|
+
def ellipse size_x, size_y = size_x
|
|
31
|
+
size_x = parse_size_x size_x
|
|
32
|
+
size_y = parse_size_y size_y
|
|
33
|
+
super
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Make rectangle of +size_x+ and +size_y+ with +corner_ss+, +corner_es+, +corner_se+ and +corner_ee+ corners.
|
|
37
|
+
# The rectangle is placed at crayon position.
|
|
38
|
+
def rectangle size_x, size_y = size_x, corner_ss = 0, corner_es = corner_ss, corner_se = corner_ss, corner_ee = corner_ss
|
|
39
|
+
size_x = parse_size_x size_x
|
|
40
|
+
size_y = parse_size_y size_y
|
|
41
|
+
super
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# :section: LEVEL 2
|
|
45
|
+
|
|
46
|
+
def parse_xy x, y
|
|
47
|
+
x = case x
|
|
48
|
+
when Rational
|
|
49
|
+
(@shape.size_x - @shape.stroke_width) * x
|
|
50
|
+
else
|
|
51
|
+
x
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
y = case y
|
|
55
|
+
when Rational
|
|
56
|
+
(@shape.size_y - @shape.stroke_width) * y
|
|
57
|
+
else
|
|
58
|
+
y
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
offset = @shape.stroke_width * 0.5
|
|
62
|
+
[x + offset, y + offset]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def parse_size_x size_x
|
|
66
|
+
case size_x
|
|
67
|
+
when Rational
|
|
68
|
+
(@shape.size_x - @shape.stroke_width) * size_x
|
|
69
|
+
else
|
|
70
|
+
size_x
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def parse_size_y size_y
|
|
75
|
+
case size_y
|
|
76
|
+
when Rational
|
|
77
|
+
(@shape.size_y - @shape.stroke_width) * size_y
|
|
78
|
+
else
|
|
79
|
+
size_y
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# :section: LEVEL 2
|
|
87
|
+
|
|
88
|
+
def initialize &block
|
|
89
|
+
@block = block
|
|
90
|
+
super()
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def redraw
|
|
94
|
+
sx = @size_x - @stroke_width
|
|
95
|
+
sy = @size_y - @stroke_width
|
|
96
|
+
crayon = AreaCrayon.new self, true, sx * 0.5, sy * 0.5
|
|
97
|
+
crayon.autoupdate = false
|
|
98
|
+
crayon.instance_exec sx, sy, &@block
|
|
99
|
+
crayon.commit
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require_relative 'shape_area'
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
class Ellipse < ShapeArea
|
|
5
|
+
|
|
6
|
+
# :section: LEVEL 2
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
super
|
|
10
|
+
update
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def redraw
|
|
14
|
+
draw(true, @size_x * 0.5, @size_y * 0.5).ellipse @size_x - @stroke_width, @size_y - @stroke_width
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def update_stroke_width ...
|
|
18
|
+
super
|
|
19
|
+
@redraw_flag = true
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
# Base class for all graphical objects.
|
|
3
|
+
class Paint
|
|
4
|
+
|
|
5
|
+
# Set position along the X axis.
|
|
6
|
+
def set_x x = @x
|
|
7
|
+
return set_x yield @x if block_given?
|
|
8
|
+
return if @x == x
|
|
9
|
+
@x = x
|
|
10
|
+
update_transform
|
|
11
|
+
update
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# See #set_x.
|
|
15
|
+
def x= param
|
|
16
|
+
send_bundle :set_x, param
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Get position along the X axis.
|
|
20
|
+
def x
|
|
21
|
+
@x
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Set position along the Y axis.
|
|
25
|
+
def set_y y = @y
|
|
26
|
+
return set_y yield @y if block_given?
|
|
27
|
+
return if @y == y
|
|
28
|
+
@y = y
|
|
29
|
+
update_transform
|
|
30
|
+
update
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# See #set_y.
|
|
34
|
+
def y= param
|
|
35
|
+
send_bundle :set_y, param
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get position along the X axis.
|
|
39
|
+
def y
|
|
40
|
+
@y
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Set position along X and Y axes.
|
|
44
|
+
def set_xy x = @x, y = x
|
|
45
|
+
return send_bundle :set_xy, yield(self.xy) if block_given?
|
|
46
|
+
return if @x == x && @y == y
|
|
47
|
+
@x = x
|
|
48
|
+
@y = y
|
|
49
|
+
update_transform
|
|
50
|
+
update
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# See #set_xy.
|
|
54
|
+
def xy= param
|
|
55
|
+
send_bundle :set_xy, param
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Get position along X and Y axes.
|
|
59
|
+
def xy
|
|
60
|
+
[@x, @y]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Set turn around the pivot point.
|
|
64
|
+
def set_turn turn = @turn
|
|
65
|
+
return set_turn yield @turn if block_given?
|
|
66
|
+
return if @turn == turn
|
|
67
|
+
@turn = turn
|
|
68
|
+
update_transform
|
|
69
|
+
update
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# See #set_turn.
|
|
73
|
+
def turn= param
|
|
74
|
+
send_bundle :set_turn, param
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Get turn around the pivot point.
|
|
78
|
+
def turn
|
|
79
|
+
@turn
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Set zoom in the X axis.
|
|
83
|
+
def set_zoom_x zoom_x = @zoom_x
|
|
84
|
+
return set_zoom_x yield @zoom_x if block_given?
|
|
85
|
+
return if @zoom_x == zoom_x
|
|
86
|
+
@zoom_x = zoom_x
|
|
87
|
+
update_transform
|
|
88
|
+
update
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# See #set_zoom_x.
|
|
92
|
+
def zoom_x= param
|
|
93
|
+
send_bundle :set_zoom_x, param
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Get zoom in the X axis.
|
|
97
|
+
def zoom_x
|
|
98
|
+
@zoom_x
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Set zoom in the Y axis.
|
|
102
|
+
def set_zoom_y zoom_y = @zoom_y
|
|
103
|
+
return set_zoom_y yield @zoom_y if block_given?
|
|
104
|
+
return if @zoom_y == zoom_y
|
|
105
|
+
@zoom_y = zoom_y
|
|
106
|
+
update_transform
|
|
107
|
+
update
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# See #set_zoom_y.
|
|
111
|
+
def zoom_y= param
|
|
112
|
+
send_bundle :set_zoom_y, param
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Get zoom in the Y axis.
|
|
116
|
+
def zoom_y
|
|
117
|
+
@zoom_y
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Set zoom in X and Y axes.
|
|
121
|
+
def set_zoom zoom_x = @zoom_x, zoom_y = zoom_x, **ka
|
|
122
|
+
return send_bundle :set_zoom, yield(self.zoom) if block_given?
|
|
123
|
+
unless @zoom_x == zoom_x && @zoom_y == zoom_y
|
|
124
|
+
@zoom_x = zoom_x
|
|
125
|
+
@zoom_y = zoom_y
|
|
126
|
+
update_transform
|
|
127
|
+
update
|
|
128
|
+
end | send_branch(__method__, ka)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# See #set_zoom.
|
|
132
|
+
def zoom= param
|
|
133
|
+
send_bundle :set_zoom, param
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Get zoom in X and Y axes.
|
|
137
|
+
def zoom
|
|
138
|
+
[@zoom_x, @zoom_y]
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Set opacity degree.
|
|
142
|
+
def set_opacity opacity = @opacity
|
|
143
|
+
return set_opacity yield @opacity if block_given?
|
|
144
|
+
return if @opacity == opacity
|
|
145
|
+
Pastele.paint_set_opacity @pointer, opacity.to_i
|
|
146
|
+
@opacity = opacity
|
|
147
|
+
update
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# See #set_opacity.
|
|
151
|
+
def opacity= param
|
|
152
|
+
send_bundle :set_opacity, param
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Get opacity degree.
|
|
156
|
+
def opacity
|
|
157
|
+
@opacity
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Available blending methods.
|
|
161
|
+
class BlendMethod
|
|
162
|
+
class << self
|
|
163
|
+
# Blending disabled (default).
|
|
164
|
+
def normal = 0
|
|
165
|
+
def add = 1
|
|
166
|
+
def screen = 2
|
|
167
|
+
def multiply = 3
|
|
168
|
+
def overlay = 4
|
|
169
|
+
def difference = 5
|
|
170
|
+
def exclusion = 6
|
|
171
|
+
def srcover = 7
|
|
172
|
+
def darken = 9
|
|
173
|
+
def lighten = 10
|
|
174
|
+
def color_dodge = 11
|
|
175
|
+
def color_burn = 12
|
|
176
|
+
def hard_light = 13
|
|
177
|
+
def soft_light = 14
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Set color blending method.
|
|
182
|
+
def set_blend blend = @blend
|
|
183
|
+
return set_blend yield @blend if block_given?
|
|
184
|
+
return if @blend == blend
|
|
185
|
+
Pastele.paint_set_blend_method @pointer, BlendMethod.send(blend || :normal)
|
|
186
|
+
@blend = blend
|
|
187
|
+
update
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# See #set_blend.
|
|
191
|
+
def blend= param
|
|
192
|
+
send_bundle :set_blend, param
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Get color blending method.
|
|
196
|
+
def blend
|
|
197
|
+
@blend
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Available masking methods.
|
|
201
|
+
class MaskMethod
|
|
202
|
+
class << self
|
|
203
|
+
# Masking disabled (default).
|
|
204
|
+
def none = 0
|
|
205
|
+
def alpha = 1
|
|
206
|
+
def inv_alpha = 2
|
|
207
|
+
def luma = 3
|
|
208
|
+
def inv_luma = 4
|
|
209
|
+
def add = 5
|
|
210
|
+
def substract = 6
|
|
211
|
+
def intersect = 7
|
|
212
|
+
def difference = 8
|
|
213
|
+
def lighten = 9
|
|
214
|
+
def darken = 10
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Set color masking method with +target+.
|
|
219
|
+
def set_mask mask = @mask, target = nil
|
|
220
|
+
return send_bundle :set_mask, yield(@mask, @mask_target) if block_given?
|
|
221
|
+
return if @mask == mask && @mask_target == target
|
|
222
|
+
@mask_target&.unset_masking
|
|
223
|
+
target&.update_masking self
|
|
224
|
+
Pastele.paint_set_mask @pointer, target&.pointer, MaskMethod.send(mask || :none)
|
|
225
|
+
@mask = mask
|
|
226
|
+
@mask_target = target
|
|
227
|
+
update
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# See #set_mask.
|
|
231
|
+
def mask= param
|
|
232
|
+
send_bundle :set_mask, param
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Get color masking method.
|
|
236
|
+
def mask
|
|
237
|
+
@mask
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Set whether Paint is scenic.
|
|
241
|
+
#
|
|
242
|
+
# All lower level Scenes must be scenic for the Paint to be displayed.
|
|
243
|
+
def set_scenic value = true
|
|
244
|
+
return if (c = scenic) == (value = block_given? ? yield(c) : value == Not ? !c : value)
|
|
245
|
+
update_scenic value
|
|
246
|
+
true
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# See #set_scenic.
|
|
250
|
+
def scenic= value
|
|
251
|
+
set_scenic value
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Get whether Paint is scenic.
|
|
255
|
+
def scenic
|
|
256
|
+
@scene&.paint_scenic self
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Get whether Paint is displayed.
|
|
260
|
+
def displayed
|
|
261
|
+
@scene&.paint_displayed self
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Set the Kredki::Shape to use as the Paint clipping path.
|
|
265
|
+
def set_clip clip = @clip
|
|
266
|
+
return yield @clip if block_given?
|
|
267
|
+
clip = nil unless clip
|
|
268
|
+
return if @clip == clip
|
|
269
|
+
@clip&.unset_masking
|
|
270
|
+
clip&.update_masking self
|
|
271
|
+
Pastele.paint_set_clip @pointer, clip&.pointer
|
|
272
|
+
@clip = clip
|
|
273
|
+
update
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# See #set_clip.
|
|
277
|
+
def clip= param
|
|
278
|
+
send_bundle :set_clip, param
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Get the Kredki::Shape used as the Paint clipping path.
|
|
282
|
+
def clip
|
|
283
|
+
@clip
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# Get the extreme coordinates occupied by the Paint.
|
|
287
|
+
def bounds
|
|
288
|
+
bounds = Pastele::Bounds.malloc(Fiddle::RUBY_FREE)
|
|
289
|
+
Pastele.paint_get_bounds @pointer, bounds
|
|
290
|
+
bounds
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# Detach the Paint from the containing Kredki::Scene.
|
|
294
|
+
def detach
|
|
295
|
+
@scene&.delete_paint self
|
|
296
|
+
@scene = nil
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Attach the Paint to the Kredki::Scene.
|
|
300
|
+
def attach scene, hidden = false, at = nil
|
|
301
|
+
@scene&.delete_paint self
|
|
302
|
+
scene.put_paint self, scenic, at
|
|
303
|
+
@scene = scene
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Get window.
|
|
307
|
+
def window
|
|
308
|
+
@scene&.window
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# Set a feature recognized by its class.
|
|
312
|
+
def << feature
|
|
313
|
+
case feature
|
|
314
|
+
when Hash
|
|
315
|
+
set **feature
|
|
316
|
+
when Array
|
|
317
|
+
set *feature
|
|
318
|
+
when Proc
|
|
319
|
+
set &feature
|
|
320
|
+
else
|
|
321
|
+
raise "Unsupported << (#{feature} : #{feature.class})"
|
|
322
|
+
end
|
|
323
|
+
self
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# Get features.
|
|
327
|
+
def to_hash
|
|
328
|
+
{
|
|
329
|
+
x: @x,
|
|
330
|
+
y: @y,
|
|
331
|
+
turn: @turn,
|
|
332
|
+
zoom_x: @zoom_x,
|
|
333
|
+
zoom_y: @zoom_y,
|
|
334
|
+
opacity: @opacity,
|
|
335
|
+
blend: @blend,
|
|
336
|
+
}
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# :section: LEVEL 2
|
|
340
|
+
|
|
341
|
+
def initialize pointer
|
|
342
|
+
@pointer = pointer
|
|
343
|
+
@scene = nil
|
|
344
|
+
@x = 0
|
|
345
|
+
@y = 0
|
|
346
|
+
@turn = 0
|
|
347
|
+
@zoom_x = 1
|
|
348
|
+
@zoom_y = 1
|
|
349
|
+
@opacity = 255
|
|
350
|
+
@blend = nil
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
attr :pointer
|
|
354
|
+
attr_accessor :scene
|
|
355
|
+
|
|
356
|
+
def inspect
|
|
357
|
+
"#{self.class}:#{object_id}"
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
def update_masking scene
|
|
361
|
+
@scene&.delete_paint self unless @is_mask
|
|
362
|
+
@scene = scene
|
|
363
|
+
@is_mask = true
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def unset_masking
|
|
367
|
+
@scene = nil
|
|
368
|
+
@is_mask = false
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
def update
|
|
372
|
+
if @is_mask
|
|
373
|
+
@scene.update
|
|
374
|
+
else
|
|
375
|
+
@scene&.update_paint self
|
|
376
|
+
true
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def update_scenic scenic
|
|
381
|
+
scenic ? @scene&.show_paint(self) : @scene&.hide_paint(self)
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
def pivot
|
|
385
|
+
[0, 0]
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
def update_transform
|
|
389
|
+
Pastele.paint_set_transform @pointer, *pivot, @x, @y, 2 * Math::PI * @turn, @zoom_x, @zoom_y
|
|
390
|
+
end
|
|
391
|
+
end#Paint
|
|
392
|
+
end#Kredki
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
require_relative 'paint'
|
|
2
|
+
require_relative 'area'
|
|
3
|
+
|
|
4
|
+
module Kredki
|
|
5
|
+
class Picture < Paint
|
|
6
|
+
include Area
|
|
7
|
+
|
|
8
|
+
# Set content.
|
|
9
|
+
def set_content content, reset_size = false
|
|
10
|
+
return set_content yield @content if block_given?
|
|
11
|
+
return if @content == content
|
|
12
|
+
string_content = content.to_s
|
|
13
|
+
raise "File \"#{c}\" not found." unless File.exist? string_content
|
|
14
|
+
renew if @content
|
|
15
|
+
Pastele.picture_load @pointer, string_content
|
|
16
|
+
@content = content
|
|
17
|
+
@original_size_x, @original_size_y = fetch_size
|
|
18
|
+
if reset_size
|
|
19
|
+
@size_x = @original_size_x
|
|
20
|
+
@size_y = @original_size_y
|
|
21
|
+
update_transform
|
|
22
|
+
else
|
|
23
|
+
@redraw_flag = true
|
|
24
|
+
end
|
|
25
|
+
update
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# See #set_content.
|
|
29
|
+
def content= param
|
|
30
|
+
send_bundle :set_content, param
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Get content.
|
|
34
|
+
def content
|
|
35
|
+
@content
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get original size.
|
|
39
|
+
def original_size
|
|
40
|
+
[@original_size_x, @original_size_y]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Find shape of the picture.
|
|
44
|
+
def find_shape id
|
|
45
|
+
paint = Pastele.picture_accessor_get @pointer, id
|
|
46
|
+
if !paint.null? && Pastele.paint_get_type(paint) == 1
|
|
47
|
+
shape = Shape.new(true, paint)
|
|
48
|
+
shape.update_masking self
|
|
49
|
+
shape
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Traverse shape tree of the picture.
|
|
54
|
+
def each_shape &block
|
|
55
|
+
callback = Fiddle::Closure::BlockCaller.new Fiddle::TYPE_INT, [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP] do |paint, data|
|
|
56
|
+
if Pastele.paint_get_type(paint) == 1
|
|
57
|
+
shape = Shape.new(true, paint)
|
|
58
|
+
shape.update_masking self
|
|
59
|
+
block.call shape
|
|
60
|
+
end
|
|
61
|
+
1
|
|
62
|
+
end
|
|
63
|
+
Pastele.paint_accessor_traverse @pointer, callback
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Set a feature recognized by its class.
|
|
67
|
+
def << feature
|
|
68
|
+
case feature
|
|
69
|
+
in [x, y]
|
|
70
|
+
set_size x, y
|
|
71
|
+
in Numeric
|
|
72
|
+
set_size feature
|
|
73
|
+
in String
|
|
74
|
+
set_content feature
|
|
75
|
+
else
|
|
76
|
+
super
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# :section: LEVEL 2
|
|
81
|
+
|
|
82
|
+
def initialize pointer = nil
|
|
83
|
+
@size_x = @size_y = 100
|
|
84
|
+
@original_size_x = @original_size_y = 100.0
|
|
85
|
+
@redraw_flag = true
|
|
86
|
+
return super if pointer
|
|
87
|
+
super Pastele.picture_new
|
|
88
|
+
ObjectSpace.define_finalizer(self, Picture.finalizer(@pointer))
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def renew
|
|
92
|
+
pointer = Pastele.picture_new
|
|
93
|
+
@scene.renew_paint self, @pointer, pointer
|
|
94
|
+
Pastele.paint_delete @pointer
|
|
95
|
+
@pointer = pointer
|
|
96
|
+
ObjectSpace.define_finalizer(self, Picture.finalizer(@pointer))
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def self.finalizer pointer
|
|
100
|
+
proc{ Pastele.paint_delete pointer }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def aspect_ratio
|
|
104
|
+
@original_size_x / @original_size_y
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def fetch_size
|
|
108
|
+
size = Pastele::Point.malloc(Fiddle::RUBY_FREE)
|
|
109
|
+
Pastele.picture_get_size @pointer, size
|
|
110
|
+
[size.x, size.y]
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def pivot
|
|
114
|
+
[@size_x * 0.5, @size_y * 0.5]
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def update
|
|
118
|
+
if @redraw_flag
|
|
119
|
+
@redraw_flag = false
|
|
120
|
+
Pastele.picture_set_size @pointer, @size_x, @size_y
|
|
121
|
+
update_transform
|
|
122
|
+
end
|
|
123
|
+
super
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|