UI: Transparency Checkerboard behind File Browser Thumbnails #108554

Merged
Harley Acheson merged 2 commits from Harley/blender:ThumbnailTransparency into main 2023-07-01 00:23:26 +02:00
Member

For thumbnails of image file types in the File Browser use the
checkerboard pattern as background to help indicate that the image
could contain transparency.


For many operating systems and programs preview thumbnails of images will use white or black in place of transparent pixels. Blender does this better in that our preview images will have the same transparency as the original image. However this means that when viewing such a thumbnail the body of the image will differ depending on the Blender theme, because the background color bleeds through. The following shows the same thumbnail on dark and light themes:

image

This PR just draws the background with our checkerboard pattern before placing the image. The following shows the same image, although this time showing it in two different sizes:

image

And of course they look similar on a light background. But note that the colors of the checkerboard are in the theme.

image

But at least it is obvious that the outer portion of the image is transparent in both cases.

For thumbnails of image file types in the File Browser use the checkerboard pattern as background to help indicate that the image could contain transparency. --- For many operating systems and programs preview thumbnails of images will use white or black in place of transparent pixels. Blender does this better in that our preview images will have the same transparency as the original image. However this means that when viewing such a thumbnail the body of the image will differ depending on the Blender theme, because the background color bleeds through. The following shows the same thumbnail on dark and light themes: ![image](/attachments/930f69ba-7105-4136-8de6-5c7bf1bb80d1) This PR just draws the background with our checkerboard pattern before placing the image. The following shows the same image, although this time showing it in two different sizes: ![image](/attachments/3b587dab-1ce4-45b7-9d90-a3f44908a4ce) And of course they look similar on a light background. But note that the colors of the checkerboard are in the theme. ![image](/attachments/ed512ac5-7459-459d-a774-1d7819db9a79) But at least it is obvious that the outer portion of the image is transparent in both cases.
101 KiB
140 KiB
101 KiB
Harley Acheson added 1 commit 2023-06-02 17:52:35 +02:00
6b8dba7e7f UI: Transparency Checkerboard behind File Browser Thumbnails
For thumbnails of image file types in the File Browser use the
checkerboard pattern as background help indicate that the image could
contain transparency.
Harley Acheson added this to the User Interface project 2023-06-02 17:52:52 +02:00
Harley Acheson requested review from Pablo Vazquez 2023-06-02 17:53:01 +02:00
Harley Acheson requested review from Julian Eisel 2023-06-02 18:01:25 +02:00
Pablo Vazquez approved these changes 2023-06-02 18:07:21 +02:00
Pablo Vazquez left a comment
Member

Nice catch! Never noticed it was missing.

No idea code-wise but +1 for UI.

Nice catch! Never noticed it was missing. No idea code-wise but +1 for UI.
Jesse Yurkovich reviewed 2023-06-02 22:47:26 +02:00
@ -425,1 +425,4 @@
if (!is_icon && file->typeflag & FILE_TYPE_IMAGE) {
/* Draw checker pattern behind image previews in case they have transparency. */
imm_draw_box_checker_2d((float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));

For c++ files, these casts should be "functional style" e.g. float(xco) and float(xco + ex) etc.
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast

For c++ files, these casts should be "functional style" e.g. `float(xco)` and `float(xco + ex)` etc. https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast
Harley marked this conversation as resolved
Harley Acheson added 1 commit 2023-06-02 23:00:10 +02:00
Author
Member

@deadpin - Thanks!

@deadpin - Thanks!
Harley Acheson merged commit e9e12015ea into main 2023-07-01 00:23:26 +02:00
Harley Acheson deleted branch ThumbnailTransparency 2023-07-01 00:23:28 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#108554
No description provided.