Repository navigation
Add attributed booth QR code #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| [remap] | ||
|
|
||
| importer="texture" | ||
| type="CompressedTexture2D" | ||
| uid="uid://b10olno1qij0m" | ||
| path="res://.godot/imported/booth_qr.png-5aaeaad2f8935f6369e746678fa82863.ctex" | ||
| metadata={ | ||
| "vram_texture": false | ||
| } | ||
|
|
||
| [deps] | ||
|
|
||
| source_file="res://Assets/booth/booth_qr.png" | ||
| dest_files=["res://.godot/imported/booth_qr.png-5aaeaad2f8935f6369e746678fa82863.ctex"] | ||
|
|
||
| [params] | ||
|
|
||
| compress/mode=0 | ||
| compress/high_quality=false | ||
| compress/lossy_quality=0.7 | ||
| compress/uastc_level=0 | ||
| compress/rdo_quality_loss=0.0 | ||
| compress/hdr_compression=1 | ||
| compress/normal_map=0 | ||
| compress/channel_pack=0 | ||
| mipmaps/generate=false | ||
| mipmaps/limit=-1 | ||
| roughness/mode=0 | ||
| roughness/src_normal="" | ||
| process/channel_remap/red=0 | ||
| process/channel_remap/green=1 | ||
| process/channel_remap/blue=2 | ||
| process/channel_remap/alpha=3 | ||
| process/fix_alpha_border=true | ||
| process/premult_alpha=false | ||
| process/normal_map_invert_y=false | ||
| process/hdr_as_srgb=false | ||
| process/hdr_clamp_exposure=false | ||
| process/size_limit=0 | ||
| detect_3d/compress_to=1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions
40
hoppys-adventure-arcade/Assets/booth/booth_qr_logo.png.import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| [remap] | ||
|
|
||
| importer="texture" | ||
| type="CompressedTexture2D" | ||
| uid="uid://dp1njvgw18v7c" | ||
| path="res://.godot/imported/booth_qr_logo.png-8be0cf10ff0693dea7aa858282c39071.ctex" | ||
| metadata={ | ||
| "vram_texture": false | ||
| } | ||
|
|
||
| [deps] | ||
|
|
||
| source_file="res://Assets/booth/booth_qr_logo.png" | ||
| dest_files=["res://.godot/imported/booth_qr_logo.png-8be0cf10ff0693dea7aa858282c39071.ctex"] | ||
|
|
||
| [params] | ||
|
|
||
| compress/mode=0 | ||
| compress/high_quality=false | ||
| compress/lossy_quality=0.7 | ||
| compress/uastc_level=0 | ||
| compress/rdo_quality_loss=0.0 | ||
| compress/hdr_compression=1 | ||
| compress/normal_map=0 | ||
| compress/channel_pack=0 | ||
| mipmaps/generate=false | ||
| mipmaps/limit=-1 | ||
| roughness/mode=0 | ||
| roughness/src_normal="" | ||
| process/channel_remap/red=0 | ||
| process/channel_remap/green=1 | ||
| process/channel_remap/blue=2 | ||
| process/channel_remap/alpha=3 | ||
| process/fix_alpha_border=true | ||
| process/premult_alpha=false | ||
| process/normal_map_invert_y=false | ||
| process/hdr_as_srgb=false | ||
| process/hdr_clamp_exposure=false | ||
| process/size_limit=0 | ||
| detect_3d/compress_to=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| extends Control | ||
|
|
||
| const QR_TEXTURE: Texture2D = preload("res://Assets/booth/booth_qr.png") | ||
|
|
||
| func _ready() -> void: | ||
| set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) | ||
| mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
| var panel := PanelContainer.new() | ||
| panel.name = "BoothQrPanel" | ||
| panel.set_anchors_preset(Control.PRESET_TOP_RIGHT) | ||
| panel.offset_left = -208 | ||
| panel.offset_top = 24 | ||
| panel.offset_right = -24 | ||
| panel.offset_bottom = 230 | ||
| panel.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
| var panel_style := StyleBoxFlat.new() | ||
| panel_style.bg_color = Color("fffaf2") | ||
| panel_style.border_color = Color("182432") | ||
| panel_style.set_border_width_all(2) | ||
| panel_style.set_corner_radius_all(8) | ||
| panel_style.content_margin_left = 10 | ||
| panel_style.content_margin_right = 10 | ||
| panel_style.content_margin_top = 8 | ||
| panel_style.content_margin_bottom = 8 | ||
| panel.add_theme_stylebox_override("panel", panel_style) | ||
| add_child(panel) | ||
|
|
||
| var content := VBoxContainer.new() | ||
| content.alignment = BoxContainer.ALIGNMENT_CENTER | ||
| content.add_theme_constant_override("separation", 4) | ||
| content.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
| panel.add_child(content) | ||
|
|
||
| var heading := Label.new() | ||
| heading.text = "SCAN TO LEARN MORE" | ||
| heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER | ||
| heading.add_theme_font_size_override("font_size", 11) | ||
| heading.add_theme_color_override("font_color", Color("182432")) | ||
| heading.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
| content.add_child(heading) | ||
|
|
||
| var code := TextureRect.new() | ||
| code.texture = QR_TEXTURE | ||
| code.custom_minimum_size = Vector2(148, 148) | ||
| code.expand_mode = TextureRect.EXPAND_IGNORE_SIZE | ||
| code.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED | ||
| code.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
| content.add_child(code) | ||
|
|
||
| var attribution := Label.new() | ||
| attribution.text = "CODERABBIT.LINK" | ||
| attribution.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER | ||
| attribution.add_theme_font_size_override("font_size", 10) | ||
| attribution.add_theme_color_override("font_color", Color("536271")) | ||
| attribution.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
| content.add_child(attribution) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://bxotudq7alix7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import AppKit | ||
| import CoreImage.CIFilterBuiltins | ||
| import Foundation | ||
|
|
||
| let defaultURL = "https://coderabbit.link/ato26-ad?qr=1" | ||
| let scriptDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() | ||
| let projectDirectory = scriptDirectory.deletingLastPathComponent().deletingLastPathComponent() | ||
| let defaultOutput = projectDirectory.appendingPathComponent("Assets/booth/booth_qr.png").path | ||
| let logoPath = projectDirectory.appendingPathComponent("Assets/booth/booth_qr_logo.png").path | ||
| let output = CommandLine.arguments.count > 1 ? CommandLine.arguments[1] : defaultOutput | ||
| let value = CommandLine.arguments.count > 2 ? CommandLine.arguments[2] : defaultURL | ||
|
|
||
| let filter = CIFilter.qrCodeGenerator() | ||
| filter.message = Data(value.utf8) | ||
| filter.correctionLevel = "H" | ||
|
|
||
| guard let image = filter.outputImage?.transformed(by: CGAffineTransform(scaleX: 12, y: 12)) else { | ||
| fatalError("Could not generate QR code") | ||
| } | ||
| let qr = NSBitmapImageRep(ciImage: image) | ||
| guard let logo = NSImage(contentsOfFile: logoPath), | ||
| let logoTiff = logo.tiffRepresentation, | ||
| let logoBitmap = NSBitmapImageRep(data: logoTiff) else { | ||
| fatalError("Could not load QR or CodeRabbit logo image") | ||
| } | ||
|
|
||
| let size = NSSize(width: qr.pixelsWide, height: qr.pixelsHigh) | ||
| let composite = NSImage(size: size) | ||
| composite.lockFocus() | ||
| NSColor.white.setFill() | ||
| NSRect(origin: .zero, size: size).fill() | ||
| qr.draw(in: NSRect(origin: .zero, size: size)) | ||
| let logoSize = size.width * 0.223 | ||
| let logoRect = NSRect(x: (size.width - logoSize) / 2, y: (size.height - logoSize) / 2, | ||
| width: logoSize, height: logoSize) | ||
| logoBitmap.draw(in: logoRect) | ||
| composite.unlockFocus() | ||
|
|
||
| guard let tiff = composite.tiffRepresentation, | ||
| let bitmap = NSBitmapImageRep(data: tiff), | ||
| let png = bitmap.representation(using: .png, properties: [:]) else { | ||
| fatalError("Could not encode QR code as PNG") | ||
| } | ||
| try png.write(to: URL(fileURLWithPath: output)) | ||
| print("Wrote \(output) for \(value)") | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: coderabbitai/coderabbit-arcade
Length of output: 4774
🏁 Script executed:
Repository: coderabbitai/coderabbit-arcade
Length of output: 7799
🏁 Script executed:
Repository: coderabbitai/coderabbit-arcade
Length of output: 2177
🌐 Web query:
Apple Core Image CIFilter qrCodeGenerator output image extent quiet zone border documentation💡 Result:
🏁 Script executed:
Repository: coderabbitai/coderabbit-arcade
Length of output: 11472
🏁 Script executed:
Repository: coderabbitai/coderabbit-arcade
Length of output: 2748
🏁 Script executed:
Repository: coderabbitai/coderabbit-arcade
Length of output: 689
Add a four-module quiet zone before regenerating the QR asset.
The helper can regenerate a QR image with only a one-module border. The displayed asset adds only about three modules between the QR symbol and the adjacent labels. This does not preserve the required four-module quiet zone and can reduce scanning reliability in booth mode.
Suggested fix
Regenerate
Assets/booth/booth_qr.pngafter applying this change.🤖 Prompt for AI Agents