Room database entity classes with links to source code
The Pixel Create application uses Room Database for local data persistence. The entity classes below represent the database schema and are mapped to SQLite tables. Each entity corresponds to a specific aspect of the pixel art creation workflow.
For a visual representation of how these entities relate to each other, see the Entity-Relationship Diagram and UML Class Diagram.
| Entity Class | Description | Source Code |
|---|---|---|
| User | Stores user account information, OAuth authentication key (unique identifier from authentication provider), and personalized settings including default canvas dimensions, theme preferences, and tool settings. | User.java |
| Project | Represents a pixel art creation with metadata including project name, canvas dimensions, timestamps, thumbnail preview, and soft-delete flag. Central entity that ties together layers, snapshots, and export history. | Project.java |
| Layer | Individual drawing layers within a project supporting complex artwork with stacking order, visibility controls, lock state, and opacity settings. | Layer.java |
| Pixel | Stores individual pixel color data tied to a specific layer and position. Contains x/y coordinates, color value, and last modified timestamp. | Pixel.java |
| Entity Class | Description | Source Code |
|---|---|---|
| Palette | User-created color collections for consistent artwork styling. Contains palette name, default flag, and usage timestamps for sorting recently used palettes. | Palette.java |
| PaletteColor | Individual colors within a palette. Stores color value (ARGB/hex), display order, and optional user-defined color name. | PaletteColor.java |
| Entity Class | Description | Source Code |
|---|---|---|
| AutosaveSnapshot | Periodic backups of project state to prevent data loss. Contains serialized project data (JSON or binary), creation timestamp, and file size for storage tracking. | AutosaveSnapshot.java |
| ExportHistory | Logs every export operation for tracking and re-export functionality. Records file name, path, format (PNG, JPG, etc.), resolution, scale factor, and file size. | ExportHistory.java |
The relationships between these entities follow standard database normalization principles:
For detailed cardinality information and relationship constraints, see the ERD documentation.
Each entity has a corresponding DAO interface that provides database operations (CRUD - Create, Read, Update, Delete). These interfaces are implemented by Room Database at compile time.
| DAO Interface | Description | Source Code |
|---|---|---|
| UserDao | Data access operations for User entity. Provides methods to insert, update, delete users, and query by ID, username, or email. Returns LiveData for reactive UI updates. | UserDao.java |
| ProjectDao | Data access operations for Project entity. Manages project CRUD operations, queries projects by user, and supports filtering by deletion status. | ProjectDao.java |
| LayerDao | Data access operations for Layer entity. Handles layer management within projects, including ordering, visibility, and lock state queries. | LayerDao.java |
| PixelDao | Data access operations for Pixel entity. Manages individual pixel data with queries by layer, coordinate, and bulk operations for efficient canvas rendering. | PixelDao.java |
| DAO Interface | Description | Source Code |
|---|---|---|
| PaletteDao | Data access operations for Palette entity. Manages custom palette collections, queries by user, and tracks recently used palettes. | PaletteDao.java |
| PaletteColorDao | Data access operations for PaletteColor entity. Handles individual colors within palettes, including ordering and color lookup operations. | PaletteColorDao.java |
| DAO Interface | Description | Source Code |
|---|---|---|
| AutosaveSnapshotDao | Data access operations for AutosaveSnapshot entity. Manages project backup snapshots with retention policy support and timestamp-based queries. | AutosaveSnapshotDao.java |
| ExportHistoryDao | Data access operations for ExportHistory entity. Tracks export operations with queries by project, format, and date range for export analytics. | ExportHistoryDao.java |
These entities and DAOs are managed by the Room Database framework. For more information:
LocalDatabase class coordinates all DAOs and entitiesLocalDatabase.Converters class handles conversion of Instant timestamps to SQLite-compatible types